Skip to content

fix(acp): carry a kirocrew-core disabledTools toggle on the session gate instead of refusing - #17858

Closed
chenmingwei23 wants to merge 1 commit into
kirodotdev:mainfrom
chenmingwei23:fix/14125-core-tool-toggle-failsafe
Closed

chenmingwei23 wants to merge 1 commit into
kirodotdev:mainfrom
chenmingwei23:fix/14125-core-tool-toggle-failsafe

Conversation

@chenmingwei23

Copy link
Copy Markdown
Contributor

Why this change

Disabling one kirocrew-core tool from the dashboard MCP tab should cost one
tool, 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
disabledTools toggle, so after #14078 every new default-agent session was
refused 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 #17547
found that fix fail-open on the kiro backend (bolichen97, P0, upheld):
spec_denied_tools is checked only on session/request_permission, but kiro-cli
auto-approves @kirocrew-core through the agent spec's allowedTools
(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:

  • A disabledTools pair is carried on the gate only where the backend provably
    prompts
    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 the
    session runs minus that one tool and keeps skill_search.
  • When any disabled tool on a control-plane server IS auto-approved (a
    whole-server @kirocrew-core entry, 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() reads allowedTools with kiro-cli's own
    matching (@server whole-server, @server/tool exact, @server/<glob>), from
    the SAME spec the mount already judges.
  • The skill-projection reader applies the identical gate, so it never promises a
    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_carried
in test/test_native_skill_projection_sources.py:

  • With a spec that whole-server auto-approves @kirocrew-core and a
    disabledTools: ["learn_add"] toggle, the carry-everything behaviour mounts the
    element and carries the pair — a fail-open (assert 'kirocrew-core' in {}
    fails on that head, matching the reviewer's "Fails on this head").
  • With the fix the element is withheld (mount.withheld contains
    kirocrew-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_carries pins 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-plane
    identity/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

…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
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Superseded by #17859 (same upstream branch so CodeBuild runners can see it). Keeping the fork branch.

@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let a kirocrew session run with a kirocrew-core tool toggle expressed instead of refusing it (follow-up to #14078)

1 participant