Skip to content

fix(kas): backport #31892 #33045 #33478 to 0.12 (allowedCommands regex, read allowedPaths) - #34820

Merged
buluoray merged 3 commits into
release/0.12.0from
crew/slack/kas-picks-0120-31892-33045-33478
Nov 11, 2026
Merged

buluoray merged 3 commits into
release/0.12.0from
crew/slack/kas-picks-0120-31892-33045-33478

Conversation

@buluoray

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring three KAS fixes merged on main (#31892, #33045, #33478) onto release/0.12.0, so a kiro-cli agent's allowedCommands regexes and read allowedPaths auto-approve under Kiro Crew on KAS as they do in kiro-cli.

A Slack user on 0.12.1.2 reports approval prompts for calls their kiro-cli agent auto-approves. On the 0.12 line Crew's gate refuses an allowedCommands entry that uses \d, \s, \w, {n,m} or other Rust regex syntax kiro-cli accepts, so its commands prompt (or are refused under denyByDefault), and a read.allowedPaths grants nothing. The release batches #33093 and #33229 left these three out for conflicts.

Why it matters

Anyone who brings a kiro-cli agent with regex allowedCommands or read allowedPaths to Kiro Crew on KAS gets prompts kiro-cli never asks, and a scheduled job using such an agent stalls on the approval. These are approved for 0.12.x by Ray.

Not a goal

What changed (motivation → approach → change)

Each main squash commit was cherry-picked with -x onto release/0.12.0 @ a7a6dd4397, in main merge order, one commit each. The repository's leak guard requires the public identity, so every commit is authored as Ray Xu and names its original author on an Original author: line; co-author trailers use noreply addresses.

# PR Original author main release
1 #31892 read \d \s \w and {n,m} in allowedCommands; add trustedAgents allows after every deny Joe Guo b8b90c4337 28cbd704f0
2 #33045 answer a kiro-cli agent's read allowedPaths at Crew's gate Joe Guo d170e6347d bcfac32a66
3 #33478 read rust regex allowed commands and name dropped allows Bolin Chen ddb535e187 6f4b80ac32

Prerequisites. All three conflict because release/0.12.0 lacks kiro-cli alias folding (platform/tools_settings_aliases.py, canonical_tools_settings, as_authored) and trusted_agents_withheld, which come from #30193 and #32649. Picking #30193 was tried first: it conflicts again in kas_agents.py, kas_permissions.py and kas_skill_scope.py, and it changes behaviour beyond these fixes (16 files, +596). That chain is too wide for a hotfix, so no prerequisite is picked and the hunks below are hand-resolved. They read the raw toolsSettings keys where main reads the alias-folded view.

Hand-resolved hunks (each commit message lists its own):

  • fix(kas): read \d \s \w and {n,m} in allowedCommands; add trustedAgents allows after every deny #31892
    • acp/kas_permissions.py web_fetch branch: comment-only conflict, kept the release text.
    • agent_sdk/kas_tool_view.py tools_settings_unenforced: main's \d \s \w "inexact" naming, read over the raw execute_bash/shell keys, without canonical_tools_settings / as_authored.
    • docs/agent-spec-fields.md toolsSettings row: main's two syntax edits applied to the release text.
    • test/test_kas_tools_settings_aliases.py: not on release, dropped. The ASCII-class naming is covered on release by test_mate_spec_policy.py.
  • fix(kas): answer a kiro-cli agent's read allowedPaths at Crew's gate #33045
    • acp/kas_agents.py imports: added CREW_ANSWERED_READ_PATHS_KEY only; CREW_ANSWERED_WRITES_KEY is main-only.
    • acp/kas_agents.py spec_keys_without_carrier: main's fs_write/fs_read loop, naming the key as written.
    • docs/agent-spec-fields.md toolsSettings row: main's read.allowedPaths sentence and grep/glob wording.
    • test/test_kas_tools_settings_grants.py: dropped the fsRead alias case of test_a_read_inside_allowed_paths_is_answered_by_the_grant; that alias is read only with fix(kas): read kiro-cli toolsSettings aliases, wide path denies and pwsh process control #30193's folding.
  • fix(kas): read rust regex allowed commands and name dropped allows #33478
    • acp/kas_agents.py spec_keys_without_carrier: main's authored / name_unreadable_entries / projection_dropped_rules lines, keys named as written, without the trusted_agents_withheld line.
    • acp/kas_permissions.py: main's move of _agent_glob / _available_agents_rules into kas_subagent_rules; the import no longer re-exports trusted_agents_withheld.
    • acp/kas_subagent_rules.py (new): without trusted_agents_withheld and its tools_settings_aliases import; the two moved helpers are identical to release's.
    • acp/kas_unread_commands.py (new): docstring no longer cites canonical_tools_settings.
    • agent_sdk/kas_tool_view.py: main's ascii_only docstring without the alias sentences; unreadable_allowed_commands reads the raw toolsSettings.
    • docs/agent-spec-fields.md: main's allowedCommands sentence and permissions.rules[<i>] wording on the release rows (word-for-word the same edit as main).
    • test/test_kas_tools_settings_aliases.py: not on release, dropped.

Routed to @bolichen97 for the hand-resolved hunks.

Backwards compatibility

Compatible: each fix keeps its main PR's compatibility notes; on release the gate now reads more allowedCommands syntax and one more grant (read.allowedPaths), and nothing it read before is read differently.

Removes nothing: the subagent helpers move between modules with the same names and are still imported from kas_permissions; no stored data or config changes.

Tests

Proof: not provable -- other: a backport of main commits whose proofs ran on their own PRs

Manual verification

N/A - each fix was verified on its own main PR. The 0.12.x RC soak is the end-to-end check.

Related Issues

Backport to the 0.12 line of #31892, #33045 (closes #33041 on main) and #33478.

Sibling sweep

Siblings: none -- each source PR carried its own sibling sweep; this PR only carries those fixes.

Pattern harvest

Not generalizable: this PR only carries fixes already on main. The source PRs have their own harvest.

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.

…ts allows after every deny (#31892)

Original author: Joe Guo (#31892)
Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com>
(cherry picked from commit b8b90c4)

Backport note: three hunks resolved by hand, because release/0.12.0
has no kiro-cli alias folding (#30193's tools_settings_aliases module;
only its fail-open part was ported, in 21b747d).
- kas_permissions.py: comment-only conflict in the web_fetch branch;
  kept the release text.
- kas_tool_view.py tools_settings_unenforced: ported the \d \s \w
  "inexact" naming over the raw execute_bash/shell keys, without
  canonical_tools_settings / as_authored.
- agent-spec-fields.md toolsSettings row: applied main's two syntax
  edits to the release text.
- test_kas_tools_settings_aliases.py: dropped; the file is not on
  release (alias-only tests). The ASCII-class naming is covered on
  release by test_mate_spec_policy.py.
…33045)

On KAS a toolsSettings fs_read/read allowedPaths granted nothing and the
session-start notice named it. Crew now records the usable entries under
_crewAnsweredReadPaths, the way #31850 records the write ones, and the
spec-builtin-grant row approves a KAS read_file of one existing file an
entry covers as written and symlink-resolved. A missing target, a ~user
target, a listing, grep/glob and every other read keep main's answer; a
deniedPaths or other read key withholds the grant and names it.

Closes #33041

Original author: Joe Guo (#33045)
Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com>
(cherry picked from commit d170e63)

Backport note: hunks resolved by hand, because release/0.12.0 has no
kiro-cli alias folding (#30193) and no CREW_ANSWERED_WRITES_KEY.
- kas_agents.py imports: added CREW_ANSWERED_READ_PATHS_KEY only;
  CREW_ANSWERED_WRITES_KEY is main-only and unused here.
- kas_agents.py spec_keys_without_carrier: took main's fs_write/fs_read
  loop, naming the key as written ({key}) instead of as_authored.
- agent-spec-fields.md toolsSettings row: added main's read.allowedPaths
  sentence and grep/glob wording to the release text.
- test_kas_tools_settings_grants.py: dropped the fsRead alias case from
  test_a_read_inside_allowed_paths_is_answered_by_the_grant; the alias
  is read only with #30193's folding.
…33478)

- kas-allowed-commands-regex-dropped: Kiro Crew's gate now reads the
  Rust regex syntax kiro-cli accepts in toolsSettings.shell
  allowedCommands (POSIX classes, \d \w \s \b, counted and lazy
  repeats, flags, named groups), so denyByDefault no longer refuses a
  command kiro-cli runs. What Rust refuses to compile stays refused,
  a repeat count past 4294967295 included, since kiro-cli then allows
  nothing by the entry. An entry it still cannot read is named with
  the reason in the refusal, the session-start notice and doctor. A
  deniedCommands entry read by ASCII that cannot judge a non-ASCII
  command never hides another entry that names it.
- kas-oversized-exclude-allow-dropped-silently: a permissions allow
  whose exclude lists more than 64 patterns is still left out of the
  KAS block, but the session-start notice now names it as
  permissions.rules[<i>] and says why, so a prompt it causes is no
  longer a mystery.

The subagent toolsSettings rules move from kas_permissions to
kas_subagent_rules, keeping kas_permissions under the line cap.

Original author: Bolin Chen (#33478)
(cherry picked from commit ddb535e)

Backport note: hunks resolved by hand, because release/0.12.0 has no
kiro-cli alias folding or trusted_agents_withheld (both from #30193;
only its fail-open part was ported, in 21b747d).
- kas_agents.py spec_keys_without_carrier: took main's authored /
  name_unreadable_entries / projection_dropped_rules lines, naming keys
  as written (no as_authored) and without the trusted_agents_withheld
  line.
- kas_permissions.py: took main's move of _agent_glob and
  _available_agents_rules into kas_subagent_rules; the import no longer
  re-exports trusted_agents_withheld.
- kas_subagent_rules.py (new): left out trusted_agents_withheld and its
  tools_settings_aliases import; the two moved helpers are identical to
  release's.
- kas_unread_commands.py (new): docstring no longer cites
  canonical_tools_settings.
- kas_tool_view.py: main's ascii_only docstring without the alias
  sentences; unreadable_allowed_commands reads raw toolsSettings
  instead of the alias-folded view.
- agent-spec-fields.md: main's allowedCommands sentence and
  permissions.rules[<i>] wording applied to the release rows.
- test_kas_tools_settings_aliases.py: dropped (not on release).
@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 10, 2026 21:37
@buluoray
buluoray requested review from bolichen97 and chenmingwei23 and removed request for a team November 10, 2026 21:37
@github-actions

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/hook_runtime/gate_tiers.py

  • src/kiro_crew/hook_runtime/tool_identity.py

  • src/kiro_crew/hooks.py

  • No reasoning template for 6f4b80a yet.

How to clear this check:

  1. The PR author posts the template below as a PR comment, with
    every field filled (N/A needs a reason). Keep the
    Head commit line: it must name the current head SHA.
  2. The check turns green within a minute, with no push.
  3. A new push resets this check: post it again for the new head.

Only the author's comment counts this way. A reviewer can instead
paste the filled template into an "Approve" review on this head.
Merging still needs a reviewer's approval.

## Sensitive change review
- Head commit: 6f4b80ac324fb43c37bfb2134c8cb853d412acd7
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 6f4b80ac324fb43c37bfb2134c8cb853d412acd7 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the PR replays three fixes already merged on main, the hand-resolved hunks keep main's design, and the moved helpers are still importable from kas_permissions.

Notes

  • The tests this PR deletes, such as test_an_unusable_pattern_allows_nothing, required the old refusal of \d/\w/{n,m}. Main's merged PRs already reversed that behaviour, so this is not a new loosening. The commit message should still cite those PRs as the decision.
  • CI doesn't run the backend suite on PRs into release/*, so the green runs listed under Tests are the only test evidence. The 0.12.x RC soak should cover a denyByDefault agent that uses regex allowedCommands.

[DESIGN-REVIEWED] 6f4b80a

Description read

[DESCRIPTION-READ] efda224e1c4450072b4a672b1e99b6a1a3d3a1197f6148d3b86dc3ab3cc88d08

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 6f4b80ac324fb43c37bfb2134c8cb853d412acd7 — 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. Every item is a straight backport of a fix already merged on main (#31892, #33045, #33478), and the release branch adds nothing of its own.

What this change ships

Inventory (7 items) — 7 justified

Intent: let a kiro-cli agent's regex allowedCommands and read allowedPaths auto-approve on Kiro Crew 0.12 under KAS, the same as kiro-cli does. FIX (backport).

  1. allowedCommands entries using \d \s \w, {n,m}, anchors and POSIX classes now match instead of prompting or being refused — justified
  2. trustedAgents allow rules are placed after every deny in the projected permissions — justified
  3. A read inside the agent's read.allowedPaths is auto-approved at Crew's gate — justified
  4. kirocrew doctor prints an allowed cmd: row for each entry it cannot read — justified
  5. The session-start notice names allow rules that were not sent and entries that could not be read — justified
  6. The subagent-rule helpers move into the new kas_subagent_rules module, still imported through kas_permissions — justified
  7. The security.md, cli.md and agent-spec-fields.md text now matches the new reading — justified

[FIRST-PRINCIPLES-REVIEWED] 6f4b80a

Description read

[DESCRIPTION-READ] 43248799b3996a14119cb42ccdb2d7c08537e7f43901e2185c6ce42abad7494b

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

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 6f4b80ac324fb43c37bfb2134c8cb853d412acd7 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6f4b80a

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

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 6f4b80ac324fb43c37bfb2134c8cb853d412acd7 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6f4b80a

Verdict parsed from the review's SHA-scoped output markers for commit 6f4b80ac324fb43c37bfb2134c8cb853d412acd7.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 6f4b80ac324fb43c37bfb2134c8cb853d412acd7 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 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 6f4b80ac324fb43c37bfb2134c8cb853d412acd7 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 13 classified, 0 newly refused, 13 still allowed.
  • ubuntu-latest (platform posix): 13 classified, 0 newly refused, 13 still allowed.
  • windows-latest (platform windows): 12 classified, 0 newly refused, 12 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: This diff doesn't touch the shell deny tiers (sensitive-bash, exfil, deny-rules), so the shell-command candidates measure only what happens around the change. The change that actually got stricter sits in the KAS spec gate rows. Two parts of it are checked here: denied_match now refuses on a readable deny entry that matches, and allows are dropped one key at a time past the rule bound. No script could classify either one, so they are named under UNADJUDICATED and nothing is claimed for them.

TIGHTENING: allowed_commands.denied_match and the spec-shell-allowlist / spec-builtin-grant rows -- a command an authored deniedCommands entry names must not be answered by the grant it sits beside. Hunk: - if any(p is None for p in patterns): / - return None replaced by + judging = [p for p in parsed if p is not None and (command.isascii() or not p.ascii_only)] … + return False if len(judging) == len(parsed) else None. So "a readable one that names such a command is refused all the same", where before, one unreadable entry made the whole deny list read as unknown and the command prompted.

ADJUDICATED: 21 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: posix and windows have separate rows wherever the operation names a path, a separator or an executable:

  • kirocrew / kirocrew.exe
  • .venv/bin/python / .venv\Scripts\python.exe
  • /tmp/... / %TEMP%\...
  • sleep / Start-Sleep, ls / dir, cat / type

any is used only for strings that read the same on both hosts (whoami, echo hi, git commit -m "fix(x): y", npm run build). The diff's one platform-shaped assumption is its own: the reader matches \d \w \s \b and (?i) by ASCII, and an ascii_only entry matches no command that holds a non-ASCII character. That depends on the characters in the command, not on the host, so neither leg can show a difference. No candidate here holds non-ASCII text either, because that boundary sits in the spec-gate row, which isn't classified. The new read grant's os.path.isfile(os.path.join(cwd, os.path.expanduser(target))) and its ~-prefix test are path assumptions in a file-read row the classifier does not reach. They are listed below, not tested here.

UNADJUDICATED:

  • allowed_commands.denied_match (deny side of the spec grant). Call path: a KAS permission request goes to AcpEvent.spec_denied_grant, then ToolCall.spec_denied_grant, then gate_tiers.grant_spec_builtin, then denied_grant_applies, then denied_match.
    • Before this change, one deny entry outside the reader (for example rm\s+-rf.*, refused then for \s) made the result None for every command, so the command prompted.
    • Now that entry, and every entry beside it that the reader can read, is judged. A command that matches becomes a refusal instead of a prompt.
    • Inputs I would have submitted, each as a spec carrying both allowedCommands and deniedCommands: git status beside deniedCommands: ["rm\s+-rf.*", "git push.*"] (should still be answered); git push origin feat/example beside the same list (now refused, which is the author's deny and the same as what kiro-cli does); and ls café beside deniedCommands: ["ls \w+"] (unknown, still prompts).
    • I can argue this narrowing but not confirm it. As far as I can tell it matches kiro-cli's own refusal, so it is not a regression I can show.
  • tools_settings_to_permissions allow ordering. subagent.trustedAgents allows now go in last (allow_groups). If adding them would pass _MAX_RULES, that key alone is named and left prompting instead of being appended. Call path: kas_agents.to_client_custom_agent, then merge_user_permissions.
    • Input I would have submitted: a spec with enough deniedPaths / deniedCommands rules to sit near _MAX_RULES plus a trustedAgents: ["ops-*"]. The trusted-agent spawns would now prompt where they may have been auto-approved before.
    • No shell row can express this, and I could not confirm what the base did with the whole block once it passed the bound.
  • _spec_read_granted (new read.allowedPaths grant). This grants rather than refuses, but its ~ and isfile checks are where platform spelling matters. Call path: kas_write_allowlist.projected_answered_read_paths, then AcpEvent.spec_granted_read_paths, then grant_spec_builtin.
    • Inputs: read_file of ~/notes.md (posix) and of C:\Users\me\notes.md / %USERPROFILE%\notes.md (windows) against an allowedPaths entry covering each.
    • Nothing here can tell whether a Windows target is covered when it is spelled with \ separators.
  • Allowlist entries the new reader refuses that kiro-cli runs. The reader's own bounds sit below Rust's: three repeats on one atom (a***), and a counted repeat of a wide class past the weight bound (\w{97}). Under denyByDefault, a command only such an entry matches stays refused, now with the entry named. In the base reader these same entries were also unreadable, so nothing new is lost, but an author porting from kiro-cli will still meet it.

[SCOPE-REVIEWED] 6f4b80a

@buluoray
buluoray merged commit a157d53 into release/0.12.0 Nov 11, 2026
28 of 34 checks passed
@buluoray
buluoray deleted the crew/slack/kas-picks-0120-31892-33045-33478 branch November 11, 2026 00:28
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 11, 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