Repository navigation
fix(kas): carry kiro-cli mcp.json settings onto the KAS agent block - #30712
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ human override accepted@buluoray overrode this lane for |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the agent files that already exist are recorded once and keep their servers, new agent files follow kiro-cli's opt-in rule, and reverting the PR just leaves the recorded list unread. Notes
[DESIGN-REVIEWED] a83dd57 Description read[DESCRIPTION-READ] 4dd782d2604f8fa4677d9951a6213d8ee65df54f0d913a8f912c3241655085fd 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 |
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: |
9c2b798 to
3b46d82
Compare
3b46d82 to
4cd2510
Compare
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
Thanks for this. Bringing KAS in line with kiro-cli is the right direction, and three of the four changes are clear wins: glob disabledTools entries now take effect, servers get kiro-cli's 120 s start budget, and mcp.initTimeout / the .amazonq/mcp.json fallback are honoured.
Requesting changes on one part: undeclared mcp.json servers are now excluded without telling the user.
Today on KAS, an agent with tools: ["*"] and no includeMcpJson starts every mcp.json server. After this change those servers go into excludedTools as @server and never start. That matches kiro-cli, but every KAS user who relies on those servers today loses them on upgrade, and nothing in the session says why. To them it looks like an MCP server silently broke.
Either of these would resolve it:
- Keep the exclusion, and add a one-line session notice that names the servers that were not started and points to where to turn them on (the agent's
includeMcpJson, or declaring the server). It should be a pointer to a UI place, not a command to run. - Split the exclusion into its own PR and land the other three changes now, so they can ship without the behaviour change.
A smaller point to settle while you're here: the PR relies on kiro-cli reading a missing includeMcpJson as false, while Crew's own readers (client_mcp_array.py, auto_approve.py, fork_refresh.py, agent_capabilities.py) assume true. The description says they pin false on every spec they write, so behaviour does not change there. A test that pins the projected default for a spec without the key would keep the two from drifting.
Checks on this head: the targeted tests pass (852 passed, 1 failure that also fails on main on this host), and every new guard turns a named test red when broken.
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]: A correction to option 1 in my review above: please drop the session-notice idea. Users should not have to understand
Either way, nothing a user relies on today should disappear on upgrade. |
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]: Updating my earlier suggestions after looking closer. I am withdrawing the migration option: Crew should not rewrite agent files it did not author. Some facts that change the picture:
Proposed path:
Happy to re-review as soon as the split lands. |
4cd2510 to
7b2f71b
Compare
|
@buluoray Thanks. Addressed on head 7b2f71b (rebased onto main f5340cc), taking your option 1. Undeclared mcp.json servers. The exclusion stays. A new KAS chat now shows one notice line naming each server that was not started, with where to turn it on: Customize → Connections → MCP Servers for an agent Crew manages (Crew re-pins includeMcpJson default. Also from local review: entries merged from a workspace Tests: |
Human judgment recorded@buluoray recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
957890b to
28a066e
Compare
|
span=feca296f3fc0
|
|
/ai-review override first-principles 28a066e owner-decision: maintainer accepts that new KAS agent files without includeMcpJson load only their own servers, as on Kiro CLI; existing files are kept by a one-time list. Decision: #30712 (comment) |
Human judgment recorded@buluoray recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
|
span=0a950f28cea2
|
|
span=657c0b2e43d0
|
|
span=0a950f28cea2
|
|
span=009b44c909b2
|
|
span=445acb740d00
|
|
/ai-review override first-principles f9467e5 owner-decision: maintainer accepts that new KAS agent files without includeMcpJson load only their own servers, matching kiro-cli's own default for an absent flag; existing files are kept by a one-time list. Decision: #30712 (comment) |
Human judgment recorded@buluoray recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
bolichen97
left a comment
There was a problem hiding this comment.
Approving at f9467e5. A kiro-cli agent run on KAS now gets the MCP servers, tool limits and start budget its mcp.json files give it on kiro-cli. includeMcpJson (or its alias useLegacyMcpJson) goes on the KAS agent block, a glob disabledTools entry is carried as @server/<pattern> so KAS applies it, and timeoutMs is read as an alias. Existing agent files that set neither key are recorded once and keep KAS's own behavior, so no running agent loses a server it starts today. No regex or glob matching is added on Crew's side, and all checks pass.
Undeclared mcp.json servers are excluded as @server unless the agent opts in, glob disabledTools on reached file servers travel as @server/<pattern>, an unset per-server timeout gets kiro-cli's 120 s (raised to mcp.initTimeout), useLegacyMcpJson travels as includeMcpJson, and the workspace .amazonq/mcp.json is merged under kiro-cli's fallback rule.
kiro-cli loads the global and workspace mcp.json servers only for an agent that sets includeMcpJson (or useLegacyMcpJson); KAS starts all of them for tools: ["*"]. Each undeclared server now goes into excludedTools as @server unless the agent opts in, judged from the agent block plus the names its spec declares, and the runtime drops the pooled stub of an excluded server before it binds the roster the request, the session report and the unresolved-ref guard all read. Kiro Crew's own and the mandatory servers are kept, and no session notice is shown. Agent files that already exist when the rule first runs, and state neither key, keep KAS's own behaviour: the first KAS session records them once in the data home. The files are never edited, because kiro-cli reads the same directory.
|
/ai-review override first-principles a83dd57 owner-decision: maintainer accepts that new KAS agent files without includeMcpJson load only their own servers, matching kiro-cli's own default for an absent flag; existing files are kept by a one-time list. Decision: #30712 (comment) |
Human judgment recorded@buluoray recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
Problem / Motivation
Goal: A kiro-cli agent run on the KAS backend gets the same MCP servers, tool limits and start budget it gets on kiro-cli.
On KAS today:
tools: ["*"]and noincludeMcpJson: truestarts every server in~/.kiro/settings/mcp.jsonand the workspace.kiro/settings/mcp.json. kiro-cli loads none of them.disabledToolsentry (write_*) on anmcp.jsonserver switches nothing off, because KAS matches those names exactly.timeoutgets 60 s to start, where kiro-cli gives 120 s, so a first-runnpx/uvxserver fails.mcp.initTimeoutand theuseLegacyMcpJsonspelling are ignored.Why it matters
Every kiro-cli user moving to KAS hits at least one of these. The first one runs tools the agent's author never enabled. The second leaves on tools they meant to switch off. The timeout one makes slow servers fail with no clear cause.
Not a goal
chat.defaultModelfromcli.json(a different batch).{a,b}and bracket[...]globs indisabledTools: KAS'sexcludedToolsmatches*and?only, and globs are not expanded by hand here.agent_capabilities.py, the materializers), which still assume an absentincludeMcpJsonistrue. They pinfalseon every spec they write, so no behaviour changes there.What changed (motivation → approach → change)
KAS reads the same
mcp.jsonfiles kiro-cli does but decides from them differently, so the fix re-states kiro-cli's decisions in fields KAS already honours. The new moduleacp/kas_settings_mcp.pyholds all of it.includeMcpJsonand its aliasuseLegacyMcpJsonboth travel asincludeMcpJson. A missing key meansfalse: kiro-cli declares it#[serde(default, alias = "includeMcpJson")] use_legacy_mcp_json: bool, and loadsmcp.jsonservers only behindif use_legacy_mcp_json.mcp.jsonserver that neither its block nor its spec's ownmcpServersnames goes intoexcludedToolsas@server(excluded_whole). The harness stamps the spec's names asdeclaredbefore projection, because a declared server can reach KAS in the session-level array instead of the block. Kiro Crew's own servers and theASBX_KIRO_MANDATORY_MCPSservers are never excluded. No notice is shown.without_excluded_stubsdrops the stub of an excluded server;create_sessionandload_sessioncall it before they bind the one roster the request, the session report and the unresolved-ref guard all read.acp/kas_mcp_json_legacy.pykeeps KAS's own behaviour for agent files that already exist when the rule first runs (see Backwards compatibility).disabledTools. A file server KAS still starts that the agent does not declare, pooled stubs included, has its glob entries carried as@server/<pattern>, which KAS globs.mcp.jsoncannot be read, the global file's servers are still named, so its exclusions stand.timeoutgets 120 000 ms, ormcp.initTimeoutwhen that is longer (capped at KAS's 600 000).timeoutMsis mapped totimeout.Where it runs: the file reads happen in the KAS harness's existing projection thread, beside the session's own directory. The harness stamps the result on the active entry under a new Crew-only key.
attach_kas_custom_agentsapplies the stamp against the finalmcpServersarray and strips the key. The session-new and session-load paths gain one step, the pooled-stub filter above. The session directory reaches the harness through one new optionalsession_cwdargument on the existing_kas_custom_agents/session_extrasseam, which the other harnesses ignore.cli.jsonis read through the same credential-gated reader asmcp.json.Docs:
src/kiro_crew/docs/agent-spec-fields.mdandsrc/kiro_crew/docs/coming-from-kiro-cli.mdstate kiro-cli's real default for a missingincludeMcpJson, the KAS exclusion, and that existing agent files keep their servers.Known limit, in a
shortcut:comment: a server hoisted into the session-level array (every user server on session/load) keeps KAS's 60 s, because KAS's session-level element has notimeoutslot.Backwards compatibility
Existing agent files keep today's behaviour. The first KAS session after this ships, whichever agent it runs, records, once, every agent file in
~/.kiro/agentsthat states neitherincludeMcpJsonnoruseLegacyMcpJson. Those agents keep loading the global and workspacemcp.jsonservers on KAS, as they do today. The list lives in the data home (.migrations/kas_mcp_json_legacy_agents.json). It is never rebuilt, and the agent files are never edited, because Kiro CLI reads the same directory and an added key would change what Kiro CLI loads.mcp.jsonserver (unchanged)includeMcpJson: falseincludeMcpJson: trueincludeMcpJson: falsekirocrewagent, every BotmcpServersBreaking, for the third and fourth rows only. The release note: "On the default harness, a new agent file that does not set
includeMcpJson: trueloads only the MCP servers it lists, as on Kiro CLI. Agent files you already have keep loading yourmcp.jsonservers."The list keys an entry by the file's name and its declared
name, not by inode or creation time. An editor that saves by writing a new file and renaming it gives the file a new inode on every save, so an identity key would drop a file its user only edited. The cost: a file deleted and recreated under the same name stays on the list. A listed file that later states either key follows that key, so an explicitfalseturns the servers off. An unreadable or invalid agent file is skipped when the list is recorded. A directory that cannot be listed records nothing, so a later session tries again. An unreadable or malformed list keeps nobody and is not rebuilt. Project.kiro/agentsfiles are not listed, and a checkout's spec is never kept by a listed name: KAS never honoursincludeMcpJsonfrom a checkout's spec (PROJECT_SPEC_HONOURED_KEYS).The Kiro CLI wire is unchanged (the wire-parity goldens pass). Writer sweep on main: every agent spec Kiro Crew writes pins
includeMcpJson: false(agent.py,agent_materialization/service_agents.py,agent_materialization/auto_approve.py) and carries its servers in its own block.Reader: src/kiro_crew/acp/kas_settings_mcp.py:finish_settings_mcp -- entry: chat|cron|subagent -- adds
@serveronly for names absent from the block and the spec's declared servers, never for an opted-in or listed agent; test_undeclared_servers_are_excluded_whole, test_spec_declared_and_crew_and_mandatory_names_are_kept, test_a_legacy_agent_keeps_them_and_its_pooled_stubsReader: src/kiro_crew/acp/runtime_session_create.py:create_session -- entry: chat|cron|subagent -- removes only session-level entries named in excluded_whole, before the roster is bound; test_an_excluded_mcp_json_stub_never_reaches_the_wire[new]
Reader: src/kiro_crew/acp/runtime_session_load.py:load_session -- entry: chat|cron|subagent -- the same on resume; test_an_excluded_mcp_json_stub_never_reaches_the_wire[load]
Tests
test/test_kas_settings_mcp.py(new): the alias; undeclared servers excluded whole with the flag absent or false; spec-declared, Kiro Crew and mandatory servers kept; a pooled stub is not a declaration and is dropped, but keeps its workspace globdisabledTools; an unreadable workspace file keeps the global exclusions; an opted-in or listed agent keeps them and gets their globdisabledTools; workspace-over-global precedence; timeout default / alias /mcp.initTimeoutfloor and cap; the envelope applying and stripping the stamp.test/test_kas_mcp_json_legacy.py(new): a file without the key is listed by file name and declared name; a file stating either key is not; a listed file that later states the key follows it; a session on an opted-out agent still records the list; the list is recorded once and a later file is not listed; a bad agent file is skipped; a directory that cannot be listed records nothing; a malformed list keeps nobody and is not rebuilt.test/test_acp_runtime.py::test_an_excluded_mcp_json_stub_never_reaches_the_wire[new|load]: the excluded stub is not in the request.declaredignored; the stub filter removed on create or load, or dropping nothing; the harness not passingdeclaredor the legacy flag; the list ignoring the key at record time or in the current spec, recorded only after the opt-in check, an unreadable workspace file emptying every exclusion, session-array names counted as declared for globs, reading a failed listing as empty, keeping a checkout's spec, rebuilt every session, failing on bad JSON, rebuilt when malformed, or dropping declared names.test/test_kas_withheld_credentials_notice.py::test_mcp_json_servers_the_spec_does_not_list_add_no_notice: the session notice names nomcp.jsonserver.test/test_kas_settings_mcp.py::TestIncludeMcpJsonDefault: pins that a spec withoutincludeMcpJsondoes not forward it and is read as not opted in, and that Crew's spec writer pinsfalse.test/test_acp_harness_contract.py: the harness reads the session's directory, not the runtime's; stamps the spec's declared server names; lists a spec without the key, not one that states it, and not a checkout's spec of a listed name.test_acp_runtime.py,test_acp_runtime_load_session.py,test_acp_harness_wire_parity.py,test_kas_agents_mcp_servers.py,test_kas_env_launch_resume.py,test_worker_agent_load_bracket.py: doubles and expectations updated for the new argument and the stamp.test_runtime_bindings.py: the pinned_kas_custom_agentssignature digest is updated forsession_cwd.Proof: not provable -- other: a changed test file (test_acp_harness_contract.py) has a copilot test that is red on this host before and after the change, so prove.py reports BASELINE_RED; test_kas_settings_mcp.py imports the new module and fails without it.
Manual verification
N/A — unit coverage; the KAS field behaviour cited above was read from the KAS source at
041fe9ba, not exercised against a live engine.Related Issues
Fixes #30625
#31533 (the exclusion and the existing-file list) was merged into this branch, so this PR carries both parts and is reviewed as one.
Sibling sweep
Swept: git grep -nE "includeMcpJson|disabledTools|timeout" -- src/kiro_crew/acp/
Sibling: src/kiro_crew/acp/kas_tool_limits.py -- not affected -- already carries agent-declared servers' disabledTools (#29495); this PR covers the mcp.json-file servers
Sibling: src/kiro_crew/mcp_gateway/rewriter_spec.py -- not affected -- builds the pooled stubs for kiro-cli too, which reads includeMcpJson itself; the KAS runtime drops the excluded ones
Sibling: src/kiro_crew/agent_capabilities.py -- not affected -- reads the flag for capability reporting on specs Crew pins false; listed under Not a goal
Pattern harvest
Not generalizable: each gap is a specific kiro-cli setting KAS reads differently; the shared fix is the adapter module itself.
Checklist