You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dispatch turn resume fails to find persisted user message after auth pause #1809
An agent-dispatch turn paused for provider authorization. After authorization completed, the resume handler (beforeStart in packages/junior/src/chat/task-execution/paused-turn.ts) could not locate the persisted user message for the turn, so it treated the session as stranded and failed it via failStrandedTurnWithFallback (guard added for issue #727).
Observed once in production on release 0.204.0. Sentry JUNIOR-9D
Likely mechanism:
getTurnUserMessage matches on buildDeterministicTurnId(messageId) (turn_<messageId>), which never matches a dispatch turn id (dispatch:<dispatchId>), so dispatch resumes always depend on the dispatchUserMessage fallback.
That fallback requires the dispatch's synthetic input message (id agent-dispatch:<dispatchId>) to already be present in conversation.messages after hydrateConversationMessages. A single occurrence suggests a timing/race window where the auth-resume wakes the turn before that message is hydrated/visible.
To reproduce or narrow further:
Trigger a plugin/agent-dispatch turn that pauses for provider auth and complete auth quickly after the pause.
Check whether hydrateConversationMessages reliably includes the dispatch mailbox message immediately after wake.
Correlate with agent.turn.stranded_session.failed and turn.router.classifier.failed log events around the resume.
Root cause found, and it's not the dispatch turn id. In every recent JUNIOR-9D event the turn id is the Slack reply turn id (turn_<slack ts>): a human replied in the thread under an automation/Watch post, so the turn ran in the agent-dispatch:… Conversation. The Slack turn saved its state, including that reply, under the Slack thread id instead of the owning Conversation id. When the turn paused for auth, resume read the owning Conversation, did not find the reply, and failed it as stranded. The fallback then posted the error as a new channel message because the dispatch Conversation id has no Slack thread.
Activity
sentry-junior commentedon Oct 30, 2026
Root cause found, and it's not the dispatch turn id. In every recent JUNIOR-9D event the turn id is the Slack reply turn id (
turn_<slack ts>): a human replied in the thread under an automation/Watch post, so the turn ran in theagent-dispatch:…Conversation. The Slack turn saved its state, including that reply, under the Slack thread id instead of the owning Conversation id. When the turn paused for auth, resume read the owning Conversation, did not find the reply, and failed it as stranded. The fallback then posted the error as a new channel message because the dispatch Conversation id has no Slack thread.Fix and regression test: #2458
fix(slack): Save thread replies to the Conversation that owns the thread
fix(slack): Save thread replies to the Conversation that owns the thr…