Repository navigation
fix(agents): name toolsSettings aliases as the spec wrote them - #32649
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix sits at the root cause (names read off the folded copy). It shares one rename rule with Notes
[DESIGN-REVIEWED] 7cb18a5 Description read[DESCRIPTION-READ] dbc45f46989fbc2b0882495d5ab3907a448679120f2c329ce39f4b6fe004cb46 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 Nothing blocks: this fixes linked issue #31663 where the names come from, the folded copy. Every site that builds a notice now uses one shared helper, and the docs are part of the stated Goal. What this change shipsInventory (6 items) — 6 justifiedIntent: when a spec uses an alias spelling (such as
[FIRST-PRINCIPLES-REVIEWED] 7cb18a5 Description read[DESCRIPTION-READ] 68f3b62962ca0a2f9ae7ac41eadc1ea39f87cb9ab2ef4afc52a9280d86041182 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Pull request was closed
12829cd to
ad01003
Compare
|
[operator: bolichen97] Rebased: main moved since this head ran; CI re-running. The Windows shard 2 red (test/test_crew_log_writer_lanes.py::test_a_rebuilt_writer_does_not_write_beside_a_retired_writers_stuck_lane, flush returned False on the old wait) ran on a merge base older than #32813, which fixed that test on main; the new base carries it and #32606. Same patch, no code change. Local scoped gate (flake8, isort, mypy, related tests including that file: 565 passed) and local GPT and Opus reviews passed with no findings. |
ad01003 to
8f4f006
Compare
|
self-added: no
|
canonical_tools_settings files every sub-agent spelling under `subagent`, and other unknown alias spellings under the key Crew reads (`executeBash` under `shell`). The unapplied-settings notice built its names from that folded form, so a spec that wrote only `use_subagent` was told about `toolsSettings.subagent.*`, a key the author cannot find in the file. Add `as_authored`, which puts the kept spelling back on a name read off the folded form, and use it wherever a notice names an entry: the session-start notice on every backend (KAS included) and the KAS tool view the worker policy reads. Dropped duplicates were already named as written and are unchanged. Document in agent-spec-fields.md and the subagent spec every sub-agent spelling Crew reads and that the first one in kiro-cli's order wins whole. Co-authored-by: Kellen Jia <6888461+keyejia@users.noreply.github.com>
8f4f006 to
7cb18a5
Compare
|
[operator: bolichen97] Rebased: main moved in src/kiro_crew/docs/agent-spec-fields.md (a new hooks-row sentence beside this PR's toolsSettings-row edit) and the PR went CONFLICTING; resolved keep-both (main's hooks row, this PR's toolsSettings row), CI re-running. Same patch otherwise; scoped gate and prove.py re-run on the new head. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved. On this head the review checked four things. The fold in canonical_tools_settings behaves exactly as before, so the spawn, side turn and allowlist gates that read it are unchanged. as_authored maps every alias group back to the one key the spec wrote. No caller parses these notice strings back into keys. Reverting each new call site, one at a time, makes 7 of the 9 fail a test.
Done well: the rename rule now lives in one helper, _filed_under, which both the fold and the reverse lookup use, so the two cannot drift apart.
Optional:
- Two sites have no test: the withheld shell
allowedCommandsname (kas_agents.py:305) and the non-dict entry next to a gate-applied allowlist (tools_settings_reach.py:67). AnexecuteBash.allowedCommandscase and afsRead: Truerow would pin them. - Whichever of this PR and #31892 merges second must also send the
inexactpaths from #31892 throughas_authored. Otherwiseshell.allowedCommandscomes back in the worker refusal. - After this merges, close #31742 as superseded by this PR.
Supersedes #31742 (rebased onto latest main; resolved src/kiro_crew/docs/agent-spec-fields.md). Original author: @keyejia.
Problem / Motivation
Goal: A spec that writes a
toolsSettingsalias such asuse_subagentgets an unapplied-settings notice naming that exact key, and the agent spec reference lists every sub-agent spelling Crew reads and which one wins.Since #30193,
canonical_tools_settingsfiles every sub-agent spelling undersubagent. The session-start notice builds its names from that folded copy, so a spec that wrote onlytoolsSettings.use_subagent.trustedAgentsis told abouttoolsSettings.subagent.trustedAgents, a key the author cannot find in the file.agent-spec-fields.mdalso says onlytoolsSettings.subagent.availableAgentsis read.Why it matters
The notice exists so an author can find what goes unapplied. A name that is not in their spec sends them looking for a key they never wrote, and the reference page hides that four other spellings are read too, and that only one of them counts when several are set.
Not a goal
What changed (motivation → approach → change)
Every notice now names a kept alias the way the spec spelled it. Crew still reads the same one key per alias group.
use_subagent: {trustedAgents}→ notice namestoolsSettings.subagent.trustedAgentstoolsSettings.use_subagent.trustedAgentscrew/agentCrew/executeBash→ named assubagent/shellsubagentalone, or besideuse_subagentsubagentwins whole,toolsSettings.use_subagentis named as droppedThe root cause is one place: names were read off the folded copy.
platform/tools_settings_aliases.pygainsas_authored, which maps a folded key back to the spelling the spec kept, sharing the rename rule withcanonical_tools_settingsthrough_filed_under. It is applied wherever a notice names an entry read off the folded copy:tools_settings_reach.tools_settings_unapplied(every non-KAS backend), the KAS branch ofkas_agents.spec_keys_without_carrier, andkas_tool_view.tools_settings_unenforced(the worker policy's refusal names). Dropped duplicates were already named as written.Docs:
src/kiro_crew/docs/agent-spec-fields.md(thetoolsSettingsrow) anddocs/system-specs/modules/subagent.md(§ Parent agent spec allowlist) list the five sub-agent spellings in kiro-cli's precedence,crew,agent_crew,agentCrew,subagent,use_subagent, and say the first one set wins whole.Backwards compatibility
Compatible: only the wording of notices and worker-policy refusals changes, and only for a spec that uses an alias spelling; every gate reads the same key as before.
Removes nothing: no key, path, rule or function is removed; the notice names the same entries under the spec's own spelling.
Tests
Inputs that reach this code, and where each is covered:
subagentsubagent.trustedAgents,subagent.xuse_subagentuse_subagent.trustedAgents(both branches)use_subagent.trustedAgents,use_subagent.xcrew,agentCrew,executeBash)crew,executeBashagentCrew,executeBash.allowedCommandsfsWrite.allowedPathswith the write grant withheldfsWrite.allowedPathssubagent.*+ droppeduse_subagentNone,{})Proof: PROVEN test/test_kas_tools_settings_aliases.py::TestNotice::test_a_kept_alias_is_named_as_the_spec_wrote_it[settings1-named1], test/test_kas_tools_settings_aliases.py::TestNotice::test_a_kept_alias_is_named_as_the_spec_wrote_it[settings2-named2], test/test_kas_tools_settings_aliases.py::TestNotice::test_a_kept_alias_is_named_as_the_spec_wrote_it[settings5-named5], test/test_kas_tools_settings_aliases.py::TestNotice::test_withheld_write_paths_are_named_as_the_spec_wrote_them, test/test_tools_settings_notice.py::test_only_what_the_spawn_gate_does_not_read_is_named[settings9-named9] (head 7cb18a5)
Reverting the source by hand fails 13 of the new cases: every alias-spelling row and all six end-to-end backends. The
subagent-only and both-set rows pass before and after, as no-regression pins.Determinism: the 33 new and changed node ids passed 20 runs at
-n0, 10 runs at-n 4 --dist loadgroupbesidetest_kas_tools_settings.pyandtest_side_readonly_spec.py, and one shuffled order (seed 21604). Backend related set on this rebase (run_scoped_tests.py --surface backend): 6607 passed, 10 skipped, 1 failed:test_acp_harness_contract.py::test_a_missing_self_served_binary_names_its_install_command[copilot], which fails the same way onorigin/mainon this host.Manual verification
N/A — unit coverage sufficient: the names come from pure functions, and the end-to-end test drives the real session-start path with a spec file on disk.
Screenshots / video
N/A — no frontend file changed; the notice is a text row the backend builds.
Related Issues
Closes #31663
Sibling sweep
Swept: git grep -nE 'toolsSettings.{|toolsSettings.subagent' -- src/
Sibling: src/kiro_crew/agent_sdk/tools_settings_reach.py -- changed here
Sibling: src/kiro_crew/acp/kas_agents.py -- changed here
Sibling: src/kiro_crew/agent_sdk/kas_tool_view.py -- changed here
Sibling: src/kiro_crew/mate_spec_policy.py -- not affected -- its own names iterate the template's keys as written; the folded names it reads come from tools_settings_unenforced, changed here
Sibling: src/kiro_crew/dashboard/side_readonly_spec.py -- not affected -- names a key of the derived spec it writes in folded form, so that key is in that file, and only the operator log shows it
Sibling: src/kiro_crew/mcp_tools/spawn_parts/schemas.py -- not affected -- a tool hint the model reads, not a notice an author searches the spec for
Sibling: src/kiro_crew/mcp_tools/spawn_parts/listing.py -- not affected -- the same model-facing hint
Pattern harvest
Rule candidate: review-prompt
Pattern: a user-facing message names a key from a normalized copy of the user's input instead of the spelling the user wrote
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.