Repository navigation
fix(kas): say which MCP servers start without their env on KAS - #26786
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the projection already decides what to withhold, so recording that decision there and showing it as a notice row fixes the silent failure where it starts. Notes
[DESIGN-REVIEWED] 80d520c Description read[DESCRIPTION-READ] d65873fb9a426251b3bd09ab600f5e39d790d6611ea7b469d9e96867fbe55445 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 Nothing blocks. Each item has a reported defect behind it, and the existing INFO log line is the only other place this shows up. What this change shipsInventory (7 items) — 7 justifiedIntent: a user on KAS whose MCP server starts without part of its declared env or headers learns which server, which keys, and the route that fixes it. FIX.
[FIRST-PRINCIPLES-REVIEWED] 80d520c Description read[DESCRIPTION-READ] 6b602366085309077d6b745ff121534a575b466b3ef66d86876a00740368511e That sha256 names the PR description this verdict read. 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 findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
857a326 to
b20f18b
Compare
AI review disposition
|
b20f18b to
86c1439
Compare
AI review disposition
|
AI review disposition
|
86c1439 to
e528431
Compare
Sensitive change review
|
Sensitive Change ReviewSensitive files changed:
|
e528431 to
954e895
Compare
Sensitive change review
|
954e895 to
b0c64df
Compare
Sensitive change review
|
|
Notes moved out of two AI review disposition comments, so each disposition record covers exactly one finding. Neither note is an AI-lane finding.
|
b0c64df to
8369e6f
Compare
Sensitive change review
|
8369e6f to
4befe37
Compare
Sensitive change review
|
A KAS session receives the agent's MCP servers over the ACP connection, so the projection withholds every env value it cannot prove is not a credential, and every headers block. The server still starts, so a credentialed server the gateway left unwrapped started without its settings and failed with only an INFO log line as a trace. The projection now records, per declared server, the env key names and fields it withheld (names only). The KAS harness turns that into a session-start notice, and a new chat shows it in the same row as the other upgrade notices, with the two ways to start the server with its full config.
4befe37 to
80d520c
Compare
Sensitive change review
|
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 80d520c.
What I checked:
- Read every non-test hunk (19 files). The projection now records, per server Crew did not author, the env key names and fields it withheld, and the KAS harness turns that into one notice row on a new chat. The notice passes key and server names through
_loggable_key_names, so a credential-shaped name is counted, not printed, and no value is read. - The wire payload is unchanged:
withheld_outis only an out parameter, andtest_the_wire_is_unchangedpins the projection with and without the collector. - The launcher path is handled: when
relay_withheld_envlaunched the server, keys inwithheld_env(...)are dropped from the notice, so it names only what is still missing. The headers bridge clearsheadersthe same way. kas_env_literals.pyis a verbatim move of_relayable_literal,_loggable_key_namesand their helpers out ofkas_agents.py; no matching rule was added or widened. Thesecurity_posture.pyentry moves with the code.- No change to approvals, permissions or what crosses the wire.
Gates at this head: 95 checks ok, 0 red, 0 pending; readiness passed; mergeable; no open change requests. Design, First Principles, Opus and GPT lanes pass; UX skipped (no user-facing surface).
Non-blocking note: when the launcher snapshot cannot be written, the server refuses to start rather than starting without its env, so the notice wording "start without the settings" is slightly loose for that case. Fine to leave as is.
Problem / Motivation
Goal: A KAS session tells the user which MCP servers start without part of their declared
envorheaders, by server and key name, and how to start them with their full config.On the default KAS backend, the agent's MCP servers travel over the ACP connection (
_meta.kiro.customAgents), sokas_agents._project_mcp_serverswithholds everyenvvalue it cannot prove is not a credential, and everyheadersblock. The gateway rewriter leaves a credentialed server unwrapped when a shared backend would withhold its env, expecting the session to apply it. On KAS the session does not, so the server starts with none of its settings. The reporter'sgitlab-mcpstarted against the default GitLab host, got 401 on every call, and exposed a tool itsGITLAB_DENIED_TOOLS_REGEXshould have hidden. The only trace was an INFO log line.Why it matters
KAS is the default backend, so anyone with a credentialed or settings-driven MCP server sees it fail with no visible cause. Two working routes exist (the
kirobackend, or asecret://value routed through the gateway, which #24918 made reachable from MCP Management), but nothing tells the user to take one.Not a goal
session/newframe, its recordings and logs). fix(kas): start env-bearing MCP servers through a local launcher #26785 (now on main) carries a stdio server's withheld env through a Crew-owned local launcher when the session has a key. This PR does not change that; the notice names only what is still missing after it: env the launcher did not start the server with (no session key, or a value with no process-env spelling), and a remote server'sheaderswhen the local header bridge (fix(kas): relay a remote MCP server's headers through a local bridge #28615, now on main) does not carry them (no session key, or ansseentry). The notice is recorded after both launcher steps.What changed (motivation → approach → change)
Symptom: a server that needs a withheld setting fails on KAS with no visible cause. Cause: the projection's withhold was logged at INFO and nowhere else. Fix: the projection records what it withheld, and the new chat shows it.
acp/kas_agents.py)_project_mcp_servers,to_client_custom_agentandbuild_kas_custom_agentstake an optionalwithheld_out. For each declared server Crew did not author that lost something, it records(withheld env key names, fields, stdio). Names only, never a value. Crew's own servers and gateway-stubbed servers are not recorded (a stubbed server gets its env through the gateway). It records after the local launcher step from #26785: a key the launcher started the server with is dropped from the record, and a server the launcher fully covered is not recorded at all, so the notice never claims a server lost env it actually has.acp/kas_withheld_notice.py, new)withheld_credentials_noticenames each server and its key names through the existing_loggable_key_names, so a credential-shaped name is counted, not printed. For a local (command) server that lost env, it gives the route that keeps the values off the wire: asecret://value with the server routed through the gateway in Developer → MCP Management. For a remote (url) server the header bridge does not carry, such as ansseone, it says plainly that the gateway cannot route it either and nothing on Crew's side supplies its headers (the gateway launches only stdio servers, andsecret://resolves only in a stdio server's env). The collector records whether each server is stdio for that split. It does not suggestagent.acp_backend kiro: a storedkiropick loads as KAS once kiro-cli serves its v3 engine (kiro_cli_pick_backend). A new module becausekas_agents.pyis at the 2,000-line cap.KasHarness.session_extrasbuilds the notice from the same projection it sends, into the newSessionExtras.withheld_credentials_notice.create_sessioncopies it onto the handle (kas_withheld_credentials_notice), threaded likerequest_identityso the late-adoption path carries it too.AcpSessionProvider(acp/session_provider.py) andAcpProvider(providers/acp.py) expose it likekas_agent_prompt_notice.dashboard/chat_turn/turn_spec_hooks.py)_notice_steer_upgradeshows it as one notice row on a new session, the same row the steer and prompt-floor notices use, through the display redactor.docs/agent-spec-fields.md)sseentry) has none.acp/kas_env_literals.py, new)kas_agents.pywould be 2,014 lines. The env-literal helpers (_relayable_literal,_credential_shaped_env_key,_loggable_key_namesand their patterns) move unchanged intokas_env_literals.py;kas_agents.pyimports the two it calls and is 1,945 lines.security_posture.py's redactor allowlist entry moves fromacp/kas_agents.pyto the new file (the scan follows theredact_external_textcall), anddocs/system-specs/modules/acp-client.mdnames the new module.test_runtime_bindings.pysignature digests for_collect_late_startand_finish_create_session, which gainwithheld_notice.The fifth item in the issue (tell the operator a
stub_serversentry is unapproved) is already surfaced on main./api/mcp-gateway/statusreportslaunch_refusedwith reasonadded_outside_dashboard, MCP Management renders it ("Declared in a config file, and never approved here."), andkirocrew doctorreports "not approved yet". The issue's loop step 2, where the row readdirect (env)and offered no approval, was fixed by #24918.Backwards compatibility
Compatible: the new parameters and fields are optional with empty defaults, and the projection sends exactly what it sent before.
Removes nothing: the diff only adds a parameter, a dataclass field, a handle field, two properties and a notice row.
Tests
test/test_kas_withheld_credentials_notice.py(new):TestTheProjectionRecordsWhatItWithheld: the reported server's withheld keys are recorded by name. The relayed boolean and a variable set only in the gateway's environment are not.headersis recorded. A server that lost nothing, Crew's own server and a stubbed server are not recorded. A stdio server the local launcher starts with its env (projection with a session key) is not recorded; this test fails with the record taken before the launcher step. A streamable-HTTP server the header bridge carries (projection with a session key) is not recorded, and fails when the bridge step's result is ignored; ansseserver, which the bridge does not carry, still is. The projection with a collector equals the one without, and neither carries the undeclared variable.build_kas_custom_agentspasses the collector through.TestTheNotice: names the server, keys and the gateway route, and does not suggestacp_backend. A remote server is not offered the gateway route and is told nothing supplies its headers; a stdio server alone gets only the gateway route. No value and no undeclared variable reaches it. A credential-shaped key or server name is counted, not printed. A malformed env is named whole. An env key literally namedheadersreads as an env key.test_the_session_payload_carries_the_notice/..._withholds_nothing_has_no_notice: the realKasHarness.session_extrasover a spec on disk.AcpProvider.withheld_credentials_noticeand renders as onenoticerow in a new dashboard chat; empty or non-string renders none. Other surfaces (CLI, Slack, Discord) keep the INFO log line only.test/test_acp_runtime.py::test_create_session_records_the_withheld_credentials_notice: the realcreate_sessionwire path puts the notice on the handle.test/test_acp_bindings.py: inventory row for the newAcpProviderproperty. Test doubles ofbuild_kas_custom_agentsintest_kas_agents_mcp_servers.pyandtest_member_dispatch_mount.pyaccept the new keyword.Proof: not provable -- other: prove.py was not run on this host; reverted by hand instead (below)
Manual revert-and-retest: with only the
withheld_out[name] = ...line in_project_mcp_serversreverted, 8 tests intest_kas_withheld_credentials_notice.pyfail (every projection, session-payload and value-absence test). With only the handle assignment in_finish_create_sessionreverted,test_create_session_records_the_withheld_credentials_noticefails. Locally run green at-n 2: the new file,test_acp_runtime.py,test_kas_agent_prompt_floor.py,test_acp_bindings.py,test_kas_agents_mcp_env_relay.py,test_kas_agents_mcp_servers.py,test_acp_harness_contract.py,test_kas_agents.py,test_acp_harness_wire_parity.py,test_member_dispatch_mount.py,test_worker_agent_spawn_gate.py,test_agent_spec_fields_doc.py,test_security_posture.py(1,100+ tests). The full suite was not run locally. After the rebase onto #26785: the new file,test_kas_agents_mcp_servers.py,test_acp_bindings.py,test_acp_runtime.py,test_member_dispatch_mount.py,test_runtime_bindings.py,test_kas_env_launch.pyandtest_kas_env_launch_resume.pypass at-n 2(931 tests).Manual verification
Not run against a live KAS session on this host. The tests drive the real harness projection over a spec on disk and the real
create_sessionwire path, and render the row through the same function a new chat calls.Related Issues
Closes #24555
Sibling sweep
Swept: git grep -n "_withhold_credential_fields(" -- src/
Sibling: src/kiro_crew/acp/kas_agents.py -- changed here
Pattern harvest
Rule candidate: review-prompt
Pattern: a safety filter that strips part of a user's configuration and reports it only in a debug or INFO log, so the user sees a failure with no cause.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.