Repository navigation
Conversation
Clients sharing a response cache store must each see their own server's listing, a private entry must not reach another client on the default partition, and a reconnect to another server must not serve the previous server's listing. Clients that declare the same partition still share entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every client filed cached results under the same empty partition, so a store shared by two clients served one server's listing to the other, a private entry crossed authorization contexts, and a reconnect served the previous server's entries. An empty partition now gets a fresh random value at each connect, confining entries to that connection. A non-empty partition is the caller naming one server and one authorization context, shared by every client configured with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On CI, a second session on one Server instance hung at connect until the server/discover probe timed out, in both re-runs, while the tests using one instance per client passed. The client cannot tell one instance with two sessions from two instances with the same identity, so each client now gets its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devcrocod
approved these changes
Nov 20, 2026
devcrocod
left a comment
Contributor
There was a problem hiding this comment.
lgtm
look at comment about kdoc
| * @throws IllegalStateException If the server's protocol version is not supported. | ||
| */ | ||
| @OptIn(ExperimentalMcpApi::class) | ||
| @OptIn(ExperimentalMcpApi::class, ExperimentalUuidApi::class) |
Contributor
There was a problem hiding this comment.
check experimental UUID in kotlin 2.3
| * [CacheScope.Private] alike. Clients configured with the same partition share entries, so it | ||
| * must name both the server and the authorization context, such as the server URL and the | ||
| * access token's subject. Empty, the default, confines entries to the current connection: | ||
| * neither another client nor this one after a reconnect is served them. |
Contributor
There was a problem hiding this comment.
I think Kdoc should be shortly
because it's not readable and I don't undestantand how to use this parameter
This branch has not been deployed
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.
Why
Follow-up to #985. Goal: a cached result is served only to the server connection and authorization context that fetched it. The spec says "Caches MUST NOT be shared across authorization contexts". Every client filed entries under the same empty partition, and the key carried no server identity. So a store shared by two clients served one server's
tools/listto the other, a private entry reached another client, and a reconnect to a different server served the old server's listing. This resolves the two review comments onResponseCache.kt:41(r4588386105, r4588386174).What changed
ClientOptions.cachePartition, the default, now gets a fresh random value at eachconnect. Entries are confined to that connection: no other client sharing the store is served them, and neither is this client after a reconnect.cachePartition,CacheKey.partitionandInMemoryResponseCacheStorenow says this. The old text claimed the empty partition already meant "this client instance".Scope
CacheKey, the store interface and the public API are unchanged, so the ABI dump is unchanged. Client-side only.Tradeoffs
serverInfo. The server controls that value, so on a shared store one server could write into another server's namespace. Sharing across connections takes an explicit partition.InMemoryResponseCacheStorewas already unbounded.Blast Radius
Clients that set
responseCache. Default-partition clients that share one store lose cross-client hits, which were the leak. Explicit partitions behave as before.Verification
Serverinstance with the same identity. Two sessions on one instance kept hanging at connect on CI. The client can't tell the two setups apart, and the private-entry test still fails without the fix.ResponseCacheTestfailed before the fix:clients sharing a store each get their own server's listing(expected:<bravo> but was:<alpha>),a private entry is not served to another client sharing the store(expected:<bob-private> but was:<alice-private>),a reconnect to another server does not serve the previous server's listing(expected:<second> but was:<first>). All pass after it.clients configured with the same partition share entriespasses on both and guards against over-isolation.:kotlin-sdk-client:jvmTest,:integration-test:jvmTest,ktlintCheck detekt checkKotlinAbigreen.connectin a base test waits the full 60s request timeout, and it does so across the stateless fix branches.🤖 Generated with Claude Code