Skip to content

fix: unhandled rejection in /invoke fire-and-forget path - #190

Merged
imaustink merged 1 commit into
mainfrom
fix/invoke-unhandled-rejection-185
Aug 1, 2026
Merged

fix: unhandled rejection in /invoke fire-and-forget path#190
imaustink merged 1 commit into
mainfrom
fix/invoke-unhandled-rejection-185

Conversation

@imaustink

@imaustink imaustink commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • InvokeServer's /invoke handler stores invocation state in an in-process Map, and the fire-and-forget chain only caught rejections from graph.invoke(), not from buildGraphInput() itself.
  • buildGraphInput awaits sessionStore.get(), which can reject (e.g. a Redis blip). That rejection was unhandled, crashing the Node process by default and wiping the in-memory invocations Map — turning every in-flight poll into poll failed: 404 for callers.
  • This is what produced the error in the last comment on Claude Agent is Too Eager #185: Something went wrong processing this: /invoke/d47cd054-9528-4033-8ea5-0471afe2ecd0 poll failed: 404. Note: this fixes that specific crash/404, but does not address Claude Agent is Too Eager #185's actual title/body ("Claude Agent is Too Eager") — that's a separate behavioral issue and stays open.
  • Fix: add a .catch on the outer buildGraphInput(...).then(...) chain that resolves the invocation to status: "failed" instead of leaving the rejection unhandled.

Test plan

  • Added a regression test (server.test.ts) with a sessionStore.get that rejects — confirmed it reproduces an unhandled rejection against the pre-fix code (via git stash) and passes cleanly with the fix.
  • npx vitest run src/server.test.ts — 57/57 passing.
  • Confirmed pre-existing tsc errors in unrelated files (nats-agent-channel.ts) exist independent of this change (stale workspace build ordering).

Related to #185 (does not close it)

🤖 Generated with Claude Code

https://claude.ai/code/session_01NynLp3kMJ5vMdvHDv3opGy

A rejection from buildGraphInput (e.g. sessionStore.get hitting a Redis
blip) was unhandled before the graph.invoke().catch() chain existed to
catch it, crashing the process and wiping the in-memory invocations Map.
That turned every in-flight poll into "poll failed: 404" for callers,
which is what surfaced as the last comment on #185.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NynLp3kMJ5vMdvHDv3opGy
@imaustink
imaustink merged commit c5a45a3 into main Aug 1, 2026
4 checks passed
@imaustink
imaustink deleted the fix/invoke-unhandled-rejection-185 branch August 1, 2026 21:57
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