Repository navigation
fix(agent): gate generated spec permissions by CLI version - #12919
bolichen97 merged 1 commit into
Conversation
|
Intent: Ensure every generated conductor and worker agent spec is accepted by the installed |
|
Maintainer action requested: please approve the fork workflow runs for this head when GitHub presents the approval banner. The branch is locally green and exact-head GPT/Opus reviews found no blocking issues. |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify a version probe that fails once (cached [DESIGN-REVIEWED] 5108f56 |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS One sibling writer stays ungated: I grepped The defect has checkable provenance: the base What this change shipsInventory (5 items) — 5 justifiedIntent: FIX — stop generated conductor and worker specs carrying a
[FIRST-PRINCIPLES-REVIEWED] 5108f56 |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsThe candidate hinges on the As a standalone defect it also fails the bar. The refactor itself is correct: No findings. [OPUS-REVIEWED] 5108f56 |
e40dc30 to
949a130
Compare
|
Maintainer action requested for rebased head |
|
Current-head CI attribution: Backend Tests (3.12, shard 7) fails only on the new main ratchet tracked in #12939. I reproduced the exact node locally; it reports the same two |
949a130 to
5108f56
Compare
|
Maintainer action requested for healed-main head |
bolichen97
left a comment
There was a problem hiding this comment.
Approved after verified readiness: passed, PR Readiness success on this head, mergeable, no open change requests. [operator: bolichen97 batch review 2026-09-23]
…oo (#13070) #12919 made `_write_derived_permissions` "the one version gate every generated spec writer shares" and routed agent.py's five writers through it: a kiro-cli below SPEC_PERMISSIONS_MIN_VERSION, or one whose version cannot be established, gets no `permissions` block and any inherited value removed. `agent_capabilities._align_permissions` kept its own write. It is the sixth generated-spec writer -- `CapabilityService.put` and `publish` atomic_write the projected spec into the kiro agents directory and bind the member to it -- so on a below-floor or unknown release the fork funnel published exactly the file the gate exists to prevent. kiro-cli validates specs with serde `deny_unknown_fields`, so that release refuses the WHOLE file and drops every Crew MCP server with it, falling back to broader default grants. Two questions share that call site and only the second is the binary's. Whether the SOURCE block was hand-edited away from its derivation is a governance question about the template, so the `alternate_permissions_require_review` comparison stays unconditional; only the target write moves behind the gate. Both are pinned. Reuses the existing gate rather than adding a sixth spelling of the version check: `agent_capabilities` already imports private names from `kiro_crew.agent` function-locally on this path. `docs/agent-spec-fields.md` already states the rule this path now obeys ("Crew WRITES this ... only when the installed kiro-cli accepts the field"), and its `permissions` row is being rewritten by open #13014, so it is left untouched here. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
…-cli
`side_readonly_spec` publishes `~/.kiro/agents/<agent>--readonly.json` on
every side turn -- into the registry kiro-cli loads its selectable agents
from -- and rewrites the inherited KAS policy to an empty one:
if "permissions" in spec:
spec["permissions"] = {"rules": []}
It is a generated-spec writer like the five in `agent.py`, but it never
reached the shared version gate #12919 centralized. kiro-cli validates
specs with serde `deny_unknown_fields`, and it is the KEY's presence,
not its value, that a release below SPEC_PERMISSIONS_MIN_VERSION refuses
-- an empty policy is still a policy. So a base spec carrying a
`permissions` block, on a below-floor or unknown release, produced a
derived file that release refuses whole.
What is lost when it is refused is this module's entire reason to exist.
The derived spec is the side turn's read-only isolation: `allowedTools`
emptied, no `autoApprove`, no `toolsSettings` grants, no
`includeMcpJson`, no lifecycle hooks -- so that every call raises a
permission request the READ_ONLY gate judges instead of being approved
by the backend unattended.
Routed through `_write_derived_permissions`, which on an accepting
release derives `{"rules": []}` from the emptied grants -- byte-identical
to what this line wrote -- and on a refusing or unknown one removes the
inherited value. The `if "permissions" in spec` guard stays: the gate
decides whether the field may be CARRIED, not whether to add one, and
its mere presence is what makes KAS load a spec at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: iamwhatever <12429733+iamwhatever@users.noreply.github.com>
…-cli (#16086) `side_readonly_spec` publishes `~/.kiro/agents/<agent>--readonly.json` on every side turn -- into the registry kiro-cli loads its selectable agents from -- and rewrites the inherited KAS policy to an empty one: if "permissions" in spec: spec["permissions"] = {"rules": []} It is a generated-spec writer like the five in `agent.py`, but it never reached the shared version gate #12919 centralized. kiro-cli validates specs with serde `deny_unknown_fields`, and it is the KEY's presence, not its value, that a release below SPEC_PERMISSIONS_MIN_VERSION refuses -- an empty policy is still a policy. So a base spec carrying a `permissions` block, on a below-floor or unknown release, produced a derived file that release refuses whole. What is lost when it is refused is this module's entire reason to exist. The derived spec is the side turn's read-only isolation: `allowedTools` emptied, no `autoApprove`, no `toolsSettings` grants, no `includeMcpJson`, no lifecycle hooks -- so that every call raises a permission request the READ_ONLY gate judges instead of being approved by the backend unattended. Routed through `_write_derived_permissions`, which on an accepting release derives `{"rules": []}` from the emptied grants -- byte-identical to what this line wrote -- and on a refusing or unknown one removes the inherited value. The `if "permissions" in spec` guard stays: the gate decides whether the field may be CARRIED, not whether to add one, and its mere presence is what makes KAS load a spec at all. Co-authored-by: Leon <leon.lai.yc@gmail.com>
…oo (kirodotdev#13070) kirodotdev#12919 made `_write_derived_permissions` "the one version gate every generated spec writer shares" and routed agent.py's five writers through it: a kiro-cli below SPEC_PERMISSIONS_MIN_VERSION, or one whose version cannot be established, gets no `permissions` block and any inherited value removed. `agent_capabilities._align_permissions` kept its own write. It is the sixth generated-spec writer -- `CapabilityService.put` and `publish` atomic_write the projected spec into the kiro agents directory and bind the member to it -- so on a below-floor or unknown release the fork funnel published exactly the file the gate exists to prevent. kiro-cli validates specs with serde `deny_unknown_fields`, so that release refuses the WHOLE file and drops every Crew MCP server with it, falling back to broader default grants. Two questions share that call site and only the second is the binary's. Whether the SOURCE block was hand-edited away from its derivation is a governance question about the template, so the `alternate_permissions_require_review` comparison stays unconditional; only the target write moves behind the gate. Both are pinned. Reuses the existing gate rather than adding a sixth spelling of the version check: `agent_capabilities` already imports private names from `kiro_crew.agent` function-locally on this path. `docs/agent-spec-fields.md` already states the rule this path now obeys ("Crew WRITES this ... only when the installed kiro-cli accepts the field"), and its `permissions` row is being rewritten by open kirodotdev#13014, so it is left untouched here. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Problem / Motivation
Generated conductor and worker agent specs always wrote a derived
permissionsfield. Olderkiro-clireleases use strict unknown-field rejection and do not accept that field, so they can reject the whole generated spec and fall back to broader default grants. Generated configs can also inherit a user-configuredpermissionsvalue before the writer runs.Why it matters
Users running an older or unrecognized
kiro-clican lose the intended generated agent spec instead of receiving a compatible spec with its existingallowedToolsgrants.What changed (motivation → approach → change)
In
src/kiro_crew/agent.py, centralized generatedpermissionswrites in_write_derived_permissions, using the existing installed-version capability probe. The default seed plus conductor, ledger-conductor alias, pipeline conductor, security conductor, and worker paths now share that gate. Accepting versions replace any inherited value with a fresh derivation; refusing or unknown versions remove any inherited value. The default-spec seed still preserves an existing hand-written block before calling the helper.Updated
src/kiro_crew/docs/agent-spec-fields.mdto document the generated-writer gate, inherited-value replacement/removal, and default-seed preservation behavior.Backwards compatibility
Compatible: supported
kiro-cliversions receive the same freshly derived policy; unsupported versions receive a spec without a field they cannot parse, while existing user-owned default-spec blocks remain untouched.Tests
allowedTools, and verifies refusing/unknown versions remove it without removingallowedTools.origin/mainproduction code.Manual verification
N/A — real writer entry points and all installed-version outcomes are covered by automated tests.
Screenshots / video
N/A — backend-only generated agent-spec behavior; no user-visible frontend change.
Related Issues
Fixes #12897
Pattern harvest
Rule candidate: review-prompt
Pattern: when version-gating an optional generated field, remove an inherited copy on the closed gate instead of only skipping the direct write.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement