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.
via neel.
--
View Junior Session [Sentry]
An
agent-dispatchturn paused for provider authorization. After authorization completed, the resume handler (beforeStartinpackages/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 viafailStrandedTurnWithFallback(guard added for issue #727).Observed once in production on release
0.204.0. Sentry JUNIOR-9DLikely mechanism:
getTurnUserMessagematches onbuildDeterministicTurnId(messageId)(turn_<messageId>), which never matches a dispatch turn id (dispatch:<dispatchId>), so dispatch resumes always depend on thedispatchUserMessagefallback.agent-dispatch:<dispatchId>) to already be present inconversation.messagesafterhydrateConversationMessages. 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:
hydrateConversationMessagesreliably includes the dispatch mailbox message immediately after wake.agent.turn.stranded_session.failedandturn.router.classifier.failedlog events around the resume.via neel.
--
View Junior Session [Sentry]