Repository navigation
fix(acp): carry brace globs and the 120 s MCP start budget on KAS resume - #32602
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The brace expansion and the removed resume-time hoist both fix the stated gaps where they start, and the load path now does what the new-session path already does. Notes
[DESIGN-REVIEWED] 7bfb11e Description read[DESCRIPTION-READ] 06a7532430937732bd9496254d978e1f62be8c1c98432e0936a61359f74fc983 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 is either the fix for #32598, a removal of code the fix leaves with no caller, or a declared notice for patterns that cannot be carried. Not checked: that KAS launches agent-block servers on a cold Notes
What this change shipsInventory (7 items) — 6 justifiedIntent: on KAS, a kiro-cli agent's
[FIRST-PRINCIPLES-REVIEWED] 7bfb11e Description read[DESCRIPTION-READ] 6ab22c617753cbb2f78c59b606be63ff1a2dfc6f1f1d44330ff0db8f65a657d4 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: |
296d203 to
af22c37
Compare
|
GPT 6.1 finding on I checked this in the code, and it was real. The fix bounds every allocation before it happens:
New cases in
|
af22c37 to
bf384f3
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Requesting changes on bf384f3 for one part. All 97 checks pass. Most of this PR is fine and should stay as it is:
kas_globsexpands flat{a,b}groups with plain string code, so adisabledToolsentry like{read,write}_*really switches those tools off on KAS. The branch and length caps are good.- User-declared MCP servers now stay in the agent block on
session/load, as onsession/new, so they keep the 120 stimeout.
What to change: the fail-closed path for a pattern KAS can't match. When kas_globs returns None (a [...] class, a \ escape, **, a nested or empty brace, or the caps), this head withholds the whole server (exclusions += [f"@{name}"] in finish_settings_mcp), or disabled_tool_exclusions puts the spec's server on unusable and the spec is refused. The user asked to turn off one tool, and this turns off the whole server or the agent. On main the server runs, so this is a new restriction, which our rule doesn't allow.
Please keep main's behaviour for such a pattern (carry the exact entries you can, run the server) and make the gap visible instead:
- the existing
logger.warning, naming the server and the pattern (throughsanitize_sink_text), and - a notice the person sees, for example a line in the session-start notice or a bell note: "disabledTools pattern
<pattern>for<server>can't be applied on KAS, so that tool stays on".
A test that a [...] pattern leaves the server running and produces the notice would pin it. With that change, I'll approve.
On KAS, a disabledTools glob such as {read,write}_* matched no tool,
because KAS's excludedTools reads braces literally. Crew now expands each
flat {a,b} group into one excludedTools entry per branch. A glob KAS cannot
match exactly ([...], \, **, nested, empty or unbalanced braces, more than
64 branches) fails closed: a spec server's refuses the agent, and an
mcp.json server's excludes the server whole.
A resumed chat moved user MCP servers into the session-level array, which
has no timeout slot, so they got KAS's 60 s instead of the 120 s a new chat
gives. User servers now stay in the agent block on session/load too; KAS
launches block servers there (measured on the 0.66.33 bundle and on
0.66.91). The load-only include_user_servers / reserved_names hoist, and
the settings_server_names and _carries_env_reference helpers that only it
used, are removed.
Fixes #32598
Refs #30712
bf384f3 to
f9fbe88
Compare
|
@bolichen97 thanks — done on f9fbe88 (rebased onto main 1dde2fb; second commit When
Local: GPT and Opus local reviews. GPT found two gaps in the notice (declared servers' global globs, and the log cap), both fixed in this commit, and a verifier confirmed both closed. Opus passed, with three low notes on notice wording that I am answering here rather than with more pushes. First, a |
bolichen97
left a comment
There was a problem hiding this comment.
Approving 7bfb11e as maintainer. All 98 checks pass. Fixes #32598. This replaces my change request on bf384f3.
The point from that review is fixed. A disabledTools glob KAS cannot match (kas_globs returns None) no longer withholds the server or refuses the spec. It is carried as written and the server still runs, as on main. unmatched_globs_notice names each pattern and its server in the session-start notice, capped at eight lines, and each one is logged as a warning. The tests pin both the spec and the settings-file cases, and that the notice can't be forged.
The parts I said were fine stay as they were: flat {a,b} expansion with plain string code, and user servers kept in the agent block on resume so they keep the 120 s timeout. I found no new regex in product code.
…ume (#32602) * fix(acp): carry brace globs and the 120 s MCP start budget on KAS resume On KAS, a disabledTools glob such as {read,write}_* matched no tool, because KAS's excludedTools reads braces literally. Crew now expands each flat {a,b} group into one excludedTools entry per branch. A glob KAS cannot match exactly ([...], \, **, nested, empty or unbalanced braces, more than 64 branches) fails closed: a spec server's refuses the agent, and an mcp.json server's excludes the server whole. A resumed chat moved user MCP servers into the session-level array, which has no timeout slot, so they got KAS's 60 s instead of the 120 s a new chat gives. User servers now stay in the agent block on session/load too; KAS launches block servers there (measured on the 0.66.33 bundle and on 0.66.91). The load-only include_user_servers / reserved_names hoist, and the settings_server_names and _carries_env_reference helpers that only it used, are removed. Fixes #32598 Refs #30712 * fix(acp): keep the server running when KAS cannot match a glob A disabledTools glob KAS has no spelling for ([...], a \ escape, **, a nested or empty brace, or past the caps) withheld the whole mcp.json server, and refused the agent when its own spec held one. Both are restrictions main does not have. Such a glob is now carried as written, as on main, and the server runs. The session-start notice names each one, from the spec, the global settings file or an mcp.json server, skipping a muted one, and every one is logged as a sanitized warning. The global and spec switches now expand {a,b} globs per branch too, so a declared server's global glob holds. --------- Co-authored-by: Joe Guo <zejiangg@amazon.com> (cherry picked from commit 43c2489) Backport note: release/0.12.0's KAS harness applies with_switched_off_tools after stamp_settings_mcp (main applies it before), so harness/kas.py reads the switches once before the stamp, passes unmatched= to it, and keeps release's switch step after it. The build_kas_custom_agents call keeps release's arguments: main's forward_ssh_auth_sock comes from #32600, which is not on this base. The hoist_servers_for_session docstring keeps release's paragraph on a managed entry relaunched in the block.
…ume (#32602) * fix(acp): carry brace globs and the 120 s MCP start budget on KAS resume On KAS, a disabledTools glob such as {read,write}_* matched no tool, because KAS's excludedTools reads braces literally. Crew now expands each flat {a,b} group into one excludedTools entry per branch. A glob KAS cannot match exactly ([...], \, **, nested, empty or unbalanced braces, more than 64 branches) fails closed: a spec server's refuses the agent, and an mcp.json server's excludes the server whole. A resumed chat moved user MCP servers into the session-level array, which has no timeout slot, so they got KAS's 60 s instead of the 120 s a new chat gives. User servers now stay in the agent block on session/load too; KAS launches block servers there (measured on the 0.66.33 bundle and on 0.66.91). The load-only include_user_servers / reserved_names hoist, and the settings_server_names and _carries_env_reference helpers that only it used, are removed. Fixes #32598 Refs #30712 * fix(acp): keep the server running when KAS cannot match a glob A disabledTools glob KAS has no spelling for ([...], a \ escape, **, a nested or empty brace, or past the caps) withheld the whole mcp.json server, and refused the agent when its own spec held one. Both are restrictions main does not have. Such a glob is now carried as written, as on main, and the server runs. The session-start notice names each one, from the spec, the global settings file or an mcp.json server, skipping a muted one, and every one is logged as a sanitized warning. The global and spec switches now expand {a,b} globs per branch too, so a declared server's global glob holds. --------- Co-authored-by: Joe Guo <zejiangg@amazon.com> (cherry picked from commit 43c2489) Backport note: release/0.12.0's KAS harness applies with_switched_off_tools after stamp_settings_mcp (main applies it before), so harness/kas.py reads the switches once before the stamp, passes unmatched= to it, and keeps release's switch step after it. The build_kas_custom_agents call keeps release's arguments: main's forward_ssh_auth_sock comes from #32600, which is not on this base. The hoist_servers_for_session docstring keeps release's paragraph on a managed entry relaunched in the block.
Problem / Motivation
Goal: On the KAS backend, a kiro-cli agent's MCP
disabledToolsglobs and its 120 s server start budget hold the same way they do on kiro-cli, in a resumed chat as well as a new one.#30712 left two gaps, tracked in #32598. I re-checked both on main
20764b5993, and both are still open:disabledToolsentry that holds*or?withglobset(agent/util/glob.rs,matches_any_pattern). So{read,write}_*turns offread_fileandwrite_file. KAS'sexcludedToolsknows only*and?, and reads{,,and}literally (tools/tool-filter.ts,globMatch). Crew sent@server/{read,write}_*, which matches no tool. This happened for a spec's own servers (kas_tool_limits.disabled_tool_exclusions) and formcp.jsonservers (kas_settings_mcp._glob_disabled_tools).session/load,hoist_servers_for_session(include_user_servers=True)moved user servers into the session-levelmcpServersarray. KAS's session-level element has notimeoutslot (mcp/client-servers.ts), so those servers got KAS's 60 s default. fix(kas): carry kiro-cli mcp.json settings onto the KAS agent block #30712 recorded this as ashortcut:infinish_settings_mcp.Why it matters
The first gap leaves tools on that the agent's author switched off. The second makes a slow first-run
npx/uvxserver fail only after a chat is resumed, with no clear cause.Not a goal
includeMcpJsonreading split in Crew reads a missing includeMcpJson two ways (true in capability/materializer code, false in the KAS adapter) #30822. It gets its own PR.[...]classes or\escapes exactly. KAS has no spelling for them, so they fail closed (below).What changed (motivation → approach → change)
Brace globs. The new
kas_tool_limits.kas_globsturns onedisabledToolsentry into theexcludedToolsentries KAS matches the same way:*or?is kept as is, because both engines compare it exactly.{a,b}group becomes one entry per branch. For example,{read,write}_*becomesread_*andwrite_*.Noneis returned for a pattern KAS cannot match exactly:[...],],\,**, a nested, empty or unbalanced brace, more than 64 branches (checked before the expansion is built), or more than 512 characters. The patterns can come from a settings file a checkout supplies, so the expansion never allocates past these limits.The expansion is applied at all three places a
disabledToolsentry reachesexcludedTools: a spec's own servers (disabled_tool_exclusions),mcp.jsonservers (_glob_disabled_tools), and the spec/global switches (with_switched_off_tools, which covers a declared server's global-settings globs).A
Nonepattern adds no restriction, per the maintainer's rule (review of 2026-11-08): it is carried as written, as on main, and the server runs. The agent is not refused and the server is not excluded whole. The person is told instead:<pattern>for<server>can't be applied on KAS, so that tool stays on." (kas_tool_limits.unmatched_globs_notice; after eight lines, one more names the remaining servers);sanitize_sink_text;mcp.jsonservers, and skips a server KAS does not start (muted in the spec, or anmcp.jsonserver the agent does not load).Resume timeout.
load_sessionno longer hoists user-declared servers. They stay in the agent block onsession/load, as they do onsession/new, sofinish_settings_mcpgives them the 120 stimeout. KAS launches block servers on a coldsession/load; the evidence is under Manual verification. Only Crew's managed servers and the builtin app servers move to the session-level array now, on both paths.With the load-only user hoist gone, these have no caller left and are removed:
include_user_serversandreserved_namesparameters ofhoist_servers_for_session;session_mcp.settings_server_names;kas_env_withhold._carries_env_reference.The
shortcut:comment is replaced, anddocs/system-specs/modules/acp-client.mdis updated.Backwards compatibility
Not breaking. A pattern KAS cannot match exactly (
[...],\,**, a nested or empty{}) behaves as on main: it is carried as written and its server runs. The only new output is the session-start notice line and the warning log. A flat{a,b}glob now switches off the tools it names, which is what kiro-cli already does with the same spec.Reader:
src/kiro_crew/acp/runtime_session_load.py:load_session-- chat -- the only caller ofinclude_user_servers/reserved_names/settings_server_names; it now passes neither (test_kas_env_launch_resume.py).Reader:
src/kiro_crew/acp/kas_agents.py:hoist_servers_for_session-- chat -- the only caller of_carries_env_reference; the user-hoist branch it guarded is gone (TestUserServersStayInTheBlock).Reader:
src/kiro_crew/acp/runtime_session_create.py:create_session-- chat -- never passed the removed parameters; unchanged.Tests
test_kas_settings_mcp.py::TestBraceGlobs: thekas_globscases above; a spec server's{read,write}_*carried per branch;fs_[rw]*on a spec server keeps the agent and is named in the notice; a non-listdisabledToolsstill refuses the agent, as on main; a global-switch brace glob carried per branch; anmcp.jsonserver's brace glob carried per branch; an unmatchable glob on anmcp.jsonserver keeps it running and is reported; the notice is sanitized and names every server past the eighth line.test_acp_harness_contract.py: a declared server's globalfs_[rw]*keeps the server in the block and produces the session-start notice; a muted spec server's glob produces none.test_kas_env_launch_resume.py::test_a_resumed_sessions_snapshot_is_removed_at_shutdowndrives the realload_sessionand checks that a user server stays in the registered agent block. It fails on main's production code (AssertionError: a user server stays in the block).test_kas_agents_mcp_servers.py::TestUserServersStayInTheBlock: a user server stays in the block while the managed server moves with its session token.reserved_namesandsettings_server_namesare deleted, and the env-relay tests drop their load parametrization.Proof: not provable -- other: prove.py reverts the new
kas_globstoo, so the changed test modules fail at import and no assertion runs. The resume test was run by hand againstorigin/main'ssrc/and fails as quoted above.Manual verification
I probed KAS 0.66.91 (kiro-cli 3.1.0's engine) with a scratch stdio ACP client. It used a real
kiro-cli acp --agent-engine v3, with an agent sendingincludeMcpJson: falseand a scratch cwd. One stdio MCP server answersinitializeafter 75 s:session/newsession/load(new process)timeout: 120000connectedat ~79 sconnectedat ~77 sfailedat ~63 sfailedat ~62 sWith a 2 s delay, the block server was started again by the cold
session/load. The pinned 0.66.33 bundle was not run here, because this host's glibc 2.26 is below its 2.28 floor.acp-client.mdalready records a 0.66.33 probe that shows block entries start onsession/load, a server first declared at load included. The 0.66.62 capturemcp-live-apply-live.jsonlshows the same.Related Issues
Fixes #32598
Refs #30712
Sibling sweep
Swept:
git grep -nE "disabledTools|excludedTools" -- src/kiro_crew/acp/andgit grep -n "include_user_servers\|reserved_names" -- src testSibling: src/kiro_crew/acp/kas_tool_limits.py -- changed here -- a spec's own servers'
disabledToolsSibling: src/kiro_crew/acp/kas_settings_mcp.py -- changed here --
mcp.jsonservers' globdisabledToolsSibling: src/kiro_crew/acp/kas_tool_limits.py:with_switched_off_tools -- changed here -- a declared server's global-settings globs are expanded too
Sibling: src/kiro_crew/acp/runtime_session_load.py -- changed here -- the only
include_user_servers=TruecallerPattern harvest
Not generalizable: the brace gap is specific to translating kiro-cli's
globsetinto KAS's two-wildcard matcher, and the timeout gap was one hoist call site.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.