fix(binding-mcp): settle a still-establishing toolkit client on reset/abort - #2427
Merged
Conversation
…/abort An mcp(client)-backed session's south connections toward each routed toolkit are established eagerly and in parallel; the north-facing session's own accept is deferred until every one of them settles (either by opening successfully or by being told to settle explicitly). McpLifecycleClient's onClientAbort/onClientReset only told the session to settle when hydration was in progress AND this client had never opened -- any other combination propagated the abort/reset to the session. That condition had no else branch, so exactly that one case did neither: a hydration session's still-establishing toolkit resetting or aborting left the session waiting on a settlement that would now never arrive, wedging the whole hydration attempt indefinitely. Both handlers now call settleLifecycle for that case instead of doing nothing, letting the session proceed without that toolkit; the existing per-kind retry/backoff already re-attempts it once the session is no longer blocked. A caller's own (non-hydration) session and an already-established toolkit's later failure keep propagating exactly as before. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W7N8Z9vABdU8pVPGthRodY
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.
Description
An
mcp(client)-backed session's south connections toward each routed toolkit are established eagerly and in parallel; the north-facing session's own accept is deferred until every one of them settles (either by opening successfully or by being told to settle explicitly).McpLifecycleClient'sonClientAbort/onClientResetonly told the session to settle when hydration was in progress and this client had never opened -- any other combination propagated the abort/reset to the session. That condition had noelsebranch, so exactly that one case did neither: a hydration session's still-establishing toolkit resetting or aborting left the session waiting on a settlement that would now never arrive, wedging the whole hydration attempt indefinitely.Both handlers now call
settleLifecyclefor that case instead of doing nothing, letting the session proceed without that toolkit; the existing per-kind retry/backoff already re-attempts it once the session is no longer blocked. A caller's own (non-hydration) session and an already-established toolkit's later failure keep propagating exactly as before.Validated end-to-end against a two-node cluster with a hydration-backed cache: reproduced the wedge (a node became unresponsive to every new session once a toolkit reset mid-establishment), confirmed the fix resolves it (hydration completes and the node stays responsive across repeated fresh restarts), and confirmed
initializeresponses and per-kind cache recovery are unaffected for every other case../mvnw -pl runtime/binding-mcp -am testpasses (178 tests, 0 failures/errors).Fixes # (issue)
Generated by Claude Code