fix: unhandled rejection in /invoke fire-and-forget path - #190
Merged
Conversation
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
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
InvokeServer's/invokehandler stores invocation state in an in-processMap, and the fire-and-forget chain only caught rejections fromgraph.invoke(), not frombuildGraphInput()itself.buildGraphInputawaitssessionStore.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 intopoll failed: 404for callers.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..catchon the outerbuildGraphInput(...).then(...)chain that resolves the invocation tostatus: "failed"instead of leaving the rejection unhandled.Test plan
server.test.ts) with asessionStore.getthat rejects — confirmed it reproduces an unhandled rejection against the pre-fix code (viagit stash) and passes cleanly with the fix.npx vitest run src/server.test.ts— 57/57 passing.tscerrors 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