Repository navigation
Drop ambiguous prompt names instead of failing aggregation - #6099
Merged
Merged
Conversation
An advertised prompt name with no defined owner — two (backendID, name) pairs composing to the same string — failed the whole aggregation. That error propagated out of ResolveConflicts before the already-computed tools, resources and templates were returned, so one ambiguous prompt name took down tools/list, resources/list, resource-templates/list, prompts/list, Discover's presence flags and backend visibility for the entire group. Errors are never cached, so every request re-swept every backend and failed again while the condition persisted. Reaching it needs no conflict-resolution config, only an unlucky combination of operator-chosen workload names and backend-chosen prompt names. Drop every prompt claiming an ambiguous name instead, logging the name, the colliding backends and their original prompt names at ERROR. Dropping all claimants rather than only the loser (the tool precedent) is what makes this safe: a survivor would inherit the ambiguous name and with it any policy written for the prompt it collided with, since Cedar authorizes on the advertised name alone. Advertised by nobody, every permit and forbid on the name is vacuous and the rest of the group keeps serving. Also scope the header's stability invariant to the (backendID, name) pair it actually holds for, and state the caveat it does not cover: under priority, whoever wins a shared bare name inherits every permit written for it. forbid still fails closed because the priority loser is dropped rather than aliased — record that the drop is deliberate, so the obvious future "improvement" of re-prefixing the loser does not reopen the fail-open. Addresses post-merge review feedback on #6075. Co-Authored-By: Claude Fable 5 <[email protected]>
JAORMX
requested review from
ChrisJBurns,
amirejaz,
jerm-dro,
jhrozek,
rdimitrov and
tgrunnagle
as code owners
July 28, 2026 12:01
jhrozek
approved these changes
Jul 28, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6099 +/- ##
==========================================
+ Coverage 72.37% 72.39% +0.02%
==========================================
Files 731 731
Lines 75739 75753 +14
==========================================
+ Hits 54816 54845 +29
+ Misses 17025 16990 -35
- Partials 3898 3918 +20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Addresses post-merge review feedback on #6075 (discussion_r3665086460), which landed ~12 minutes before that PR merged and was never applied.
ErrUnresolvedConflictsfromresolvePromptConflictspropagated out ofResolveConflictsbefore the already-computed tools, resources and templates were ever returned, so one ambiguous prompt name failed the entire aggregated view:tools/list,resources/list,resource-templates/list,prompts/list,Discover's presence flags, and backend visibility throughauthorizedBackends. Errors are never cached, so while the condition persisted every request re-swept every backend and failed again. And the condition needs no conflict-resolution config to reach — an unlucky combination of operator-chosen workload names and backend-chosen prompt names is enough (backendb1promptx_yand backendb1_xpromptyboth compose tob1_x_y). Now every prompt claiming an ambiguous name is dropped and the collision is logged atERROR; aggregation succeeds and the rest of the group keeps serving.prefix_resolver.go) drops only the loser, which does not work here: the survivor would inherit the ambiguous name and with it any policy written for the prompt it collided with, since Cedar's resource identity isPrompt::"<advertised name>"and nothing else. With the name advertised by nobody, everypermitandforbidon it is vacuous and nothing is reachable under an ambiguous identity.(backendID, name)pair, but not for a shared string: underpriority, apermit(... resource == Prompt::"review")written whileb1owned that name silently begins authorizingb2's different prompt once a higher-rankedb2deploys, with no config edit. The invariant is now scoped to the pair and the permit-redirection caveat is stated explicitly.forbidstill fails closed, because the loser is dropped rather than aliased.Type of change
Test plan
task test)task test-e2e)task lint-fix)task testpasses; the only failures are three pre-existing environment-dependent ones in this sandbox (TestNewServer_ReadTimeoutConfigured,TestSecurityHeaders— both "no available runtime found" — andTestCompositeProvider_RealProviders), all unrelated to this change.task lint-fixreports 0 issues.task docsproduces no diff (no CLI-facing text changed).TestDefaultAggregator_ResolveConflicts_PromptPrefixAmbiguitypinned the hard error; it is replaced byTestDefaultAggregator_PromptAmbiguityDropsEveryClaimant, which runs the fullAggregateCapabilitiespipeline so it can assert the ambiguous name is absent from both the advertised list and the routing table, that surviving prompts still translate back to their backend's own name, and that aggregation returns no error. Three cases: a two-way composition collision, a three-way one, and a prefixed name hitting a priority-listed backend's literal bare name (that last case moved here from..._PromptPriority, which no longer has a competing error assertion).Both mutations the fix must be robust against were checked against the new tests:
RoutingTable.PromptsErrUnresolvedConflictsrequire.NoErrorfails;AggregateCapabilitiespropagates anyResolveConflictserror verbatim (default_aggregator.go:466-469)Changes
pkg/vmcp/aggregator/capability_conflicts.goERRORlog naming the name, the colliding backends and their original prompt names;resolvePromptConflictsloses its error return; header rewritten for the three review pointspkg/vmcp/aggregator/default_aggregator.gopkg/vmcp/aggregator/capability_conflicts_test.godocs/arch/10-virtual-mcp-architecture.mdErrUnresolvedConflictsitself is untouched and still used by the manual tool resolver (manual_resolver.go:166). Tool resolution is unchanged.Does this introduce a user-facing change?
Yes. A vMCP group whose backends produce an ambiguous advertised prompt name previously served nothing at all — every list verb failed until an operator renamed something. It now serves everything except the colliding prompts, which are dropped and reported at
ERROR. No configuration change is needed to pick this up.Special notes for reviewers
On surfacing (the one open item from the review). The reviewer's caveat was that "the hard error is impossible to miss and drop-both isn't... If you take it, surface it somewhere an operator actually sees, not only
slog.Warn." This PR logs atERRORrather thanWARN, and richer surfacing is deliberately deferred — every candidate surface needs new plumbing that would dwarf the fix:/status(pkg/vmcp/server/status.go) is built from the backend registry and the health monitor. The server holds no reference to the aggregation result — the caching aggregator owns it and hands it back per request — so routing dropped-prompt state there means new server-held state plus its invalidation.AggregationMetadataexists but is consumed only for trace-span attributes andDebuglogs; nothing operator-facing reads it. Making it operator-visible is the same plumbing problem one layer down.VirtualMCPServer.Statuswould be the right home, but the operator observes discovered backends, not the running aggregator's per-request conflict outcomes. That is a CRD field plus a controller feedback path.MeterProviderthroughNewDefaultAggregatorand its call sites.Happy to open a follow-up for whichever of these you consider the right long-term surface — my instinct is a counter on
AggregationMetadataexposed through/status— but it wants its own PR and its own design discussion rather than riding along here.On the mixed-listed case. A group where some claimants are priority-listed and some are not is treated as ambiguous and all claimants are dropped, matching the pre-existing resolvability condition (
!winner.listed || !contender.listed). Priority rank only decides when every claimant is listed, i.e. when all claims are literally the same bare name.Generated with Claude Code