Repository navigation
feat(binding-mcp): single session-id contract, negotiated protocol-version, partial-success hydration - #1816
Merged
Conversation
…ed local session-id generation Split from the mcp.proxy commit "prevent stall on local sessionId generation" (71191fd); example edits excluded. Adds EngineContext.isLocalIndex + LongIntPredicate util (EngineWorker impl; EchoWorker/TlsWorker test EngineContext implementers updated) and mints worker-aligned session ids in McpServerFactory. Prerequisite for the single session-id contract. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…rsion, partial-success hydration Fixes the mcp.proxy 400 "No valid session ID" retry-storm where the cache hydrater originated a locally-generated session id on its lifecycle request and the proxy passed it through, so south requests carried an id the remote never issued. Single session-id contract (WS1): - A lifecycle (initialize) request carries NO sessionId; the reply carries the minted id; non-lifecycle requests carry it. One id per stream everywhere; the client's responseSessionId dual is removed in favor of an app-id (Xc) vs transport-id (X) split (transportSessionId()). - Proxy mints a worker-aligned unified id and is the sole minter/mapper; the lifecycle owns its deferred per-route request streams (McpRouteRequest register/settle) and walks them once the route lifecycle settles, hash-routing each south request by its session id. - Server learns U from the app lifecycle reply, maps S<->U, hash-routes request streams by U, and still returns S on the HTTP mcp-session-id header. - Client mints aligned Xc inbound, returns it on the app reply, adopts the remote-minted X from the initialize response and uses X only as the outbound HTTP header. - Cache hydrater sends its lifecycle with no id and adopts the proxy-minted id from the reply. - New engine util LongIntToLongFunction for hash-routed supplyInitialId. Negotiated MCP-Protocol-Version (WS3): - Default 2025-06-18 (was non-standard 2025-11-25); capture result.protocolVersion from the initialize response and send the negotiated version on subsequent request headers. Per-toolkit partial success (WS2): - New hydrate.attempts.max bounds per-kind hydrate retries; on exhaustion the kind is marked degraded so cache readiness no longer requires every kind populated (settled = populated or degraded); a degraded kind serves an empty list envelope instead of aborting. Tests: binding-mcp engine ITs (server/client/proxy/proxy-lifecycle/proxy-cache), McpConfigurationTest, and spec application/network/cache ITs all pass; new lifecycle.initialize.version negotiation scenario and cache.serve.tools.list.degraded partial-success scenario added. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> (cherry picked from commit 8e93670)
This was referenced Jun 2, 2026
Merged
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
The single session-id contract across the mcp server/proxy/client, with negotiated
MCP-Protocol-Version and per-toolkit partial-success hydration. Fixes the mcp.proxy
400 "No valid session ID"retry-storm (the cache hydrater originated a local session idthe remote never issued).
Extracted from the
examples/mcp.proxybranch (#1793); second of three sequentialbinding-mcp extractions (cache refresh #1813 → this → proxy fixes + bootstrap credential).
Fixes #1815.
Commits
feat(engine,binding-mcp): isLocalIndex worker affinity + worker-aligned local session-id generation— a prerequisite split from the example commit "prevent stall onlocal sessionId generation" (example edits excluded). Adds the engine SPI
EngineContext.isLocalIndex+LongIntPredicateutil (EngineWorkerimpl;EchoWorker/TlsWorkertest EngineContext implementers updated per the engine SPIconvention), and mints worker-aligned session ids in
McpServerFactory.feat(binding-mcp): single session-id contract, negotiated protocol-version, partial-success hydration— see below.What commit 2 does
Single session-id contract (WS1): lifecycle (
initialize) requests carry no sessionId;the reply carries the minted id; non-lifecycle requests carry it (one id per stream). The
proxy mints a worker-aligned unified id and is the sole minter/mapper, hash-routing each
south request by its id; the server maps
S↔Uand still returnsSon the HTTPmcp-session-idheader; the client adopts the remote-mintedXfor the outbound HTTPheader; the cache hydrater sends no id and adopts the proxy-minted one. New engine util
LongIntToLongFunctionfor hash-routedsupplyInitialId.Negotiated MCP-Protocol-Version (WS3): default
2025-06-18; captureresult.protocolVersionfrom theinitializeresponse and send the negotiated version onsubsequent request headers.
Per-toolkit partial success (WS2):
hydrate.attempts.maxbounds per-kind retries; onexhaustion the kind is marked degraded (
settled = populated || degraded) and serves anempty list envelope instead of aborting.
Engine SPI note
Adds one method to
EngineContext(isLocalIndex), with all in-tree implementersupdated (
EngineWorker, plus theEchoWorker/TlsWorkertest implementers).Testing
./mvnw verify -pl specs/binding-mcp.spec,runtime/binding-mcp— server/client/proxy/proxy-lifecycle/proxy-cache ITs,
McpConfigurationTest, and spec application/network/cacheITs green, incl. new
lifecycle.initialize.version(negotiation) andcache.serve.tools.list.degraded(partial-success) scenarios. Engine +EchoWorker/TlsWorkercompile with the new SPI; CI runs the full engine suite.🤖 Generated with Claude Code