Skip to content

Time out awaitJob when a launched tool never reports back - #213

Open
imaustink wants to merge 1 commit into
mainfrom
worktree-fix-launch-timeout
Open

Time out awaitJob when a launched tool never reports back#213
imaustink wants to merge 1 commit into
mainfrom
worktree-fix-launch-timeout

Conversation

@imaustink

Copy link
Copy Markdown
Owner

Summary

  • CallbackReceiver.awaitJob() and NatsJobReceiver.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.
  • awaitJob now rejects with a new JobTimeoutError after DEFAULT_JOB_TIMEOUT_MS (10 minutes) of silence, configurable per-call via opts.timeoutMs. Pending timers are cleared on normal resolution.
  • agent/graph.ts's existing runTool catch block (which already labels launch failures for the chat) now labels a timeout distinctly (tool X timed out: ...) instead of the misleading failed to launch.

Test plan

  • npx vitest run src/callback src/agent/graph.test.ts src/agent/dispatch-tool.test.ts — 156 passed, including a new JobTimeoutError test
  • npx tsc --noEmit — no new errors (pre-existing unrelated @controller-agent/messaging build-ordering errors confirmed present before this change too)

🤖 Generated with Claude Code

https://claude.ai/code/session_01HmQ2VLfAt9s1SCXrY5mLPr

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant