Repository navigation
fix(kas): match v2 for prompt-less specs, sub-agent settings and hooks - #25361
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. Each projection change narrows a spec toward kiro-cli v2's behaviour, the dropped non-empty-prompt pin rests on live 2.35.1 measurement, and every change reverts cleanly. Notes
[DESIGN-REVIEWED] 84f40e3 Description read[DESCRIPTION-READ] 50d2b5bd35c37730b4f15cb91562c91a191d61ada3d4d13d41ff898df4a3be3f 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 |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. One fix that rides along changes when PostToolUse fires on every backend Crew fires hooks for, and the description never mentions it. The empty-prompt premise was measured on a single kiro-cli release. Notes
What this change shipsInventory (9 items) — 7 justifiedIntent: make an agent spec behave the same on KAS as on kiro-cli v2 once KAS becomes the default engine. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 84f40e3 Description read[DESCRIPTION-READ] 1c9818ba12aab26980f7808f6eeb7a8524386d27c5112df2350e4304b2639fc7 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: |
3e8c01b to
f4e3d88
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: review dispositions for f4e3d88 (the previous head's commit, fixed up in place):
|
…tToolUse hooks - A spec with no prompt goes out as "prompt": "" instead of Crew's background-worker brief, so a user-chosen agent runs on KAS's own default prompt as it does on kiro-cli. Only kirocrew-lite keeps the brief. - toolsSettings.subagent.availableAgents becomes a subagent deny over "*" with the listed names excluded; trustedAgents a name-scoped subagent allow that goes through the governance ceiling like any authored allow. - A PostToolUse spec hook's tool matcher meets KAS calls: the turn records the id the permission request stated, or KAS's shell tool for a call classified as a shell command, and passes it to the hook store. Refs #25320
f4e3d88 to
84f40e3
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: GPT 6.1 finding on f4e3d88 ( Each call now keeps its harness id together with its canonical tool name and trusted MCP server ( Pinned by |
CrysisDeu
left a comment
There was a problem hiding this comment.
Comment, not approving yet at 84f40e32. The code is sound and every change narrows toward kiro-cli v2; two things stop an approve while auto-merge is on.
- The PR says it is incomplete. Body: "not complete until the
allowedCommandscommit is on it" and "merge order: #25339, then this PR". #25339 is open. An approve now merges a head that does not meet its own Goal and does not close #25320, and the follow-up commit (a new shell auto-approve) would land on an already-approved PR. Either remove that sentence and re-scope the body to what this head does, or wait for #25339 and push the commit; I approve on the next head either way. - No security lane looked at it. Sensitive Change Review and Security Scope both logged "no sensitive path" for this head, because
.github/scripts/sensitive_change_review.py:46SENSITIVE_GLOBScovershooks.py,hook_runtime/*,acp_tool_gate.py,agent_sdk/tool_gate.pybut notacp/kas_permissions.py,agent_sdk/spec_hooks.pyordashboard/chat_turn/tool_approval.py. This PR emits a new KASallow(trustedAgents) and makes specpostToolUsehook commands run on KAS where they never matched before. Add those three paths to the list in this PR (same gap I flagged on #25106) and post the template for this head.
What newly runs without asking, for the record: a spawn of a sub-agent listed in trustedAgents (still gated by may_skip_gate_now("use_subagent"), any PreToolUse ask covering subagent, and an availableAgents deny); spec postToolUse hooks with a tool matcher. No new hook kinds; worker kit and claude path untouched. That part is fine.
Also: subagent_manager/run_turn.py:1557, dashboard/chat_turn/tool_results.py:913: PostToolUse now fires only on a terminal frame, on every backend, and the body does not say so; a call whose frames never carry a terminal status now fires no hook. Document it and add a test for the no-terminal-status case. acp/kas_agents.py:336-342: the empty-prompt guard is gone but "" was only tested on kiro-cli 2.35.1 while the floor is 2.33.1; pin or verify. No live KAS fixture for any of the three changes; the turn-loop test uses hand-built events. Stale comments at kas_permissions.py:1061 ("No ALLOW is emitted") and mate_worker.py:582-583.
Posted by code-reviewer (Kiro Crew member) on behalf of @CrysisDeu. Full report on file.
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved on behalf of the watch holder (bolichen). Design and First Principles pass on this head, UX skipped or pass, all checks green, no conflict, no open change request.
Backport to release/0.11.0, one commit: - fix(install): download the pinned kas engine in cli installers (#26384) (cherry picked from commit 0a49fdb); docs/system-specs/modules/cli.md took only this PR's sentence on the `kas install` row. - fix(electron): never spawn a gateway once the app is quitting (#26445) (cherry picked from commit 6a4d4e0), clean. - fix: hold the remaining dropped asyncio tasks until they finish (#26463) (cherry picked from commit 8b3c698); adapted: the five sites in modules 0.11.0 has (crew_log, artifact_ingest, remote_session/worker, subagent_manager admission gate and terminal). shared_crew/admission_entry.py, sprites_session/terminal.py and their tests are not on 0.11.0, so neither is the dropped-task guard test that lists them. The crew-log publisher test gains the held-task assertions, with `_flush` stubbed as on main. - fix(kas): refuse a file write a fallbackAction deny spec does not cover (#26597) (cherry picked from commit 84c2aaa); doc and comment conflicts only: kept 0.11.0's wording around the sub-agent rules (#25361 is not on 0.11.0) and dropped main's "v2 parity" acp-client block for the same reason. Not picked: #26456 needs main-only `security/argv_rules.py` and the s3 download narrowing of #24562 in `deny_gate.py`. The v0.11.1-rc.1 Release run's test failures are fixed by #26729. All three version files move from 0.11.1-rc.1 to 0.11.1-rc.2, and the in-flight [0.11.1] CHANGELOG section gains the four fixes and the filelock bump of #26536 and the cron label fix of #26729 (#24718), both already on the branch. #26149 and #25703 are test-only and have no reader-visible line.
Backport to release/0.11.0, one commit: - fix(install): download the pinned kas engine in cli installers (#26384) (cherry picked from commit 0a49fdb); docs/system-specs/modules/cli.md took only this PR's sentence on the `kas install` row. - fix(electron): never spawn a gateway once the app is quitting (#26445) (cherry picked from commit 6a4d4e0), clean. - fix: hold the remaining dropped asyncio tasks until they finish (#26463) (cherry picked from commit 8b3c698); adapted: the five sites in modules 0.11.0 has (crew_log, artifact_ingest, remote_session/worker, subagent_manager admission gate and terminal). shared_crew/admission_entry.py, sprites_session/terminal.py and their tests are not on 0.11.0, so neither is the dropped-task guard test that lists them. The crew-log publisher test gains the held-task assertions, with `_flush` stubbed as on main. - fix(kas): refuse a file write a fallbackAction deny spec does not cover (#26597) (cherry picked from commit 84c2aaa); doc and comment conflicts only: kept 0.11.0's wording around the sub-agent rules (#25361 is not on 0.11.0) and dropped main's "v2 parity" acp-client block for the same reason. Not picked: #26456 needs main-only `security/argv_rules.py` and the s3 download narrowing of #24562 in `deny_gate.py`. The v0.11.1-rc.1 Release run's test failures are fixed by #26729. All three version files move from 0.11.1-rc.1 to 0.11.1-rc.2, and the in-flight [0.11.1] CHANGELOG section gains the four fixes and the filelock bump of #26536 and the cron label fix of #26729 (#24718), both already on the branch. #26149 and #25703 are test-only and have no reader-visible line. Co-authored-by: w <w@k.local>
Problem / Motivation
Goal: an agent spec behaves on KAS the way it does on kiro-cli v2, so the 11/2 switch of kiro-cli's default engine to KAS does not change what a user's agent does.
A live comparison of package-installed specs on both engines (#25320) found four differences, each from Crew's KAS projection, not from KAS:
promptgets Crew's "lightweight background worker" prompt on KAS, which tells the model it has no tools; on v2 it runs on kiro-cli's own default prompt.toolsSettings.shell.allowedCommandsis dropped: every command prompts on KAS.toolsSettings.subagent.availableAgents/trustedAgentsare dropped: any sub-agent can be spawned, and trusted ones still prompt.hooksrun from Crew's turn loop on KAS, but nothing proved they run for every event v2 runs them for.Why it matters
Every session that ran on v2 runs on KAS after 11/2. Without this, a user-chosen prompt-less agent is told it has no tools, an agent whose author allowed
git statusasks before every command, a spec that limits which sub-agents it may spawn limits nothing, and apostToolUsehook written as kiro-cli documents it (matcherexecute_bash) never fires.Not a goal
toolsSettings.web_fetch.trusted,allowedPaths,denyByDefaultandwrite.fallbackAction: "deny": they stay as they are (named in the session-start notice).What changed (motivation → approach → change)
Prompt. Crew substituted its worker prompt because it believed KAS needs a non-empty prompt. Measured live on kiro-cli 2.35.1: KAS needs the
promptKEY (an entry without it is answered_kiro/customAgent/not_foundand the session runs KAS'svibemode), but registers an entry whose prompt is"", and a non-empty prompt is layered on KAS's own base prompt rather than replacing it. So a prompt-less spec now goes out as"prompt": ""(kas_agents.resolve_prompt); only Crew's ownkirocrew-litekeeps the short brief for its one-shot text tasks.Sub-agent settings. KAS's
subagentcapability matches the sub-agent's name (its consent names it as the resource, and KAS writes its own trusted sub-agents as{capability: "subagent", match: [ids], effect: "allow"}).availableAgentsbecomes adenyover"*"with the listed names inexclude([]denies all);trustedAgentsa name-scopedallowthat goes through the existing merge, so the governance ceiling is asked about every sub-agent ref and one refusal drops it. A pattern travels only when it is an agent id with*as its only wildcard; anything else is named in the notice and only narrows. Measured live on kiro-cli 2.35.1: the deny with the target excluded left the call to its permission request, with another name excluded the rule refused it, and the allow ran it unprompted.Spec hooks. A new test drives a real
chat_runner._run_chatKAS turn with the real hook store and the spec on disk. It showedagentSpawn(first turn),userPromptSubmit,preToolUse(once, at the permission request) andstopalready run, andpostToolUsewith a tool matcher never ran: KAS'stool_callframe names no built-in tool and titles the call in prose, and PostToolUse matched only the title. The turn now records, per call, the id the permission request stated, or KAS's shell tool for a call classified as a shell command (spec_hooks.post_tool_hook_tool_id), and passes it to the hook store as PreToolUse already does.shell.allowedCommands(second commit, lands after #25339). A KAS shell allow would skip the permission request Crew's deny floor runs on, so the owner's decision is that Crew answers the request itself, through thespec-builtin-grantgate row #25339 adds, with one more condition: the host-recovered commandre.fullmatches one of the spec's patterns (kiro-cli's\zread as\Z) and holds none of; & | < > $ \( ) { }or a newline. The row runs after every deny row and governance, asks the ceiling aboutexecute_bashagain on every call, and honoursconfirm_tools`. That commit is built and tested on top of #25339's branch and is pushed here once #25339 merges.Merge order: #25339, then this PR. This PR is not complete until the
allowedCommandscommit is on it.Backwards compatibility
Compatible: a spec with a prompt, a spec without
toolsSettings.subagent, and every kiro-cli session project exactly as before. A spec that declaressubagent.availableAgentsnow gets those spawns refused on KAS, which is what it already gets on kiro-cli v2.Removes nothing: the change only narrows a prompt-less spec's prompt to what kiro-cli sends and adds rules a spec already asked for; no key, record or path is taken away.
Tests
test/test_kas_agents.py: a prompt-less spec resolves to""and is projected with the key present; onlykirocrew-litegets the brief; a non-string prompt is refused.test/test_kas_mode_binding.py::test_a_prompt_less_agent_goes_out_with_an_empty_prompt: throughAcpRuntime.create_sessionagainst the KAS stub.test/test_kas_tools_settings.py:availableAgentsdeny+exclude,[],"*", untranslatable and over-long lists (each narrows and is named);trustedAgentsallow; the allow travels only when the ceiling permits every sub-agent ref; a PreToolUse hook on the sub-agent tool outranks it with anask; the deny travels whatever the ceiling says.test/test_kas_spec_hooks_turn_loop.py(new): one real_run_chatKAS turn runsagentSpawn,userPromptSubmit,preToolUse,postToolUse,stoponce each;agentSpawnonly on the first turn; a PostToolUse matcher in kiro-cli names (execute_bash,shell,execute_*,*,fs_write,@git/status) meets the call the way kiro-cli would, on a permission-named call, a shell call with no request, and an edit only its request names.Revert proof, each change reverted alone:
test_kas_agents,test_kas_mode_binding)test_kas_tools_settings)tool_iddroppedtest_kas_spec_hooks_turn_loop)test_a_post_tool_use_matcher_meets_an_edit_its_request_named[fs_write-True]test_a_post_tool_use_matcher_meets_an_auto_approved_shell_callProof: PROVEN test/test_kas_agents.py::TestPromptResolution::test_a_prompt_less_spec_resolves_to_an_empty_prompt[None], test/test_kas_agents.py::TestPromptResolution::test_build_projects_a_user_prompt_less_spec_with_an_empty_prompt, test/test_kas_mode_binding.py::TestModeBinding::test_a_prompt_less_agent_goes_out_with_an_empty_prompt (head 3e8c01b)
Local: 5,161 passed across the KAS, spec-hook, chat-runner, harness, hooks and tool-call suites; the one failure (
test_harness_parity.py::test_is_kiro_cli_is_positive) fails the same way onorigin/mainon this host.Manual verification
Live on kiro-cli 2.35.1, KAS engine, scratch workspace, Crew's own projection code (
to_client_custom_agent+attach_kas_custom_agents):prompt: "": registered (nonot_found), the agent had no tools as its spec said, and it answered on KAS's default prompt. Prompt key absent:_kiro/customAgent/not_found, fallback tovibe, 17 tools. A non-empty prompt was layered on KAS's base prompt.subagentrules as listed above, oninvoke_sub_agent.Unverified: older kiro-cli releases (the agent-prompt floor is already 2.33.1), and Windows / macOS (pure-Python change, no platform branch).
Related Issues
Closes #25320
Depends on #25339 (merge it first).
Sibling sweep
Swept:
git grep -n "_KAS_FALLBACK_PROMPT\|prompt is empty\|non-empty prompt" -- src docsSibling: src/kiro_crew/docs/agent-spec-fields.md -- changed here
Swept:
git grep -n "_pending_tools\b" -- src/kiro_crew/dashboardSibling: src/kiro_crew/dashboard/chat_turn/tool_results.py -- changed here
Sibling: src/kiro_crew/subagent_parts -- not affected -- a subagent turn already passes its spec hooks to PostToolUse through
turn_spec_hooksPattern harvest
Not generalizable: each difference is one field of one wire projection, found by a live two-engine comparison rather than a code pattern.
Checklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.