Repository navigation
fix(slack-bot): handle stuck external-authorization sessions gracefully - #1287
Merged
Merged
Conversation
kantord
marked this pull request as ready for review
September 9, 2026 10:30
rdimitrov
approved these changes
Sep 9, 2026
samuv
reviewed
Sep 9, 2026
| app.logger.error("mecatl prompt failed", error); | ||
| await notifyError(FAILURE_MESSAGE); | ||
| if (isStuckExternalAuthorization(error)) { | ||
| bridge.evictSession(threadKey); |
Contributor
There was a problem hiding this comment.
[P2] Evict before releasing the per-thread queue
Could we move this eviction into the queued operation in MecatlBridge.handlePrompt, before the promise stored in #queues settles? Slack can deliver two messages for the same thread while the first is still running. The second call is already chained to #queues; when the first run rejects, that chain starts #runPrompt before this outer catch resumes, so it reuses the stuck session. A burst can also let an older catch delete a newer session. A regression test with two back-to-back calls where the first rejects with this error would pin down the intended "next message starts fresh" behavior.
JAORMX
pushed a commit
that referenced
this pull request
Sep 9, 2026
This was referenced Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
failed_precondition/ "has a live external authorization" server error, reply with an actionable message instead of the generic one, and evict the thread's cached session so the next message starts fresh.Changes
bridge.ts: addedMecatlBridge.evictSession(threadKey).agentSessions.ts: detect the stuck-authorizationServerErrorinrunPrompt's catch block, reply with an actionable message, evict the session.bridge.test.ts, actionable-reply + no-over-fire-on-generic-errors inagentSessions.test.ts.Fixes #1283
Test plan
pnpm run typecheck(sdk/typescript/examples/slack-bot)pnpm run lintpnpm run test— 21/21 passingFully or partially written by an AI agent.
🤖 Generated with Claude Code