Repository navigation
fix(mcp-gateway): show a vault-secret server as routable - #24918
Conversation
Design Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)Design-level review of Design-Verdict: PASS cannot evaluate: missing a screenshot of the MCP Management row for a vault-secret server with sharing on. The description's image did not download, and this revision commits no image. BlockersMissing rendered evidence for the changed MCP Management row state and Details reason [DESIGN-REVIEWED] f2fa5f9 Description read[DESCRIPTION-READ] b826eeb156f936e3e109c65ab0be3f24252078b9d47183361feab7095f1e4b02 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Each item fixes the row and eligibility check where they disagreed with the rewriter's vault-secret exception, using the rewriter's own two predicates. Nothing blocks. What this change shipsInventory (6 items) — 6 justifiedIntent: let a user with sharing on see that a
[FIRST-PRINCIPLES-REVIEWED] f2fa5f9 Description read[DESCRIPTION-READ] 9f638a4987ad2e87c9c0cbeb095cc2bb696be6bf19bd375f2a27616de1053266 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing a screenshot of the vault-secret row's new state chip and its Details reason. The description's image was removed and none is committed, so the blind read did not run. Evidence gaps
Notes
[UX-REVIEWED] f2fa5f9 Description read[DESCRIPTION-READ] 5f6aff6dc867558d4590c23f5467cad505978df6f60c20c200fa41de3344c1ba That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/dashboard/handlers/mcp_gateway_routes.py:524 -- Include settings-injected declarations before marking a server private
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 is a LOW harm finding: a status label on the dashboard is wrong. Nothing about governance, credentials or data is affected. Conditions I checked: False positive or not applicable? A repository writer can comment: |
1dcf5d6 to
7ab8a8f
Compare
|
self-added: yes
|
7ab8a8f to
20bd750
Compare
The MCP Management rows and the stub eligibility check counted every declared env key a shared backend would withhold and reported the server as `direct (env)`. The rewriter makes one exception: a declaration whose env names a vault secret gets a connection-private backend the gateway starts. The row now asks the rewriter's own two predicates per declaration, reports that case as `private_backend`, and the page shows it as `stub` rather than `direct (env)` or `shared`. The eligibility check no longer skips it. Part of #24555
20bd750 to
f2fa5f9
Compare
AI review disposition: Opus 5.5 on 20bd750BLOCKING, A row with Test: Local checks on the new head: vitest 153 passed across 7 MCP Management test files, |
bolichen97
left a comment
There was a problem hiding this comment.
This PR makes the MCP Management row and the batch stub check follow the rewriter's vault-secret exception. A server whose env names a secret:// value, with sharing on and forwarding off, now reports private_backend instead of pooling_blocked_by_env, so it is no longer shown as direct (env) and can be stubbed. It is scoped as part of #24555, and that issue's KAS env relay and warnings stay open by design.
Verified: _env_pooling_outcome calls the rewriter's own _withheld_env_count and _needs_private_backend (rewriter_env.py) per declaration, which matches the withheld and not private branch in rewriter_spec.py. Only key names reach the payload, and the test asserts the secret value is absent. The new backend tests fail without the fix (the vault row was blocked before). The mixed and env-less cases match the rewriter.
Duplicate check: no other open or merged PR covers this. Main has no private_backend handling. #19661 is merged and this PR is rebased on it. Mergeable on main.
Findings: 0 blocking, 1 suggestion. The settings-injected declaration case was already raised by GPT and downgraded, so it is not repeated here.
Good: the decider's predicates are reused instead of re-derived, and the description's sibling sweep is concrete.
AI-assisted review (Kiro), posted for bolichen.
| allowed = verdict.recommend_share if sharing_on else verdict.recommend_stub | ||
| # A server every declaration of which gets a connection-private backend | ||
| # has no co-tenants even with sharing on, so the stub bar applies to it. | ||
| allowed = verdict.recommend_share if sharing_on and not private else verdict.recommend_stub |
There was a problem hiding this comment.
🟡 suggestion: Once a vault-secret server passes here on recommend_stub, will turning page-wide sharing on also add it to stub_servers through autoShareCandidates (mcpManagementModel.ts)? That helper offers every row whose pooling_blocked_by_env !== true, and its docstring says it picks only servers that can share. A private-backend server does not share. Moving it onto the gateway is probably the right outcome, since the session cannot resolve secret:// anyway. If that is intended, could the PR description and the autoShareCandidates docstring say so? If it is not, the filter could also skip private_backend === true. Rule: reviewer preference (the description should match the diff's behavior).
Problem / Motivation
Goal: In MCP Management, a server whose
envnames a vault secret (secret://) reads as routable, and its STUB toggle offers the launch for approval, instead of readingdirect (env).With sharing on and
mcp_gateway.forward_declared_envoff, every env-declaring server row reportedpooling_blocked_by_env, so the page showed it asdirect (env)("Not stubbed, but your opt-in stays saved"). The rewriter does not treat that case as direct:_needs_private_backendgives a server whose env names a vault secret a connection-private backend the gateway starts. The row and the stub eligibility check did not apply that exception, so the documentedsecret://route (docs/guides/secrets-env.md) looked unavailable.Why it matters
A user on the default KAS backend whose credentialed stdio server is left unwrapped gets no
envon the wire. Thesecret://route through the gateway is the supported way out, and the page told them it would not work.Not a goal
_project_mcp_serversstill withholdsenv).stub_serversentry. Both are listed in KAS sessions start credentialed MCP servers with noenvwhen the gateway leaves them unwrapped #24555 and stay open there.What changed (motivation → approach → change)
Symptom: a
secret://server with routing on readdirect (env). Cause: the row checked only "would a shared backend withhold env", not the rewriter's vault-secret exception. Fix: the row asks the rewriter's two predicates (_withheld_env_count,_needs_private_backend) for each declaration and reports the newprivate_backendflag.mcp_gateway_routes.py)_collect_server_rowsrecords, per declaration, the env key names and which keys hold asecret://value (names only, never values). The new_env_pooling_outcomereturns(blocked, private).privateneeds every declaration to be private, so an env-less declaration elsewhere keeps the row shared. A name declared both ways stays blocked, because the rewriter leaves the plain declaration unwrapped.mcp_gateway_stubs.py)_stub_eligibilityskips forpooling_blocked_by_envonly when a declaration is actually left unwrapped. A server whose every declaration gets a private backend has no co-tenants, so with sharing on it is judged onrecommend_stub, notrecommend_share.mcpManagementModel.ts,website/src/api/client/mcp.ts)private_backend. A stubbed row with it takes thestubstate (label keystate_stub), notshared: its backend is its own. Its Details reason is the newwhy_private_backend(added towebsite/src/i18n/locales/en.manual.json, every translated catalog and the regenerateden-XA.json), notwhy_stub_off, which says sharing still has to be turned on.Backwards compatibility
Compatible:
private_backendis a new optional field, and an older gateway that does not send it renders as before.pooling_blocked_by_envonly changes from true to false for vault-secret declarations.Removes nothing: the change adds a field and narrows one false positive. No key, row or route goes away.
Tests
TestGatewayServers::test_a_vault_reference_gets_a_private_backend_not_direct_env: a vault-secret row is not blocked and isprivate_backend. A plain-env row stays blocked. A name declared both ways stays blocked. A name declared once with a vault secret and once with no env is shared, not private. The secret value never appears in the payload. With sharing off, neither flag is set.TestStubEligibility::test_a_vault_reference_is_not_skipped_for_its_env: with sharing on and a verdict ofstub=True, share=False, the eligibility check accepts a vault-secret server.TestStubEligibility::test_a_shared_declaration_keeps_the_share_bar: the same server also declared with no env pools, so it still needsrecommend_share.McpManagement.test.tsx›reads a private backend as stub, not shared, with sharing on: the row shows thestate_stublabel and nostate_sharedlabel.McpManagement.oneStep.test.tsx›says in Details why a server on a backend of its own while sharing is on is in its state: Details showswhy_private_backend. Fails with thedetailsWhyKeyhunk reverted.Proof: PROVEN test/test_handlers_mcp_coverage_gateway_servers.py::TestGatewayServers::test_a_vault_reference_gets_a_private_backend_not_direct_env, test/test_handlers_mcp_coverage_gateway_servers.py::TestStubEligibility::test_a_vault_reference_is_not_skipped_for_its_env, test/test_handlers_mcp_coverage_gateway_servers.py::TestStubEligibility::test_a_shared_declaration_keeps_the_share_bar (head f2fa5f9)
Determinism: the new tests ran 20/20 at
-n0and 10/10 at-n 2 --dist loadgroup --max-worker-restart=2withtest_mcp_shareability.pyandtest_mcp_handler_facade.pyas co-tenants. The whole file ran green (64 passed) in a shuffled order, seed 24918. The frontend test fails with themcpManagementModel.tshunk reverted.Manual verification
Rendered the built SPA against a stubbed API with sharing on (screenshot below). The vault-secret row reads
stub. The plain-env row still readsdirect (env), and a plain stubbed row still readsshared. A live gateway was not run. The screenshot predates the rebase onto #19661, which relabels the Englishstate_stubandstate_direct_envchips todirect; the states themselves are unchanged.Screenshots / video
Related Issues
Part of #24555
Sibling sweep
Swept: git grep -n "_withheld_env_count(" -- src/ website/src/
Sibling: src/kiro_crew/dashboard/handlers/mcp_gateway_routes.py -- changed here
Sibling: src/kiro_crew/dashboard/handlers/mcp_gateway_stubs.py -- changed here
Sibling: src/kiro_crew/mcp_gateway/rewriter_spec.py -- not affected -- already pairs the count with _needs_private_backend
Pattern harvest
Rule candidate: review-prompt
Pattern: a display or eligibility check that re-derives a decision from one of the decider's predicates, and misses the exception the decider applies on top of it.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)