Repository navigation
Conversation
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Root causes fixed and routed through the existing governance chokepoint, but the ceiling's KAS-side enforcement hinges entirely on an uncontracted backend wire field. Watch
[DESIGN-REVIEWED] eedc4f0 |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsI've fully reviewed the diff and verified the supporting code: the Candidate 1 (reserved-but-unwritten sid never re-audited on task cancellation) does not survive falsification at the required bar. No new grounded findings emerged that meet the bar. No findings. [OPUS-REVIEWED] eedc4f0 |
First Principles Review (Fable 5, fork) — 🔴 BLOCKPremise-level review of All load-bearing claims are now verified against the base: the spelling defect is real, the hooks-gate blindness to First-Principles-Verdict: BLOCK The settings-registry hunk is a rider the fix never needed: all four entries already exist byte-identical in the base file. Not justified as shipped
What this change shipsInventory (10 items) — 8 justifiedIntent: make a KAS-backend sub-agent spawn approvable at all (auto-approved when the spec grants it, promptable otherwise), governed by the
Comment corrections and the four spec-doc updates are folded into the items they document (the doc updates are mandated by the AGENTS.md same-commit rule). Blockers
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] 7a0255d |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- src/kiro_crew/acp/kas_agents.py:333 -- |
|
Independent confirmation from a parallel investigation of #9024 (we opened #9050 for the same issue six minutes before this PR, and are standing it down as the narrower duplicate -- this fix is the more complete one). We reached cause A independently: We also reviewed your cause-B fix and found it sound. The property that makes it safe is worth stating explicitly for a future reviewer, because this is a security-adjacent denial path:
Credit where we did not look: your diagnosis names the deeper mechanism we missed -- KAS sends no preceding One cosmetic note, take it or leave it: our PR also deleted the Nothing to fix that we can see. Thanks for the thorough writeup. |
dbfe797 to
401e669
Compare
|
GPT 5.6 Review, The finding was right, and I checked it against the source before accepting it. Both
Both paths now consult the ceiling before the capability is granted:
One asymmetry is deliberate and worth stating. Only the Six tests cover the ceiling, three on the projection side |
|
First Principles Review (BLOCK): fixed. Both subtractions applied. "Drop "Shrink That subtraction paid for itself twice. It also cleared the The waiver's reach is unchanged and still narrow: it is folded into the |
|
Design Review (CONCERNS, advisory): fixed. The ask was to put the trusted-channel entry and the deny-to-prompt-only
Two stale comments asserting that the permission payload carries no Docs gates: |
401e669 to
8b49f81
Compare
|
GPT 5.6 Review, I argued last round that no trusted target existed to pass, so the So the target now travels and both halves are checked:
The other half of the finding — "deny scoped policies when no trusted target is
Denying outright instead would refuse every KAS spawn on any host whose policy Scope of the guard removal is one caller: Nine tests, four of them new. One limit stays on the record: this proves the contract, not that KAS populates The |
|
GPT 5.6 Review,
Verified by importing the four touched modules in one interpreter, and the lint Moving it also made the test that pins the delegation honest: it patches |
8b49f81 to
07bc8ba
Compare
7ac4173 to
5924594
Compare
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
bolichen97
left a comment
There was a problem hiding this comment.
Approving at 5924594 after an approval-seam read.
Auto-approve is not widened past spawn: kas_permissions.py adds only use_subagent → SUBAGENT_CAPABILITY, and TestTheSubAgentGrantUsesCrewsOwnToolName pins that subagent / subagent/<x> stay untranslated. cli_chat.py ~L511 waives only the cache-miss branch on a backend-derived boolean — the is_shell path and payload-kind deny are unchanged (deny→prompt only, never →approve). _meta.kiro.consent is read with isinstance guards at every level; 9 malformed shapes → spawn_attested is False. subagent.py makes app/caller_agent keyword-only and all 14 call sites already pass by keyword. The dashboard ceiling check sits ahead of the hooks gate and an AST-enumerating test pins it. No harness-identity predicates, no model ids, four owning specs updated, 1 commit.
Three things to state plainly (none blocking): (1) admission.py ~L283 now vets the RESOLVED parent agent instead of "", so an existing agents allow-list that omits the parent's agent will start refusing default-agent spawns on Crew's own SpawnSDK path — intended, but a behavior change for such configs; (2) the may_skip_gate_now predicate withholds use_subagent from EVERY kiro-cli allowedTools writer on a spawn-governed host, not only the KAS projection as the body says — conservative, but wider than described; (3) subagent.py ~L404 docstring ("Defaults empty, leaving the SpawnSDK path exactly as it was") contradicts admission.py ~L290, which now always passes caller_agent. Also cli_chat.py/chat_runner.py gain module-level imports of the heavy kiro_crew.subagent.
bolichen97
left a comment
There was a problem hiding this comment.
Re-approving on ad98b98. The only delta from the head I approved (5924594) is the rebase over #8800's MCP-identity escape in cli_chat.py _unverifiable_shell: the attested-spawn waiver now sits AFTER that escape and still falls through to the payload-kind deny, so the escape decides everything it already decided and attestation only reprieves what it denied. File set and every other hunk are byte-identical to the reviewed diff. Approved workflow runs for the new head and re-armed Auto-Merge.
|
self-added: yes
If a maintainer judges the remaining per-spawn gap acceptable for this PR, the override reason is:
|
Maintainer action requested:
|
chenmingwei23
left a comment
There was a problem hiding this comment.
Verdict: recommend changes pending the one open blocking item; the code itself looks landable to me, human verdict pending. I reviewed this as an independent pass and verified the key premises against the tree at c98d865, so most of what I would say is already on the record from the bot lanes -- I am not re-posting those.
The one open blocker is not mine and is already tracked. GPT 5.6 flagged that an auto-approved KAS spawn gets no per-invocation SEL audit (kas_permissions.py:79). That finding is correct and the author has disposed it honestly: the grant is audited once at projection (kas_agents._ceiling_permitted -> spawn_auto_approve_granted), per-spawn auditing needs a KAS event that does not exist yet, and an operator who needs per-spawn records sets a capabilities.spawn opinion to return spawns to the prompted-and-audited path. That is a real, named residual, not a hidden one. The remaining decision is the maintainer override the author requested; I have no new information that changes it.
What I checked and found clean (independent verification, not taken from the body):
- governance_permits and resolve_active_scope both accept the new agent= keyword; CapabilityGate.scopes is a Mapping, so
inner in control.scopesin governance_scope_constrained is sound. - The keyword-only (*, app, caller_agent) change to _vet_spawn_governance is enforced at both new call sites and at admission.spawn_impl; the CLI passes caller_agent=gate.agent and correctly omits app (the CLI _ToolGate has no app field -- consistent with the docstring), the dashboard passes app=slot._app or "" matching the existing hooks-gate read of the same attribute.
- The _unverifiable_shell waiver is folded into the cache-miss branch after the MCP escape and before the payload-kind deny, so an attested spawn can only turn a hard deny into a prompt; a shell-shaped kind still refuses. Deny-to-prompt-only holds.
- The dashboard spawn check sits ahead of the hooks gate and every auto-approve/continue path, and outside
if state.context_builder:, so a title-titled frameless spawn cannot auto-approve past it. The two new reject helpers mirror the existing _reject_invalid_tool/_reject_hook_error chokepoint shape (audit-first, blocked row, activity feed, fallback entry). - Description-to-diff: the body documents head c98d865, the four acp/ spec files are updated in the same commit as the repo requires, and the tests table maps to test files present in the diff. No phantom claim found.
Advisory (non-blocking), already on the record: First Principles' CONCERNS that governance_scope_constrained ships generalized (capability, inner) for a single caller stands -- it has exactly one production consumer today. It is genuinely needed there (the empty-target presence question the Decision cannot answer), so I would keep it, but a one-line note at the definition naming its sole caller would keep the next reader from treating the generality as load-bearing.
No new blocking findings from this pass.
| return _D(True, f"{GOVERNANCE_ERROR_REASON}; no opinion", rule="default") | ||
|
|
||
|
|
||
| def governance_scope_constrained( |
There was a problem hiding this comment.
should-fix (advisory, dedup of First Principles' CONCERNS): governance_scope_constrained(capability, inner, ...) ships generalized over both capability and inner, but its only production consumer is _vet_spawn_governance calling it as ("spawn", "agents").
def governance_scope_constrained(
capability: str,
inner: str,The function is genuinely needed (only a presence check off the CapabilityGate can distinguish "deny-mode permitted the empty item" from "no agents scope at all", which governance.resolve collapses). Not a defect -- cause (added generality) -> mechanism (a second reader treats the two params as load-bearing surface) -> consequence (carrying cost until a real second caller earns it). Suggestion: add a one-line comment naming the sole caller and the concrete ("spawn","agents") shape, so the generality reads as convenience rather than contract. Not blocking.
There was a problem hiding this comment.
Done exactly as suggested, in ef8026a08 — the generality stays, with a docstring note. Added:
Sole production caller today:
subagent._vet_spawn_governance, which asks exactly("spawn", "agents")— the unnamed-spawn-target case. Thecapability/innerparameters are convenience for a future second caller, not a contract; nothing else generalizes over them yet.
Agreed on the reasoning: only a presence check off the CapabilityGate distinguishes "deny-mode permitted the empty item" from "no agents scope at all", since governance.resolve collapses both to an identical permit — so the function earns its place, and the params are cheap convenience rather than a contract to defend. Kept the signature rather than hardcoding, so no call site or test churns.
Maintainer action requested: re-issue
|
|
/ai-review override gpt ef8026a: the KAS auto-approve projection now emits spawn_auto_approve_granted, so the grant is on the record; per-spawn auditing requires a KAS event that does not exist, and the sanctioned control for an operator who needs it is a capabilities.spawn ceiling opinion, which returns every spawn to the prompting-and-audited path. |
|
AI-review override not recorded: only a repository writer may override an AI finding. |
|
Note on the one non-backend file in this revision: It is not part of this PR's change and is not derived from anything this PR touches — it is a build artifact extracted from the frontend settings pages ( Flagging for scope: happy to drop it if a maintainer would rather fix the drift directly on mainline, in which case this PR goes green once it rebases onto the corrected base. |
Maintainer action requested:
|
Spawning a sub-agent through the kas ACP backend always failed, and closing
that exposed two further defects in the ceiling that guards it. Squashed from
three commits for PR hygiene; the three changes are independent and are kept
separate below.
1. THE SPAWN COULD NOT BE APPROVED AT ALL
allowedTools -> KAS permission translation never granted the subagent
capability. CAPABILITY_BY_TOOL was keyed on KAS's internal toolIds
(invoke_sub_agent, disclose_context), but an allowedTools list holds Crew tool
names and the sub-agent tool is use_subagent everywhere else here. The entry
never matched, so the tool classified as unclassifiable, no allow rule was
projected, and KAS raised session/request_permission for a call the spec had
already granted. Both KAS toolIds are kept alongside the Crew names, since a
spec hand-written against KAS's vocabulary means the same thing.
The CLI then refused that request outright. KAS sends no preceding
session/update tool_call frame for a spawn and uses a synthetic
invoke_subagent_<parent id> toolCallId, so every toolCallId-keyed cache in
_dispatch misses, shell_classified is False, and _unverifiable_shell returns
True -- before _can_prompt, so no approval mode and no interactive human could
get past it. The request carries its own classification:
_meta.kiro.consent.capability is "subagent", the backend's own statement on the
same channel and in the same trust class as the _meta.kiro MCP identity already
read here. build_permission_event compares it against SUBAGENT_CAPABILITY onto
AcpEvent.spawn_attested, and _unverifiable_shell accepts that in place of a
cache hit. A shell-shaped payload kind or a missing consent block each keep the
refusal, and the waiver can only turn a hard deny into a prompt, never into an
auto-approve.
Neither grant path may outrank the capabilities.spawn ceiling, and neither
consulted it. classify_tool_title maps a builtin's title to commands/tools and
never to capabilities.spawn, so the hooks gate cannot see a spawn; and the one
place Crew vets a spawn, subagent._vet_spawn_governance, is not on the
backend's path. BUILTIN_TOOL_SCOPES now maps both spellings of the sub-agent
tool to capabilities.spawn, and cli_chat runs an attested spawn through
_vet_spawn_governance before the human is asked, so an administrator's ceiling
is not something a person at the terminal can approve away.
2. A CEILING DENIAL WAS ATTRIBUTED TO A HOOK
_reject_hook_error stamped outcome="hook_error" for a gate running ~28 lines
downstream of the ceiling, so a spawn refused by policy was audited as a hook
malfunction. A dedicated DENY_CAUSE_SPAWN_CEILING_ERROR and
_reject_spawn_ceiling_error record outcome="denied" instead, preserving the
six-step ordering contract (audit at step 1, reject_tool at step 5).
_vet_spawn_governance's app and caller_agent are now keyword-only: a caller
riding the app positional slot with a caller-agent name type-checks, runs, and
silently enforces the WRONG scope. Every existing call site already passed them
by keyword, so this needed no caller changes.
3. THE GATE VETTED A DIFFERENT AGENT THAN EXECUTION RUNS
subagent_manager/run.py:700 computes the agent every spawn shape runs as with
sessions.get_agent, which folds the session key (exact -> canonical ->
legacy-bare alias). The gate read _get_session_agent, an exact-key read. On a
canonical or legacy-bare key the folded read hits and the exact one misses, so
the gate vetted the "kirocrew" fallback while execution ran the real parent
agent: permitted, then runs denied.
_session_agent now reads through the folded accessor first, keeping the exact
one as fallback. The folded read DOMINATES: _fold_key returns the key unchanged
when it is already live, so whenever the exact read finds a session the folded
read finds the same one -- preferring it can only turn a miss into the true
name, never one name into a different name. run.py:1758 ->
session_allocation.py:391 does NOT fold, but the value it resolves is the boot
agent of a companion runtime process; the subagent session created on it
carries the folded agent, so the unfolded value never decides what a subagent
turn runs under. _resolve_spawn_target's docstring justified the exact-key read
by mirroring :389-392 and is rewritten.
Three guards are preserved because injected session doubles carry only
_get_session_agent: the callable() check, the isinstance(str) check and the ""
fallback. A raise guard is ADDED and is load-bearing for the folded read
specifically -- get_agent goes through _fold_key -> injected key derivers, a
failure surface the exact read never had, and this runs ahead of
_vet_spawn_governance's fail-closed wrapper. The caller/target asymmetry is
untouched: the target still falls back to "kirocrew", the caller to "".
An unnamed target also walked a DENY-mode agents scope. The gate vets
f"agents:{agent}"; with no agent that is "agents:", and a deny-mode ruleset
permits whatever it does not explicitly deny. The distinction cannot be read
off the Decision -- governance.resolve collapses the inner rule into
rule="rule2-intersect" on a permit, so "deny-mode permitted the empty item" and
"there is no agents scope at all" return an identical permit, and the second
must keep permitting. governance_scope_constrained answers the presence
question structurally off the CapabilityGate on either level and fails closed
on an evaluation error. The denial string is now mode-neutral.
This REVERSES a deliberate expectation.
test_a_deny_list_still_permits_a_spawn_that_states_no_agent asserted the
opposite, reasoning that "naming the agents you refuse says nothing about an
unnamed one". A deny-list's default-permit is safe only because every candidate
can be TESTED against the list; an unnamed target is not a member of the open
set but an untestable candidate, which resolves at execution time to an agent
that may well be a denied one. Permitting it is not honouring the operator's
default, it is declining to evaluate the control -- the same reasoning the
allow-mode case already accepts. Consequence asymmetry settles the rest:
refusing when the operator meant permit is loud and recoverable, permitting
when they meant deny runs a denied agent silently. Blast radius is a DENY-mode
agents scope with a spawn that has no nameable target; admission.py resolves
its target first, so this reaches only cli_chat.py's raw event.spawn_target.
TESTS
RED first for each finding, then green. test_subagent_coverage.py
TestTheGateReadsTheAgentExecutionActuallyRuns: 2 failed before the fold fix
("kirocrew" != "planner", "" != "planner"), 10 passed after.
test_governance_chokepoints.py TestUnnamedSpawnAgainstAnAgentsScope: 2 failed
before the scope fix (the vet returned None for a deny-mode unnamed target), 11
passed after -- including the fail-closed degrade path, proven RED-capable by
inverting the helper to return False.
460 passed across test_subagent_coverage, test_governance_chokepoints,
test_admission_gate, test_app_spawn_capability and test_deny_audit_first.
black/isort/flake8/mypy clean on the changed files; agent-sdk-boundary gate
passed. test_acp_client.py reports 6 failures that are INHERITED, proven
against a pristine origin/main worktree at 6fbb06b: identical 6 by name
there (6 failed / 610 passed) as here (6 failed / 629 passed), the delta being
the tests this change adds. test/test_governance_chokepoints.py and
test/test_dashboard_approval.py are already black-baselined; their drift is
reported, not swept.
DOC CORRECTIONS (non-blocking GPT 5.6 findings on this revision)
types.py attributed the fail-closed default of ``spawn_attested`` to the CLI's
``_prompt_allows``. The consumer that RELAXES a refusal on the flag is
``_unverifiable_shell`` (cli_chat.py:469, reading it at :511); ``_prompt_allows``
(:535) reads it at :577 only to name the spawn target in the consent line, never
to decide the answer. The comment now names the right one and records the
distinction.
security.md carried two claims the code contradicts. "The flag's only effect is
to relax a refusal" ignored the spawn-ceiling gates, which use it to refuse
outright and for which False means the ceiling is SKIPPED rather than enforced --
the opposite of fail-closed, as the types.py comment already stated. And "Both
consumers are on the CLI surface" was wrong: the consumers span two surfaces,
cli_chat and dashboard.chat_runner. Both sentences are corrected.
Comment and prose only -- no behaviour change. black/isort/flake8/mypy clean on
types.py, docs-lint passes, test_kas_permissions.py 70 passed.
COMMENT-HISTORY GATE
Seven comments added by this change narrated change history -- review-round
references ("Round 7"), and the phrases "used to" and "previously" -- which
scripts/check_comment_history.py forbids: the rule is that a comment states
CURRENT behavior in present tense, because the history is in git. The gate is a
shrink-only ratchet, so the baseline (subagent.py 23,
test_governance_chokepoints.py 4) carries pre-existing lines but licenses no new
ones, and this change took the test file to 10.
All seven are reworded in present tense with the meaning intact: the deny-mode
docstring states what the scope does rather than which round half-closed it, the
error-wording comments describe an allow-mode-only string rather than whose
string it was, and the two "the hole this closes" comments describe the omission
as a condition rather than as a past state. Comment text only -- no behaviour
change, and the assertions are untouched.
Verified: all 13 backend-lint gates pass locally plus docs-lint (14/14),
including check_comment_history, which reports "nothing in scope narrates change
history outside the baseline". test_governance_chokepoints.py and
test_subagent_coverage.py 393 passed.
WINDOWS ENCODING FIX
Backend Tests (Windows) shard 2/4 failed with:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 98656
C:\...\Lib\encodings\cp1252.py:23
TestDashboardSpawnCeiling reads dashboard/chat_runner.py to assert, by AST, that
the permission-request branch consults the spawn ceiling. It read it with
``Path.read_text()`` and no encoding, so the locale default applied: UTF-8 on
Linux and macOS, cp1252 on the Windows runners. chat_runner.py carries a byte at
offset 98656 that cp1252 has no mapping for, so the read raised before any
assertion ran -- which is why the Linux matrix, the macOS matrix, Windows shards
1/3/4 and every local run were green while shard 2 was red.
The read now pins ``encoding="utf-8"``, matching this file's own convention for
the SEL log it already reads that way. Exactly one such call exists in this
change's whole diff -- verified by grepping every added line across all four
changed files -- so there is no sibling branch to widen the fix to. The five
remaining bare ``write_text`` calls in the file are pre-existing and write ASCII
JSON fixtures, where cp1252 and UTF-8 agree.
test_governance_chokepoints.py 136 passed; all 13 backend-lint gates plus
docs-lint pass (14/14).
|
Kiro Crew [operator: chenmingwei23#de330d0c] Triaged as solvable and claimed for the drive-to-green pipeline. Blockers found:
No blocking review verdict and no unresolved policy debate on the current head. Because this PR touches the sub-agent approval path, one guard is written into the Content security scan passed with no findings. |
Problem / Motivation
On the
kasACP backend, spawning a sub-agent always failed. The root cause is a naming mismatch:acp/kas_permissions.py:CAPABILITY_BY_TOOLis keyed on KAS's internal toolIds (invoke_sub_agent), but theallowedToolslist it translates holds Crew tool names (use_subagent). The two never matched, so a spec that had already granted the tool projected no allow rule, and the spawn was refused. Reported as #9024.Why it matters
The one-line match fix exposed two more defects in the same path, so this PR is three fixes. Without B, a spawn cannot even reach a human prompt — it is hard-denied as an "unverifiable shell" call, which also breaks the shipped
pptx-makerspecs. Without C, both new grants would bypasscapabilities.spawn, the ceiling an admin sets to withhold spawning. One rollout note:_vet_spawn_governancenow fails closed on a governance evaluation error and vets an omitted target, so on a governed host a default spawn that used to slip through can now be refused (deliberately, and audited).What changed (motivation → approach → change)
A keys the table on Crew's
use_subagent(KAS's spelling kept as an alias). B reads KAS's own_meta.kiro.consent.capabilityoff the request into a newAcpEvent.spawn_attested, so a frameless spawn turns a false hard-deny into an honest prompt — never into an auto-approve. C routes both surfaces (CLI and dashboard) through the one_vet_spawn_governancechokepoint before any prompt, so the ceiling holds; the target agent is read from the backend's attestation, not the model-authored title.Spawning is now on the audit trail:
spawn_auto_approve_grantedrecords the grant,spawn_invocation_observedrecords each spawn off the parent roster.Mechanics: frame shape, the empty-target case, and the audit
KAS sends no
tool_callframe for a spawn and a synthetic toolCallId, so every cache inacp/_dispatch.pymisses and the event arrives fully unclassified;_unverifiable_shellread that as "run a command we can't verify". The consent block travels the_meta.kirochannel already trusted for MCP identity. An empty target is the caseagentsused to miss —governance.resolvecollapses to an identical permit whether a deny-ruleset let it through or no scope exists, sogovernance_scope_constrainedreads the scope's presence off theCapabilityGateinstead. The roster audit is approval-route-neutral, skipspendingstages, dedups by session id (reserved on the loop so overlapping frames can't double-record), and offloads the blocking write. Fouracp/spec docs updated in the same commit, per the repo rule.Tests
New tests lock in the load-bearing behaviour:
test_a_spawn_is_attested_off_the_request(the real KAS frame yieldsspawn_attested),test_a_ceiling_that_forbids_spawning_refuses_an_attested_spawn(ceiling holds before any prompt), andtest_kas_spawn_audit_records_each_spawn_once_under_concurrent_frames(no double-record). Plus ~26 further cases acrosstest_kas_permissions.py,test_governance_chokepoints.py, andtest_kas_subagent_progress.py. Full backend suite run at HEAD and base shows identical pre-existing failures; none touch the changed modules.Manual verification
Five live runs against KAS 0.58.7 / kirocrew 0.6.0.11 (
acp_backend="kas"): the spawn is denied at baseline, works with fix A, and run 5 captures the real permission frame carrying_meta.kiro.consent.capability="subagent"while the event staysshell_classified=False— proving B is independent of A. Instrumentation removed afterward.Screenshots / video
Why no screenshot: backend permission/audit change; the only user-visible text is the CLI approval prompt line, no rendered UI surface changes.
Related Issues
Fixes #9024
Pattern harvest
A lookup table on a translation seam must be keyed on the vocabulary of the side that supplies the input, not the side that consumes the output — and a fail-closed default hides the bug, because a miss looks like a deliberate "not classifiable".
Rule candidate: when a translation table fails closed on an unknown key, add a test that asserts at least one key is reachable from a real input, not only that unknown keys are refused.
Checklist
acp-client.md,cli.md,security.md,governance.mdContribution License Agreement