Time out awaitJob when a launched tool never reports back - #213
Open
imaustink wants to merge 1 commit into
Open
Conversation
CallbackReceiver/NatsJobReceiver.awaitJob() had no timeout: if a Job/ToolRun failed silently or never posted a callback, the Promise hung forever, and the chat UI appeared to hang indefinitely (the SSE heartbeat and TemporalEngine's 30-minute poll only kept the transport alive, they never surfaced an error). awaitJob now rejects with JobTimeoutError after 10 minutes of silence (configurable via opts.timeoutMs), and graph.ts labels that case distinctly from a launch failure. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmQ2VLfAt9s1SCXrY5mLPr
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
CallbackReceiver.awaitJob()andNatsJobReceiver.awaitJob()had no timeout — if a launched tool Job/ToolRun failed silently or never posted its terminal callback, the awaited Promise hung forever. The 15s SSE heartbeat and TemporalEngine's 30-minute whole-turn poll only kept the transport alive; neither ever surfaced an error, which is why a tool that failed to launch left the chat UI appearing to hang indefinitely.awaitJobnow rejects with a newJobTimeoutErrorafterDEFAULT_JOB_TIMEOUT_MS(10 minutes) of silence, configurable per-call viaopts.timeoutMs. Pending timers are cleared on normal resolution.agent/graph.ts's existingrunToolcatch block (which already labels launch failures for the chat) now labels a timeout distinctly (tool X timed out: ...) instead of the misleadingfailed to launch.Test plan
npx vitest run src/callback src/agent/graph.test.ts src/agent/dispatch-tool.test.ts— 156 passed, including a newJobTimeoutErrortestnpx tsc --noEmit— no new errors (pre-existing unrelated@controller-agent/messagingbuild-ordering errors confirmed present before this change too)🤖 Generated with Claude Code
https://claude.ai/code/session_01HmQ2VLfAt9s1SCXrY5mLPr