Repository navigation
fix(acp): carry a kirocrew-core disabledTools toggle on the session gate where the backend prompts - #17859
fix(acp): carry a kirocrew-core disabledTools toggle on the session gate where the backend prompts#17859chenmingwei23 wants to merge 1 commit into
Conversation
First Principles Review (Opus 5.5) — 🔴 BLOCKPremise-level review of First-Principles-Verdict: BLOCK
Not justified as shipped
Inventory (9 items) — 8 justifiedIntent: let an operator switch off one
BlockersSecond spelling of the volatile-env normalizer.
Subtraction: delete [FIRST-PRINCIPLES-REVIEWED] 699a748 Description read[DESCRIPTION-READ] 63387b07ba6ebd0493613c36a6290bc1bb271a9f01b7f666f9f362bd5864f41b That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The activation fingerprint comes from a second spec read taken after the mount's own read, so the edit window is narrowed, not "closed by construction". The new refusal also covers every session. Watch
[DESIGN-REVIEWED] 699a748 Description read[DESCRIPTION-READ] 3d432c0cd9759a6dda3c41fab04bddce7eeada7185733bf0c914c412cb59ac12 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 |
GPT 6.1 Review — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/acp/runtime.py:7025 -- Fingerprint does not cover the spec used by the mount
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1: unbounded-harm claim, since a disabled tool would get auto-approved and skip the deny gate. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsNo findings that block the merge; one advisory finding on wrong remedy text. FINDING — src/kiro_crew/acp/runtime.py:6844 — The refusal always says "Re-enable skill_search in the dashboard's MCP tab", but [OPUS-REVIEWED] 699a748 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
8ff2520 to
c967c07
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
c967c07 to
07ffec5
Compare
07ffec5 to
d0eff24
Compare
d0eff24 to
d8b5ae9
Compare
d8b5ae9 to
634e506
Compare
c0a80a4 to
a9c2791
Compare
|
Fixed in F1 (a mounted server with no carried deny escaped the withheld check): the activation reconcile intersected the live mount's The reconcile now intersects the live
Fail-safe shape kept — the reconcile still only ever refuses a mode switch, never relaxes a restriction. New test pins the case: cron mounted with an empty carried-deny set, the live mount withholds cron, the switch is refused; a server the session did not mount (empty roster) is not refused, so the roster, not the mere withholding, drives it. |
a9c2791 to
be8fd3e
Compare
|
Addressed on Pooled broker stub counted as mounted (the FINDING) — fixed. You are right. The roster is now exactly the elements the unpooled mount added: The The gate does not read the model's own arguments for identity. The empty-carried-set reconcile (noted as ride-along) stays — fail-safe. That branch is the fix for the earlier auto-approved-with-no-deny case: a server mounted auto-approved (no carried deny) whose live spec later withholds its element. Dropping it would let that switched-off tool run on the auto-approve path, so it is kept; it refuses only (never relaxes), and the roster — now stub-excluded — is what it intersects. Gate green on the committed head (black py312 / flake8 / isort / mypy); the reconcile, roster, parity, and native-projection-sources tests pass locally. |
be8fd3e to
f7fd1ff
Compare
|
Both items addressed on F1 (runtime.py:6314 — unprojected session skips the check). Confirmed: when no projected spec reaches the reconcile (a projection rollback or ceiling fallback leaves This is the same anchor as earlier rounds, so rather than add another special case (re-deriving the authored spec for that one path), I closed the class with a single rule: fail closed. When the live spec cannot be determined and the session mounted any identity-bound element, the reconcile now refuses — the session is not started rather than started with a toggle unenforced. A session that mounted no identity-bound element has nothing that could slip through, so an empty roster is still a no-op (the common no-projection, no-core-tool start). New test pins the fail-closed path and the empty-roster no-op is kept as a contrast. F2 (session_mcp.py:1743 — malformed list skips the withholding guard). Confirmed and fixed: the carry check accepted any list, so Gate clean (black/flake8/isort/mypy), 430 touched tests green. One commit. |
f7fd1ff to
8fd6631
Compare
|
Re-scoped to the smallest fail-safe fix of the original problem, pushed as What this is now: at the single point where the control-plane mount decides to withhold or carry ( What was removed: the live-spec reconciliation at activation (and its mounted-roster derivation and backend gate) and the unrelated website/feature-map changes that had accumulated. The reconcile attempted to close a mid-life edit window and grew a new finding each review round; it is deliberately out of scope here. That window — an edit landing between the mount's read and the spec kiro-cli activates for one session, which self-heals on the next start — is tracked as the follow-up #18322 and named under "Not a goal" in the description. Footprint: 8 files ( |
|
On the mount read: this is the mid-life edit window this PR scopes out (see "Not a goal" in the description); it is tracked in #18322, now updated to name this exact sequence — mount against the cached projection, Verified against The comment that referenced an activation re-check is being corrected to point at #18322 as the deferred closure rather than describing a guard that is not in the call graph; the Pattern harvest section records that as a review-prompt rule candidate. |
|
Addressed in The gap. The mount reads the spawn spec and carries a The fix. Test. The follow-up issue stays open for the broader hardening it tracks, but the specific path flagged here — a late |
|
Addressed in The previous head's guard only ran when a projection view was adopted ( The guard now runs whenever the session carries deny pairs, independent of the projection:
In every case, if the activated spec auto-approves a carried deny the session is refused rather than started with the switched-off tool runnable. Tests added for the three new branches: unprojected + disk spec auto-approves → refuse; unprojected + disk spec does not auto-approve → start; activated spec unreadable → fail closed. Each fails against the prior projection-gated guard ( |
|
Addressed in F1 (the flagged fenced finding). On this head the finding narrowed to a log-hygiene point: a tool name hand-written into a settings file can carry a control character, and on the auto-approved-withhold path that name was interpolated into a debug line, so a crafted name could write a forged debug record. The toggled tool was already withheld and nothing ran — the only exposure was the log line itself — but the interpolation is now routed through this module's existing sink cleaner (the same one every other message here uses), which drops control characters before the line is emitted. The identical cleaner is applied to the activation guard's refusal message, so neither path can be fed a forged line by a crafted tool name. Added Comment History Gate. Reworded the comment and test text that stated things in historical terms (issue references, "no longer", "fails before") to present tense describing current behavior, so the gate passes. No logic change from that part. Both the mount-time carry/withhold predicate and the activation guard (which now covers the unprojected starts and fails closed when the activated spec cannot be read) are unchanged in behavior from the prior head. |
|
First Principles BLOCK addressed by amending the Goal (the second path the verdict offers: "or a human amends the Goal to include the mid-life window"). The activation guard is intended, not accidental surface. The project goal was amended to include closing the specific mid-life edit window (a spec edit landing between a session's mount and its activation that lets a late The guard reuses the mount's own |
|
Addressed in The finding was correct: on the unprojected path the guard read the activated spec at the user level only ( The guard now reads the activated spec through the mount's own resolver ( Added |
|
On The guard this PR adds defends the dangerous direction: a late Extending the activation path to also merge newly-added denies would widen it past the P0 (which was a disabled tool refusing every session), so I'm not making that change unilaterally. This is a fenced finding, so it needs a maintainer decision (an |
|
Addressed in The activation guard no longer checks only the deny set read at mount time. It now re-runs the mount's own predicate — Reusing the mount's own predicate means there is no second copy of the carry/withhold logic to diverge from it. Tests: a deny added in the gap refuses (projected and unprojected), a deny removed/withheld refuses, a changed deny refuses, an unchanged set starts, no restriction either side starts, and an unreadable activated spec fails closed. The added-deny tests fail against the prior guard (which only ran when the gate already carried a pair) and pass with this change. |
|
Acknowledged. This finding ( Rather than extend the per-start comparison again, the fix approach for this class is being reconsidered at the review level (a simpler blanket treatment of any gap-time control-plane change). I'm not applying a further targeted patch here. No code change from me on this round. |
|
Re-scoped to a whole-spec fingerprint: any change to the resolved spec between The mount records a sha256 of the resolved agent spec (project-nearest, the mount's own resolver) at |
|
Addressed in The finding is correct: hashing the resolved spec raw would move the fingerprint when a launcher re-stamps a per-launch MCP env nonce, so concurrent session starts would read as a spec change and be refused. Added |
…ate instead of refusing Disabling one kirocrew-core tool in the dashboard's MCP tab writes disabledTools into the global mcp.json. On the kiro backend the control-plane element cannot express that key, so the mount withheld the element and refused every new session of an agent standing on it until the toggle was undone. The control plane has a per-call permission channel that can honour the toggle: its tools carry no annotations, so every call reaches Crew as a permission request the client can reject. So a well-formed disabledTools on a control-plane server now mounts the element and carries the (server, tool) deny pairs on the session's per-call gate (spec_denied_tools); the session runs minus the toggled tool rather than being refused. Fail-safe fallbacks keep the toggle authoritative on every approval path: - a tool the spec's allowedTools auto-approves is withheld, not carried (kiro-cli sends no permission request, so a carried deny would not apply); - a malformed disabledTools value is withheld (no pairs, so carrying would drop the toggle); - skill_search itself disabled refuses a search agent's session (it would start with its skill resources dropped and every search call refused). The skill projection applies the same decision so it never promises a view the mount then withholds.
|
Addressed in F2 (blocking call on the event loop). The session/new fingerprint was computed with a synchronous F1 (fingerprint taken after the response). The fingerprint is now taken at the mount's observation — computed before Boundary + lint (prior head). The guard no longer imports the materialization owner's The guard still refuses on any change to the resolved spec between start and activation (volatile MCP env values excluded), with the whole-spec fingerprint closing F1–F6 by construction. |
|
On This is the third distinct shape the single-read-restriction-re-verified-at-consumption approach has surfaced across review rounds, each at a different seam (per-field deny-set diff, observation timing, now the source-vs-projection mismatch). The correct fix is to hash the exact spec object the mount judged and thread it from |
|
Closing: every incremental guard has exposed another gap between the mount's cached projection and the source spec. This needs a design decision on where disabledTools is enforced for a live session; tracked in #18322. |
Problem / Motivation
Goal: Let an operator switch off a single
kirocrew-coretool from the dashboard's MCP tab without refusing every session of an agent whose spec stands on that server — and keep that toggle authoritative on every approval path, including when a spec edit lands between a session's mount and its activation.Disabling one
kirocrew-coretool writesdisabledToolsinto the globalmcp.json. On the kiro backend the control plane is mounted as a per-session element, and that element cannot expressdisabledTools(a kiro-cli-only key), so the mount withheld the element and refused every new session of an agent standing on it until the toggle was undone. The toggle's apparent promise (lose one tool) and its effect (lose the agent's sessions) diverged.Why it matters
Turning off one tool should cost one tool, not the agent. The control plane has a per-call permission channel that can honour the toggle instead of refusing: its tools carry no annotations, so every call reaches Crew as a permission request the client can reject.
What changed
At the single point where the mount decides to withhold or carry (
kiro_control_plane_servers), a well-formeddisabledToolson a control-plane server now mounts the element and carries the toggled(server, tool)pairs onto the session's per-call gate (AcpSessionHandle.spec_denied_tools), via_unpooled_control_planeswhich returns those pairs for the start paths to feed the gate. The session runs minus the toggled tool rather than being refused. The skill projection applies the same decision so it never promises a view the mount then withholds.If a
kirocrew-coretoggle cannot be honoured safely, it fails closed (refuses or keeps withholding) rather than mounting under a deny that would not apply:allowedToolsauto-approves is withheld (kiro-cli sends no permission request for it, so a carried deny would not take effect);disabledToolsvalue is withheld (it yields no deny pairs, so carrying it would silently drop the toggle);skill_searchitself disabled refuses a search agent's session (it would start with its skill resources already dropped and every search call refused — worse than a clean refusal).Activation guard (mid-life edit window)
The mount judges one spec from one read. An edit to that spec landing between
session/newand the spec kiro-cli activates for the session could otherwise start the session under settings the user has since changed (a tool they disabled staying callable). To close that window, the mount records a sha256 fingerprint of the resolved agent spec atsession/new(read through the mount's own resolver, project-nearest), and_activate_mode_bracketedre-reads the spec the same way before the first turn. If the fingerprint changed, or the spec cannot be read, the session fails closed (refuses) with a plain message telling the user to reopen the chat; the next start reads the current spec. A whole-spec fingerprint closes the window by construction — any change refuses, with no per-field predicate to leave a case uncovered. This replaces an earlier deny-set comparison that could miss the case where the activated spec withholds the control-plane element.Not a goal
kirocrewagent. It grants@kirocrew-corewhole-server inallowedTools, so kiro-cli auto-approves every core tool with no permission request; a carried deny could not take effect there, so a toggle on the default agent keeps the existing withhold-and-refuse behaviour (now the auto-approve fallback above).Tests
test/test_native_skill_projection_sources.pydrives the carry/withhold decision through the runtime start path (the user-visible path that was refused on main): a tool disabled in global/project/spec is carried and the element mounts; a malformed list, a bare*/whole-server grant, andskill_searchitself each keep the fail-safe (withhold/refuse); a control character in a toggled tool name cannot forge a log line.test/test_acp_set_mode_projection_fallback.pydrives the activation guard with one test per case: a spec that changed in the gap refuses, an unchanged spec starts, an unreadable spec fails closed, and the withheld-core-plus-added-restriction case is refused.test/test_session_token_identity.pyis updated so thedisabledToolscases assert the carry (element mounts, pair on the gate) rather than the old withhold.Pattern harvest
Rule candidate: review-prompt
Pattern: a per-field recheck of a config read once and consumed later (here, comparing the deny set a spec yields at two points) repeatedly missed a new edge each review round, because any field the comparison does not model is a gap. A whole-artifact fingerprint compared across the two reads closes the class by construction: any change refuses, so there is no uncovered field. Review prompt: when a review finds that a settings artifact read at one point is consumed at a later point, prefer fingerprinting the whole artifact and refusing on any difference over a predicate that compares selected fields.