Repository navigation
Conversation
Subscribing to a backend's list_changed notifications opens a standalone notification stream during session initialization. A backend that accepts the subscribe and then never services it stalls the handshake until the init deadline, and clients with their own connect timeout give up first. The connector already treats a nil sink as "do not subscribe" and the comment there says the stream must stay opt-in because some backends hang on it, but the server supplies a sink for every session, so in production that gate was unreachable. Add operational.listChanged, and a WithListChangedFilter factory option, so a single misbehaving backend can be excluded while the rest keep live propagation. An excluded backend loses only that: its tools are still aggregated and callable, and they refresh on the next session. Default is unchanged. With no config every backend is subscribed exactly as before.
aron-muon
requested review from
ChrisJBurns,
JAORMX,
amirejaz,
blkt,
jerm-dro,
jhrozek,
rdimitrov,
reyortiz3 and
tgrunnagle
as code owners
September 10, 2026 14:19
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6635 +/- ##
=======================================
Coverage 78.94% 78.95%
=======================================
Files 781 781
Lines 77784 77811 +27
=======================================
+ Hits 61410 61439 +29
+ Misses 16369 16367 -2
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
crd-schema-checker's ListsMustHaveSSATags rejects an array with no x-kubernetes-list-type. Matches MCPGroup.Servers, the closest analogue: an unordered list of workload names where duplicates are meaningless.
Merged
5 tasks done
Contributor
Author
|
Folded into #6633. These conflicted with each other - same three source files plus the same generated CRDs - and they're two ends of one bug, so reviewing them together is easier than landing one and rebasing the other. |
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
Background: subscribing to a backend's list_changed notifications opens a standalone notification stream, and that happens inside session
initialize. A backend that accepts the subscribe and then never services it stalls the handshake for the whole init allowance, and clients with their own connect timeout give up first.The gate for this already exists.
createMCPClientonly setsWithContinuousListening()when the sink is non-nil, and the comment there is explicit about why:In practice it isn't opt-in, though -
server.gobuilds a sink for every session, so every backend gets subscribed and that safety valve is unreachable from a running deployment.This PR:
operational.listChanged, withenabledanddisabledWorkloadssession.WithListChangedFilter, a per-backend predicate. When it returns false the factory drops the sink for that backend only, which is what stops the connector opening the streamdisabledWorkloadsfor the common case - one bad backend shouldn't cost the other 14 their live propagationAn excluded backend loses live propagation and nothing else. Its tools are still aggregated and callable, and they refresh on the next session.
This is the follow-up to #6633, which bounds the same stall with a configurable init timeout. That one caps the damage, this one removes the dependency - they're independent and either is useful on its own.
Type of change
Test plan
task test)task lint-fix)go test ./pkg/vmcp/...and the operator unit tests pass.golangci-lint run ./pkg/vmcp/...is clean at 0 issues. Regenerated withtask operator-generate,task operator-manifestsandtask crdref-gen;task genandtask license-checkleave the tree clean.New tests:
TestSessionFactory_ListChangedFilterasserts the connector receives a sink for subscribed backends and nil for excluded ones (that nil is the whole mechanism), plus a case proving a nil-sink caller is unaffected by the filter.TestListChangedFiltercovers the config to predicate mapping includingenabled: falsewinning over an exclusion list.Manual: hit this on 0.47.1 against Grafana Cloud's hosted MCP, which is stateless and mandates per-user auth. Its own audit log shows the handshake succeeding and then the stream sitting there until the client gives up at exactly 30s:
vMCP's own log stops after
creating session-scoped backendsand never reaches theFailed to initialise backendwarning, because the client has already gone.Worth noting why that backend can't dodge this on its own: it's Modern, so
initOneBackendwould skip the connect entirely, but the revision probe runs unauthenticated from the health monitor, gets a 401, andprobeRevisionquite reasonably leaves a 401 uncached as a transient auth blip. So it never classifies, and because no session ever completes, no authenticated call reachesdispatchto warm the cache either.API Compatibility
v1beta1API, OR theapi-break-allowedlabel is applied and the migration guidance is described above.listChangedis a new optional field onOperationalConfig. Nothing is removed or retyped.Does this introduce a user-facing change?
Yes. New optional
operational.listChanged, letting an operator exclude backends from live list_changed propagation. Unset keeps today's behaviour.Special notes for reviewers
I went with config rather than making it automatic on purpose - I couldn't find a signal that reliably separates "will never service this stream" from "is just slow right now", and guessing wrong silently drops propagation. If you'd rather infer it, or put the switch somewhere other than
operational, happy to move it.The deeper fix is presumably for the stream to not gate
initializeat all, but that sits in mcpcompat/go-sdk rather than here, so this is the smallest thing that makes session init independent of it.