Repository navigation
fix(kas): backport the KAS mcp.json parity fix to 0.12.1 (batch 38) - #32492
Conversation
…30712) * fix(kas): carry kiro-cli mcp.json settings onto the KAS agent block 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. * fix(kas): load only declared mcp.json servers; keep existing agent files 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. --------- (cherry picked from commit 6f786d9) Backport to 0.12.1: release has no kas_cloud.py (Kiro Cloud Sessions from PR 25347 are not on release), so its one-line session_cwd parameter is dropped. In harness/kas.py and kas_agents.py only this change's own lines are added: the with_switched_off_tools import and call and the _skill_scope_summary import in the conflict context come from other main commits that are not on release and are left out. Every other file applied unchanged. Original authors: Joe Guo and Ray Xu (#30712).
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Faithful single-commit backport of a merged Notes
[DESIGN-REVIEWED] 5f7a949 Description read[DESCRIPTION-READ] 1ecc2be694f00e3716dddffa1415de3037c2219faa781e8e3cb29f0d09c53236 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 This backports #30712, already on Notes
What this change shipsInventory (8 items) — 6 justifiedIntent: KAS users get the same
[FIRST-PRINCIPLES-REVIEWED] 5f7a949 Description read[DESCRIPTION-READ] ba6ce2c0efb99d13b2a34dcdbb7fad332af37ef16e9a5196c29c0e379f603e99 That sha256 names the PR description this verdict read. Recompute it with |
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/acp/kas_mcp_json_legacy.py:120 -- Concurrent first sessions overwrite the one-time legacy snapshot
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 is LOW harm. It needs three things at once: two KAS sessions both running their first-ever projection concurrently, both reading an absent list ( False positive or not applicable? A repository writer can comment: |
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: |
|
span=bae5432b6c24
|
Problem / Motivation
Goal: Bring #30712, the KAS
mcp.jsonparity fix that merged onmainafterv0.12.0, ontorelease/0.12.0as one commit in a PR of its own, so it can be reviewed and reverted apart from the other batches.Why it matters
tools: ["*"]and noincludeMcpJson: truestarts every server in~/.kiro/settings/mcp.jsonand the workspace.kiro/settings/mcp.json, so it runs tools its author never enabled.disabledToolsentry (write_*) on anmcp.jsonserver switches nothing off.timeoutgets 60 s to start, so a first-runnpx/uvxserver fails.mcp.initTimeoutand theuseLegacyMcpJsonspelling are ignored.Every kiro-cli user moving to KAS hits at least one of these.
Not a goal
main; nothing is changed only here.acp/harness/kas_cloud.pyis not on this branch, so fix(kas): carry kiro-cli mcp.json settings onto the KAS agent block #30712's one-line change to it is dropped.CHANGELOG.mdchange. Cuttingv0.12.1-rc.Nand the bare tag follow docs/build/release.md and stay with the maintainers.What changed (motivation → approach → change)
The main squash commit was applied with
cherry-pick -xontorelease/0.12.0@b91dae3075and committed with itscherry picked fromtrailer.6f786d9b995f7a949b5aWhat it does. New module
acp/kas_settings_mcp.py:includeMcpJsonand its aliasuseLegacyMcpJsonboth travel asincludeMcpJson, and a missing key meansfalse. When the agent does not opt in, eachmcp.jsonserver its block and its spec'smcpServersdo not name goes intoexcludedToolsas@server; Kiro Crew's own and the mandatory servers are kept.without_excluded_stubsdrops the pooled stub of an excluded server increate_session/load_session. GlobdisabledToolsentries are carried as@server/<pattern>. A server withouttimeoutgets 120 000 ms, ormcp.initTimeoutwhen longer. New moduleacp/kas_mcp_json_legacy.pyrecords, once, the agent files that already exist and state neither key; those keep KAS's earlier behaviour. The.amazonqlegacy fallback was removed onmainbefore merge, so it is not in this pick.Prerequisites checked. #31671 (
engine_features), #30952 (projected) and #31850 (thekas_permissions.pykeys) are already on this branch (#31671 via batch 33, #32229). Nothing else is needed.Hand-resolved hunks.
acp/harness/kas.py(imports)stamp_settings_mcponly; thekas_tool_limits.with_switched_off_toolsimport beside it in the conflict context comes from amaincommit not on this branchacp/harness/kas.py(projection)stamp_settings_mcp(...)call afterbuild_kas_custom_agents; thewith_switched_off_tools(...)call before it in the conflict context is left out for the same reasonacp/kas_agents.py(imports)include_mcp_jsononly; thekas_skill_scope._skill_scope_summaryimport beside it is from amaincommit not on this branch, which keeps_skill_scope_summaryin the moduleacp/harness/kas_cloud.pyEvery other file has added and removed lines identical to the main commit. The commit is authored with the public identity the push guard requires and names its original authors in its message.
Other open batches. None are open against
release/0.12.0.builder-security checked: no bind, listener, route, auth mechanism or storage grant changes. The change only narrows which
mcp.jsonservers a KAS agent starts, and log lines it adds sanitize file-derived names.Backwards compatibility
Existing agent files keep today's behaviour. The first KAS session after this ships records, once, every agent file in
~/.kiro/agentsthat states neitherincludeMcpJsonnoruseLegacyMcpJson, in the data home (.migrations/kas_mcp_json_legacy_agents.json). Those agents keep loading the global and workspacemcp.jsonservers on KAS. Kiro Crew never edits the agent files.mcp.jsonserver (unchanged)includeMcpJson: trueincludeMcpJson: falsekirocrewagent, every BotBreaking, for the third and fourth rows only (owner decision linked above). The Kiro CLI harness is unchanged.
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
Proof: not provable -- other: a backport of a main commit whose proof ran on its own PR
release/*, so the related set was run here: every touched test file plus everytest_kas_*,test_acp_harness*,test_acp_runtime*, agent-spec, runtime-binding, worker-agent, member-dispatch and chat-turn test file: 126 files, one pytest process per batch of 20,-n 0. 5129 passed. 1 failed (test_acp_harness_contract.py::test_a_missing_self_served_binary_names_its_install_command[copilot]), and it fails the same way on a cleanrelease/0.12.0checkout with the same command (a host~/.mcp.json).src/kiro_crew/acp) pass; docs-lint and the file line cap pass.Manual verification
N/A - the fix was verified on its own main PR. The 0.12.1 RC soak is the end-to-end check.
Screenshots / video
Related Issues
Backport to the 0.12 line for 0.12.1 of #30712. The deferred symlinked-
mcp.jsonfinding is #32233.Sibling sweep
Siblings: none -- the source PR carried its own sibling sweep; this PR only carries that fix.
Pattern harvest
Not generalizable: this PR only carries a fix already on
main. The source PR has its own harvest.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; see the Licensing section of CONTRIBUTING.md.