Repository navigation
fix(acp): carry a kirocrew-core disabledTools toggle on the session gate instead of refusing - #17858
Closed
chenmingwei23 wants to merge 1 commit into
Closed
chenmingwei23 wants to merge 1 commit into
chenmingwei23 wants to merge 1 commit into
Conversation
…ate instead of refusing On the kiro backend a disabledTools toggle on the control plane used to withhold the per-session element and refuse every new default-agent session (kirodotdev#14125). Carry the toggle on the session's per-call permission gate instead, so the session runs minus the toggled tool and keeps skill_search. Fail-safe gate (supersedes kirodotdev#17547, fixes bolichen97's P0): carry only where the backend provably prompts -- the tool is not auto-approved by the agent spec's allowedTools. When a disabled control-plane tool IS auto-approved (@kirocrew-core whole-server, or @kirocrew-core/<tool>), kiro-cli sends no permission request, so keep withholding rather than drop the restriction. The skill projection applies the same gate so it never promises a view the mount withholds. Fixes kirodotdev#14125
Contributor
Author
|
Superseded by #17859 (same upstream branch so CodeBuild runners can see it). Keeping the fork branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this change
Disabling one
kirocrew-coretool from the dashboard MCP tab should cost onetool, not the whole default agent's sessions. On the kiro backend Crew injects
the control plane as a per-session element, and that element cannot express a
disabledToolstoggle, so after #14078 every new default-agent session wasrefused until the toggle was undone (#14125).
This supersedes fork PR #17547, which fixed the refusal by carrying the toggle on
the session's per-call permission gate (
spec_denied_tools). A review on #17547found that fix fail-open on the kiro backend (bolichen97, P0, upheld):
spec_denied_toolsis checked only onsession/request_permission, but kiro-cliauto-approves
@kirocrew-corethrough the agent spec'sallowedTools(whole-server) and sends no permission request — so the carried deny never
fires and a switched-off tool still runs.
This PR keeps #14125's win where it is safe and closes the fail-open:
disabledToolspair is carried on the gate only where the backend provablyprompts for the tool — i.e. the tool is NOT auto-approved by the agent spec's
allowedTools. There the toggled tool prompts and the gate rejects it, so thesession runs minus that one tool and keeps
skill_search.whole-server
@kirocrew-coreentry, or an exact/glob@kirocrew-core/<tool>),the element is withheld again — refusing the session is the fail-safe answer
when the only alternative is running a tool the operator switched off. This is
the smallest change that keeps the restriction authoritative; it never
re-enables a disabled tool.
allowedtools_auto_approved_pairs()readsallowedToolswith kiro-cli's ownmatching (
@serverwhole-server,@server/toolexact,@server/<glob>), fromthe SAME spec the mount already judges.
view the mount then withholds (the one-read invariant).
Fail-safe default per project convention for a security/data tradeoff: where the
gate is not a complete channel, withhold rather than drop the restriction.
Reproduction
Unit test
test_a_toggled_tool_that_allowedtools_auto_approves_is_withheld_not_carriedin
test/test_native_skill_projection_sources.py:@kirocrew-coreand adisabledTools: ["learn_add"]toggle, the carry-everything behaviour mounts theelement and carries the pair — a fail-open (
assert 'kirocrew-core' in {}fails on that head, matching the reviewer's "Fails on this head").
mount.withheldcontainskirocrew-core) and nothing is handed to the gate as a would-run tool(
mount.carried == frozenset()).test_a_toggled_tool_the_spec_does_not_auto_approve_still_carriespins the#14125 win for a spec that does not auto-approve the toggled tool (element
mounts, pair carried, session runs minus the tool).
Tests
test/test_native_skill_projection_sources.py: the matcher's semantics(whole-server / exact / glob / non-match), the P0 regression (withheld, not
carried), the preserved Let a kirocrew session run with a kirocrew-core tool toggle expressed instead of refusing it (follow-up to #14078) #14125 carry, and the projection's matching verdict.
test/test_session_token_identity.py: updated the control-planeidentity/retry tests to the carry contract (a toggle with no auto-approve now
rides the gate rather than withholding), and fixed a caller for
_unpooled_control_planes' tuple return — gaps the fork PR left.Local gate: flake8 / isort / mypy clean on the changed modules; the backend
tests directly exercising this surface are green. The full cross-surface suite
is deferred to CI.
Supersedes #17547
Fixes #14125