Skip to content

feat: carry a crewmate's template policy onto its worker (#28501) - #29378

Merged
buluoray merged 1 commit into
release/0.12.0from
crew/slack/fwd-28501-0.12
Nov 4, 2026
Merged

buluoray merged 1 commit into
release/0.12.0from
crew/slack/fwd-28501-0.12

Conversation

@buluoray

@buluoray buluoray commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring #28501 to release/0.12.0 so a crewmate on an insider build can take abilities from an agent that sets hooks, permission rules or tool settings, instead of being refused with template_restrictions_uncarried and left without that agent's tools.

On release/0.12.0, Add abilities refuses any agent that sets hooks, permissions or toolsSettings, because the crewmate's worker keeps none of them (mate_worker_kit.py). Crewmates the upgrade moved off such an agent lost its tools and cannot get them back (#26881). Users have reported this on 0.12 insider builds.

Why it matters

Crewmates ship in 0.12. Without this pick, every 0.12 user whose crewmate was built on an agent with hooks, deny rules, or path or command limits is stuck without that agent's tools, and the next RC ships the refusal that main has already fixed.

Not a goal

What changed (motivation → approach → change)

git cherry-pick -x of main commit 0354d5f7d8f426a6b800efc83283b0cb6e08c023 (#28501) onto origin/release/0.12.0 @ c8f4728c78. Same 36 files, +1680 -93, as on main.

Before picking, I checked for dependencies on main PRs that are not on release/0.12.0. Every symbol the change imports exists on the release branch (the only ones that do not are in files this change adds), and a git merge-tree simulation showed one conflict only.

Conflict: src/kiro_crew/docs/agent-spec-fields.md, the hooks table row. Main's version of that row also carries a sentence about the pi backend from a different PR. Resolution: keep the release branch's row and add only this change's sentence ("A crewmate's worker is read as its session's merged spec ..."). No code conflicted.

What #28501 does (unchanged here):

  • New mate_spec_policy.py layers a template's hooks, permission rules and tool settings onto the crewmate's worker exactly, and refuses by name (SpecPolicyUncarried) anything that cannot land exactly.
  • worker_additions / merge_worker_spec carry the crewmate file's policy onto the worker.
  • Crew-fired hooks on KAS read the worker session's merged spec through mate_worker.mate_service_scope_spec.
  • A worker off KAS whose crewmate file sets these fields is refused at start, naming the fields (acp/session_mcp_crewmate.py).
  • The kit copy previews each carried entry and refuses with template_restrictions_uncarried or template_policy_backend_unsupported only when a field cannot be applied; the dashboard message names the field.
  • Owner decision: docs/decisions/2026-11-02-a-crewmates-worker-carries-its-template-policy.md. Specs: crew-mode.md, agent-spec-fields.md.

Backwards compatibility

Compatible: every template accepted before is still accepted with the same file written; a template that was refused for hooks, permissions or tool settings is now accepted on KAS or refused with a narrower, named reason. The crewmate's chat is unchanged.

mate_config_migration.py changes how restrictions are compared. Readers on release/0.12.0:

Reader: src/kiro_crew/mate_worker_kit.py:_plan -- crew page -- calls uncarried_restrictions, which now returns only fields that cannot land exactly; test_mate_spec_policy.py::test_a_template_setting_the_worker_base_sets_differently_is_refused_by_name
Reader: src/kiro_crew/mate_config_migration.py:plan_move -- release -- startup migration; the file it writes carries no policy, so differences reports the same losses as before; test_mate_config_migration.py
Reader: src/kiro_crew/mate_config_migration.py:dry_run -- release -- default-template file path, same differences call; test_mate_config_migration.py
Reader: src/kiro_crew/mate_config_migration.py:dropped_restrictions -- release -- iterates toolsSettings keys, which per-tool entries still yield one by one; test_mate_upgrade_notice.py
Reader: src/kiro_crew/mate_config_migration.py:_fallback_keeping_limits -- release -- unreadable-agent fallback, same differences call; test_mate_migration_real_kirocrew.py

Tests

Proof: not provable -- other: a pick identical to main's code; its tests and mutation checks ran on #28501

  • test_mate_spec_policy.py (61 tests, added by feat: carry a crewmate's template policy onto its worker #28501) plus every test/ file matching mate, member, crewmate, agent_spec, harness, spec_hook, session_mcp, kas_auto_approve, kas_tool, kas_spec and worker_kit (207 files): 7048 passed, 21 skipped, 3 failed. The 3 failures (test_acp_harness_contract.py::test_a_missing_self_served_binary_names_its_install_command[copilot], test_auto_improvement_members.py::test_assignments_build_real_context_from_only_their_private_store, test_harness_parity.py::test_is_kiro_cli_is_positive) fail the same way on an untouched release/0.12.0 checkout on the same host, so they come from the host, not this pick.
  • Related set, single-process (-n0 -x, 7 sequential batches over the 131 test/ files that touch a changed module or spec): 6295 passed, 20 skipped, 1 failed. The failure, test_harness_parity.py::test_is_kiro_cli_is_positive, fails the same way on an untouched release/0.12.0 checkout on the same host.
  • Frontend: workerKitErrors.test.ts 14 passed; tsc -b clean.
  • flake8, isort, black (py310) on the 15 touched Python files; mypy src/kiro_crew; check_file_line_cap, check_comment_history, check_brand_name, check_harness_parity against origin/release/0.12.0: all pass.

Manual verification

Still required, as on #28501: add an agent with a preToolUse hook and a deny rule to a crewmate on KAS, then confirm the hook fires and the deny holds in a worker it opens.

Screenshots / video

The frontend diff is identical to #28501's, so its screenshots apply unchanged:

Add abilities preview with the hooks, permissions and tool settings group

Refusal naming the fields a non-KAS worker cannot apply

Related Issues

Forward-port of #28501 to release/0.12.0. Part of #26881.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

Adding an agent's abilities to a crewmate refused any agent that set
hooks, permissions or toolsSettings, because the worker kept none of
them. Crewmates the upgrade moved off such an agent could not get its
tools back.

The kit copy now layers the agent's hooks, permission rules and tool
settings into the crewmate's file exactly, and the worker merge carries
them, never wider than the agent declares. Crew fires the worker
session's merged hooks on KAS. A field that cannot land exactly, or a
crewmate whose worker is off KAS, is refused with an error naming the
field. The crewmate's chat keeps running the stock conductor spec.

Closes #26881

(cherry picked from commit 0354d5f)

Conflict: src/kiro_crew/docs/agent-spec-fields.md (hooks row). Kept
the release text and added only this change's crewmate sentence.
@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 3, 2026 23:31
@buluoray
buluoray requested review from CrysisDeu and removed request for a team November 3, 2026 23:31
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

Design-level review of 5ee9870ba5556234bcccb0e135818e6c6bb952d0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Cannot evaluate: no screenshot of this revision's new "Hooks, permissions and tool settings (worker)" group in the Add-abilities preview, or of the field-naming refusal messages.

Blockers

Missing rendered evidence for a reshaped Add-abilities preview
Trigger: workerKitGroups.ts adds "{ key: 'policy', sections: ['hooks', 'permissions', 'toolsSettings'], heading: () => i18nT('crewWorkerKit.group_policy') }", and workerKitErrors.ts adds two refusal sentences that put a server-supplied {{fields}} detail into the text.
Outcome: the evidence list shows 0 images and 0 recordings. The description's images say they show #28501's state, which does not count as evidence of this revision. Without one, nobody can check how the new group, its heading or the named-field errors look on the release branch's crew page before an RC ships them.
Fix: attach a capture of the preview with a policy group, and of one named refusal, taken on this branch (release/0.12.0 plus this pick).
Clears when: the description carries a github.com/user-attachments screenshot or recording of this revision's Add-abilities preview showing the "policy" group and a template_restrictions_uncarried/template_policy_backend_unsupported message.

Notes

  • The new start-time refusal for off-KAS workers (acp/session_mcp_crewmate.py) refuses any crewmate file that already carries these fields from a hand edit. The add path refused them before, so few files should have them, but the ## Backwards compatibility section doesn't list this reader.

[DESIGN-REVIEWED] 5ee9870

Description read

[DESCRIPTION-READ] b00b7aa2904bd351718ceb0ad2947c10a61307dc34d2c656864cded7b3f37d78

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

UX-level review of 5ee9870ba5556234bcccb0e135818e6c6bb952d0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

cannot evaluate: missing screenshots. The PR adds a new group to the Add abilities preview and two new refusal messages, and attaches or commits no image, so the blind read was not performed.

Evidence gaps

  • New preview group: the "Hooks, permissions and tool settings (worker)" group (crewWorkerKit.group_policy) has no screenshot. Close it with a screenshot of the Add abilities preview after picking an agent that sets a preToolUse hook and a deny rule.
  • Named refusal: error_template_restrictions_uncarried_named ("That agent's {{fields}} can't be kept exactly by this crewmate…") has no screenshot. Close it with a screenshot of that refusal as it renders on the crew page, with a real fields value filled in.
  • Backend refusal: error_template_policy_backend ("…which this crewmate's backend can't apply. Run the crewmate on Kiro Agent…") has no screenshot. Close it with a screenshot of that refusal shown for a crewmate that is not on KAS.

Notes

  • {{fields}} is filled straight from the server's detail. If that holds the raw names hooks / permissions / toolsSettings, users see the code identifier "toolsSettings". Map each name to the words the heading uses ("tool settings").
  • In "(worker)", the heading leans on internal vocabulary. Name the group after what it does for the crewmate, for example "Hooks, permissions and tool settings", and drop the parenthetical.

[UX-REVIEWED] 5ee9870

Description read

[DESCRIPTION-READ] 0f8b9b5da53493bfe6f79d77d0164aa8fa5015d8eb8b10872aab965d26a13225

That sha256 names everything this verdict read: the PR description, plus the 3 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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 5ee9870ba5556234bcccb0e135818e6c6bb952d0 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. This is a straight cherry-pick of a fix already merged on main; each item removes the #26881 refusal or keeps a carried deny rule from being dropped without notice.

Notes

  • Item 5 — undeclared harm path: a worker off KAS whose crewmate file was hand-edited to set hooks/permissions/toolsSettings used to start with those fields silently ignored. It now refuses at session start (refuse_spec_policy=not spec_policy_honoured). The cause is in this repo (applies_spec_policy returns backend == ACP_BACKEND_KAS), so this is not an unverified platform premise. But the description's "every template accepted before is still accepted" does not cover hand-edited files.

What this change ships

Inventory (7 items) — 6 justified

Intent: let a 0.12 crewmate take abilities from an agent that sets hooks, permission rules or tool settings, instead of being refused. FIX (backport of #28501, part of #26881).

  1. Add abilities now accepts agents with hooks, permissions or toolsSettings on KAS, and copies each one onto the worker — justified
  2. The kit copy refuses only the fields that cannot land exactly, and names them (template_restrictions_uncarried / template_policy_backend_unsupported) — justified
  3. The dashboard error message names the refused field, translated into every locale — justified
  4. Crew-fired hooks on KAS read the worker session's merged spec — justified
  5. A worker off KAS whose crewmate file sets these fields is now refused at start — undeclared for hand-edited files
  6. mate_config_migration compares restrictions per entry, and the Reader sweep is listed — justified
  7. A decision record and spec rows for the carried policy — justified

[FIRST-PRINCIPLES-REVIEWED] 5ee9870

Description read

[DESCRIPTION-READ] dcac225d761b9bfde6451e404cc46647d607b5cd5e479b4d4f1fd16f49edf3c6

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5ee9870ba5556234bcccb0e135818e6c6bb952d0 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5ee9870

Verdict parsed from the review's SHA-scoped output markers for commit 5ee9870ba5556234bcccb0e135818e6c6bb952d0.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5ee9870ba5556234bcccb0e135818e6c6bb952d0 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ human override accepted

Human judgment by @buluoray overrides the GPT 6.1 finding for 5ee9870ba5556234bcccb0e135818e6c6bb952d0; the recorded reason is authoritative for this commit.

[GPT-OVERRIDE] 5ee9870

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:
/ai-review override gpt 5ee9870ba5556234bcccb0e135818e6c6bb952d0 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 3, 2026
@buluoray
buluoray force-pushed the crew/slack/fwd-28501-0.12 branch from e356a72 to 5ee9870 Compare November 4, 2026 00:08
@buluoray

buluoray commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author
  • Preflight rejects restrictions already held by the worker base

Rebutted: the refusal is the recorded behaviour. docs/decisions/2026-11-02-a-crewmates-worker-carries-its-template-policy.md allows only deniedCommands/allowedCommands (shell), deniedPaths (read/write) and web_fetch.blocked, and says every other toolsSettings key, in any form, is refused with its name.
fs_write allowedPaths and fallbackAction are outside that allowlist, so uncarried_restrictions naming them is the decision working, held by the worker base or not.
Skipping held entries would accept such a template silently while KAS still does not apply that write fence on the worker. A fix was tried (#29392) and withdrawn after the Opus lane flagged this conflict.

@buluoray

buluoray commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 5ee9870 false-positive: docs/decisions/2026-11-02-a-crewmates-worker-carries-its-template-policy.md refuses every toolsSettings key outside its allowlist by name; fs_write allowedPaths/fallbackAction are outside it, so refusing them even when the worker base holds them is the decided behaviour.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Human judgment recorded

@buluoray recorded a false-positive release (class false-positive) for the gpt AI finding on 5ee9870ba5556234bcccb0e135818e6c6bb952d0.

docs/decisions/2026-11-02-a-crewmates-worker-carries-its-template-policy.md refuses every toolsSettings key outside its allowlist by name; fs_write allowedPaths/fallbackAction are outside it, so refusing them even when the worker base holds them is the decided behaviour.

This decision applies only to this commit. A new push requires a new judgment.

@buluoray

buluoray commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head: 5ee9870

  • What rule changed: A crewmate's worker now carries its template's hooks, permission rules and toolsSettings onto its session spec (mate_spec_policy.py) instead of refusing every template that sets them. Anything that cannot land exactly is still refused by name (SpecPolicyUncarried / template_restrictions_uncarried).
  • Before -> after: Before, Add abilities refused any agent with hooks, permissions or toolsSettings, so the worker ran without that agent's tools. After, on KAS the worker gets the template's hooks and deny/allow rules applied; off KAS, or for a key outside the allowlist, the template is still refused, naming the field.
  • Worst case if wrong: A template restriction is silently not applied to the worker, so a worker runs a tool the template meant to deny or limit. The design refuses rather than drops any field it cannot apply exactly, which bounds this.
  • Evidence checked: Code and tests are a cherry-pick identical to main feat: carry a crewmate's template policy onto its worker #28501 (0354d5f), where its tests and mutation checks ran. On this head: test_mate_spec_policy.py (61) plus 207 related test files, 7048 passed, 3 failed that fail the same way on clean release/0.12.0. The GPT finding on fs_write allowedPaths/fallbackAction matches the decision doc's allowlist and was overridden as a false positive. The manual KAS hook/deny check has not been run.
  • No regression:
    • Tools still work: Templates accepted before are accepted with the same file written; the crewmate chat itself is unchanged; workerKitErrors.test.ts and the kit tests pass.
    • Backward compatible: Yes; previously refused templates are now accepted on KAS or refused with a narrower named reason. Migration readers of uncarried_restrictions are listed in the PR body with their tests.
    • Existing tests: All related existing tests pass except 3 host-only failures that also fail on an untouched release/0.12.0 checkout.
  • How to undo: Revert the single cherry-pick commit on release/0.12.0; the worker returns to refusing templates that set hooks, permissions or toolsSettings.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 4, 2026
@buluoray
buluoray merged commit cd07e9e into release/0.12.0 Nov 4, 2026
45 of 64 checks passed
@buluoray
buluoray deleted the crew/slack/fwd-28501-0.12 branch November 4, 2026 02:31
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant