Repository navigation
feat(mate): leave out a grant a bot's worker already holds on add - #33178
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the change only accepts adds that main refuses. A key is left out only when the merged worker already grants it, and the worker merge at session start still refuses either key in a file. Notes
[DESIGN-REVIEWED] 68ac577 Description read[DESCRIPTION-READ] 353edd785d95fe75abe847b41c51e282e942ff17fd90677690686d6b14972c2c 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The Notes
What this change shipsInventory (6 items) — 5 justifiedIntent: let a Bot owner add abilities from an agent like Atlas instead of having the whole add refused over a tool setting that grants nothing the worker lacks. A FIX, though the title types it
[FIRST-PRINCIPLES-REVIEWED] 68ac577 Description read[DESCRIPTION-READ] fd38f4df4efdd0268df82cc2cafdb9728f6ebde044f5b2ab1d9f3014c8b16832 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ human override acceptedReviewed Human judgment by @bolichen97 overrides the Opus 5.5 finding for [OPUS-OVERRIDE] 68ac577 Verdict recorded from an authorized human decision for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ human override acceptedHuman judgment by @bolichen97 overrides the GPT 6.1 finding for [GPT-OVERRIDE] 68ac577 This comment is updated in place on each push. The model was not re-run because an authorized human decision supersedes it. False positive or not applicable? A repository writer can comment: |
7ba0f6e to
8da2047
Compare
|
Rebased: main moved in docs/decisions/README.md since this head was built (a2a0da4 -> 2da9ec8); CI re-running. The rebase clears a conflict in the [operator: bolichen97] |
|
self-added: no
[operator: bolichen97] |
|
self-added: no
[operator: bolichen97] |
8da2047 to
dd06f3b
Compare
|
Rebased: main moved in docs/decisions/README.md since this head was built (2da9ec8 -> 3cd4522); CI re-running. The rebase clears a second conflict in the [operator: bolichen97] |
|
self-added: no
[operator: bolichen97] |
dd06f3b to
2f19c42
Compare
|
self-added: no
|
Add abilities refused a whole agent (its servers, skills and prompt)
when its toolsSettings held a grant-only key the Bot's worker already
grants. Atlas is the case: its only blocker is web_fetch.trusted, a key
KAS never applies, while the worker base already lists web_fetch in its
allowedTools.
At kit time only, before the restriction gates, a grant-only key is now
left out of the template's copy when the Bot's worker already grants
what it grants, and the preview lists it as a skipped toolsSettings row
("Already has", id <tool>.<key>): web_fetch.trusted when the worker's
own allowedTools derive a bare web_fetch allow, and
subagent.trustedAgents when every entry is a literal name a carried
subagent allow (no exclude) lists. The proof reads the worker the Bot
runs: the base and the agent merged, less the Bot file's excludedTools
and the approvals its owner revoked. Patterns, uncovered names, a
withheld, excluded or revoked web_fetch, an unreadable revocation
record, a tool written under two kiro-cli spellings and a template
refused for anything else stay refused by name. The worker merge is
unchanged, so a hand-edited Bot file holding either key still fails
closed at session start.
The superseding decision entry, its README row and the crew-mode spec
land in this commit.
2f19c42 to
68ac577
Compare
|
self-added: no
|
|
self-added: no
|
|
Maintainer decision (Bolin Chen, bolichen97, Kiro Crew maintainer): I accept superseding part of |
|
/ai-review override gpt 68ac577 owner-decision: agent: maintainer Bolin Chen accepted superseding the 2026-11-02 template-policy entry for grants the worker already holds (worker-kit memo option 2); decision: #33178 (comment) |
|
/ai-review override fable 68ac577 owner-decision: agent: maintainer Bolin Chen accepted superseding the 2026-11-02 template-policy entry for grants the worker already holds (worker-kit memo option 2); decision: #33178 (comment) |
Human judgment recorded@bolichen97 recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
Human judgment recorded@bolichen97 recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
Problem / Motivation
Goal: A Bot owner can add abilities from an agent such as Atlas whose tool settings grant only what the Bot's worker already has, and the worker still behaves exactly as the agent declares.
Add abilities refuses the whole agent, with its MCP servers, skills, prompt, hooks and permissions, when its
toolsSettingsholds a grant-only key. The preview answers 409template_restrictions_uncarriedwith detailtoolsSettings.web_fetch.trusted. For Atlas that key is the only blocker, and it grants nothing the worker lacks: the worker already listsweb_fetchin itsallowedTools, the agent carries a bareweb_fetchallow, and KAS never applies the key.Why it matters
An owner who picks Atlas under Add abilities gets nothing and is told to choose another agent. The only workaround is a hand-edited copy of the agent, which goes stale on every update of the agent. Every new agent template with such a key hits the same refusal.
Not a goal
autoAllowReadonly,allowedPaths, or atrustedAgentslist no carried allow covers. That is a separate decision.allowedCommandsentries Kiro Crew cannot parse,autoAllowReadonly, oravailableAgents(fix(mate): carry a template's subagent.availableAgents onto a Bot's worker #31292).What changed (motivation → approach → change)
Add abilities from Atlas succeeds. A grant-only tool setting that the Bot's worker already grants is left out of the agent's copy, and the preview lists it as a
skippedtoolsSettingsrow with the existing "Already has" label (id<tool>.<key>, for Atlasweb_fetch.trusted). The worker behaves exactly as the agent declares, so no prompt appears or disappears.web_fetch.trusted(orwebFetch)allowedToolsderive a bareweb_fetchallow (allow_granted_by_spec)web_fetch, the ceiling withholds it, the Bot's file excludes it or its owner revoked itsubagent.trustedAgents(oruse_subagent)subagentallow with noexcludelists in itsmatchaskrule, an empty listLeaving the key out was chosen over carrying it because the worker already holds the grant, so nothing about what runs unasked changes, and over a new "not carried" row because that needs a new row kind in every locale. The proofs live in one table,
HELD_GRANT_SETTINGSinsrc/kiro_crew/mate_spec_policy.py._without_held_grantsinsrc/kiro_crew/mate_worker_kit.pyruns them before the restriction gates, against the worker the Bot runs once the add lands: the base and the agent (less those keys) merged, less the tools the Bot's file excludes and the approvals its owner revoked. Nothing is left out when the base or the revoked approvals cannot be read, when that merge refuses something else, or when either tool is written under two kiro-cli spellings; the refusal then names every key, as on main.The leave-out runs at Add abilities time only. The worker merge at session start is unchanged, so a hand-edited Bot file holding either key still fails closed.
This is the maintainer's decision (Bolin Chen, 2026-11-07, set out in #32958). A new entry in
docs/decisions/records it, with its README row, and supersedes the 2026-11-02 template-policy entry in part;docs/system-specs/modules/crew-mode.mddescribes the leave-out in its Add abilities paragraph. There is no frontend or locale change.Backwards compatibility
Compatible: only adds that main refuses are accepted. An add refused for any other reason is still refused, and the worker merge refuses the same keys as on main. A script that expects the 409 for an agent like Atlas gets a 200.
Removes nothing: no key, record, path or public function is taken away, and a key left out of the copy is one the worker already grants.
Tests
New file
test/test_mate_worker_kit_held_grants.py, 21 cases.web_fetchandwebFetchspellings previews a(toolsSettings, <tool>.trusted, skipped)row, adds notoolsSettingsrow, writes notoolsSettings, keeps the bareweb_fetchallow, and the worker merges from the written file withweb_fetchallowed. The same row appears when the owner revoked another tool's approval. Ablockedlist besidetrustedis carried as an added row whiletrustedis skipped.trustedAgentsthat a carriedsubagentallow covers, undersubagentanduse_subagent, is skipped and notoolsSettingsis written.web_fetch.trustedstays refused with the exact detail when the worker base lacksweb_fetch, when the governance ceiling withholds it, when the owner revoked theweb_fetchapproval, when the Bot's own file excludesweb_fetch, and when the revoked-approvals record cannot be read; the Bot file is untouched. When an agent is refused for an unenforceabledeniedCommandstoo, the refusal still namesweb_fetch.trusted. A tool written under two kiro-cli spellings stays refused, naming the spelling kiro-cli drops and the key, and the Bot file is untouched.trustedAgentsstays refused for a name the allow lacks, a pattern, an allow withexclude, anaskrule and an empty list.merge_worker_specstill raisesSpecPolicyUncarriedfor a hand-edited file holding either key.Proof: PROVEN test/test_mate_worker_kit_held_grants.py::test_a_web_fetch_trust_the_worker_already_grants_is_left_out_as_already_has[web_fetch], test/test_mate_worker_kit_held_grants.py::test_a_web_fetch_trust_the_worker_already_grants_is_left_out_as_already_has[webFetch], test/test_mate_worker_kit_held_grants.py::test_a_block_beside_the_trust_is_still_carried, test/test_mate_worker_kit_held_grants.py::test_an_approval_revoked_on_another_tool_still_leaves_the_trust_out, test/test_mate_worker_kit_held_grants.py::test_trusted_agents_a_carried_allow_names_are_left_out_as_already_has[subagent] (head 4d06c0a54215)
Every run below was on a Linux dev host, on tree a480eac61de1 (head 4d06c0a54215 on main 62ac53a); no test, build or gate ran on the author's machine.
test_mate_worker_kit,test_mate_spec_policy,test_mate_config_migrationandtest_check_decisions_history_selftest(PYTHONPATH=src python -m pytest <files> -n0 -p no:cacheprovider): 241 passed.-n0, and 10 at-n 4 --dist loadgroup --max-worker-restart=2besidetest_mate_worker_kitandtest_mate_spec_policy(181 passed each run), all green; a shuffled order with seed 27040, 21 passed.gates[]entry of the resolved profile other than the scoped backend and frontend suites and the Electron tests, plustest/test_flake_pattern_ratchet.pyandsemgrep scan --config semgrep/ --baseline-commit <merge-base> --error: 61 commands, all exit 0.jscpdran after the website build, never beside it: run together, it reads the build's temporary output directory while that directory is being written.subagent.trustedAgentstwin, throughmate_worker_kit.previewin a scratch home with the real governance ceiling): main refuses both withtemplate_restrictions_uncarriedand detailtoolsSettings.web_fetch.trustedortoolsSettings.subagent.trustedAgents; this head previews each as onetoolsSettingsrow(web_fetch.trusted, skipped)or(subagent.trustedAgents, skipped).Rebased onto main after review; patch unchanged (
git range-diffshows the commit identical except thedocs/decisions/README.mdrow's context: main's new 2026-11-08 row from #33003 is kept as it is, and this PR's row follows it). Re-run on a DevSpace on head 68ac577 (tree 18a32df75688, on main 1e3b894), every command exit 0 unless stated:test_mate_worker_kit,test_mate_spec_policy,test_mate_config_migrationandtest_check_decisions_history_selftest(PYTHONPATH=src python -m pytest <files> -n0 -p no:cacheprovider): 243 passed. The new file run against main's production code: the 6 behaviour cases fail and the 15 pins pass, exit 1.repro.sh base|fix: a realkirocrew gatewayin a scratch home with the real governance ceiling, the Atlas agent file copied into its agents folder beside the issue's step 1 spec and asubagent.trustedAgentstwin, then the dashboard's Add abilities preview and apply calls over HTTP): main exit 1, all three previews answer 409template_restrictions_uncarriednamingtoolsSettings.web_fetch.trustedortoolsSettings.subagent.trustedAgents; this head exit 0, each preview shows onetoolsSettingsrow(web_fetch.trusted, skipped)or(subagent.trustedAgents, skipped), the apply writes notoolsSettingsto the Bot's file, its worker still runsweb_fetchunasked, and a hand-edited file holdingweb_fetch.trustedis still refused at session start.check_black_formatting.py,check_subprocess_encoding.py, isort, flake8,mypy --platform linux, the comment-history, brand-name, harness-parity, decision-ledger-history (with its self-test) and file-line-cap checks, docs-lint,black --checkon the touched Python files and the flake-pattern ratchet.Manual verification
The #32958 repro above ran on this head through the Python API, not the dashboard. Still required: picking Atlas under a Bot's Abilities > Add abilities in the dashboard and seeing the "Already has" row, which the existing
skippedrow renders.Screenshots / video
N/A: the diff changes no frontend file. The preview's existing
skippedkind and its "Already has" label render the new row.Related Issues
Fixes #32958
This head merges cleanly (
git merge-tree) with the open #31292 and #31241, which edit the same files, with each and with both together. Once #31292 lands, its 2026-11-06 entry, which keepstrustedAgentsrefused until decided separately, can join this entry'sSupersedes:line: this entry decides only the case a carried allow already covers.The entry carries a
Supersedes:line, so therecorded-decisions-are-not-regressionsrule blocks this PR by design (decisions README rule 3). A maintainer's override of that rule is what lets it land, and it covers the entry and the code it authorizes together. The entry's Evidence links #32958, the issue the maintainer opened to set out this decision, as the on-record artifact decisions README rule 4 asks for.Sibling sweep
N/A: a
featPR. The keys left out are one table,HELD_GRANT_SETTINGS, so there is no second site.Pattern harvest
Not generalizable: the two keys and their proofs follow how KAS projects
web_fetchandsubagentgrants, and a further key is one more entry inHELD_GRANT_SETTINGS, not a new site.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.