Skip to content

fix(security): do not hand shell command text to the path tier - #11223

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/shell-text-leaves-path-tier
Sep 22, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/shell-text-leaves-path-tier

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

The tool gate's path tier reads a PATH: hooks.on_tool_call and the _resolve_permission title and tool_input tiers call is_sensitive_path on each target. For a shell tool one of those targets is its recovered command (AcpEvent.shell_command), and the title usually is that command with a display prefix. The gate deliberately does not match paths in command text (see the spec's "The gate does not match PATHS in command text": every text matcher there was removed because the OS sandbox is the control, and a regex over a shell command cannot be made complete). Yet the path tier still resolved the command as a filename.

Resolving cd /workplace/me/proj && grep -rn foo src as a filename never matched. It did two things anyway: it spent a bounded-resolver round-trip per shell call, and under a resolver stall (interpreter contention, a mount not answering) it refused the command as

Blocked: access to sensitive path: cd /workplace/me/proj && grep -rn foo src

which is a non-path named as a credential, and is what the agent then acted on. Live gateway logs in #10255 show this on ordinary cd && grep and cat commands.

Why it matters

On a loaded gateway the stall case turns an ordinary shell command into a credential refusal, and the agent has no way to tell it apart from a real one. Outside a stall, the round-trip is pure cost on every shell call for a check whose answer is known in advance to be "no match": the doctrine that the shell is bounded by the sandbox, not by text matching, is already in the spec, and this is the one site that had not caught up with it.

This is deliberately a one-string exemption with a stated residual, so a maintainer can judge the residual on its own rather than inside a larger diff.

What changed (motivation → approach → change)

Observed symptom: shell commands refused as sensitive paths under a stall, and a resolver round-trip on every shell call. Root cause: the path tier is applied to every target regardless of what the target IS, while the doctrine for a shell command is that the sandbox, not text matching, bounds what it can open.

Approach: spare the resolver exactly one string per shell frame, the recovered command text, and only when the client's own classification says the command runs inside the sandbox: is_shell, a recovered shell_command, and no mcp_server_name. Nothing about the payload is consulted for the decision. Two exclusions are load-bearing and each one is the kind of thing a review found:

  • MCP-served frames: kiro-cli can classify an execute-kind frame as shell while also naming an MCP server (classify_tool_call carries the identity and keeps the shell verdict). An MCP-served tool runs OUTSIDE the sandbox this exemption leans on, so its targets stay path-gated.
  • Every other string of a shell frame: a shell-kind tool with structured parameters (kiro-cli use_aws) can carry a discrete credential path as an ARGUMENT, and in standard sandbox mode ~/.aws, ~/.ssh and ~/.kube are visible to the shell, so the path tier over that argument is the control there, not the sandbox. Only the command string itself is exempt; a title that is not the command, and every payload string that is not the command, is gated exactly as before.

Change:

  • hooks.py: exempt_command = command if (is_shell and command and not mcp_server_name) else None, then reason = sensitive_path_refusal(target) if target != exempt_command else None in the per-target loop (the reason-or-None form main's sensitive_path_refusal interface from fix(security): word a resolver stall as unverifiable, not a path match #11221 uses, so a stall on a real path still refuses with its own wording). The targets are the normalized title and the recovered command, so the title is spared only when it IS the command; the raw_params path tier below the loop is untouched.
  • llm_helpers.py: _path_tier_exempt(event) -> str | None returns the recovered command under the same condition, the one place it is spelled. _title_denial and _first_tool_input_denial take a keyword-only exempt_command=None and skip the path tier for the string that is that text (_is_exempt_command_text: equal, or equal after the Running: /Reading display prefix is stripped, via hooks._normalize_tool_name). The bash, exfiltration and deny-rule tiers are unchanged.
  • scripts/deny_diff.py, security-conductor scripts/verify_fix.py: the path tier leaves the shell-corpus composites (they classify SHELL COMMANDS, the one string the gate now exempts), with the bool-tier reason plumbing that existed only for it. test_deny_diff's pin that the measured checks equal the checks the gate applies now derives the shell composite from the gate's exemption lines.
  • docs/system-specs/modules/security.md: the "does not match PATHS in command text" bullet records that the tool gate's path tier follows the rule for the recovered command, names both exclusions, and states the residual.

Residual, stated rather than matched around: a shell tool whose recovered COMMAND is a bare path (the Claude Code adapter's Bash title is the bare command, so a command consisting of just ~/.aws/credentials) is command text like any other and is left to the sandbox. That is the same posture the spec already records for cat ~/.aws/credentials from a shell.

Not in this PR (tracked under #10255): the wording of a stall refusal on a real path (#11221, merged; this branch is rebased onto it and layers the exemption onto its sensitive_path_refusal interface), and any change to how symlink resolution is run.

Tests

  • test/test_hooks.py (TestShellCommandTextLeavesThePathTier): the recovered command (with its Running: title) is never handed to is_sensitive_path (a recording stub that would refuse everything is not consulted, and the command is not denied as a sensitive path); a bare-path command is likewise not handed to it; a shell title that is NOT the command still pays the tier; a non-shell bare-path title is still refused with the historical wording; a non-shell read with raw_params is still refused; an MCP-served shell-classified frame still reaches the path tier and is refused; raw_params paths on a shell frame are still refused.
  • test/test_llm_helpers_tool_input_offload.py (TestShellCommandTextLeavesThePathTier): the recovered command skips the path tier as a title (prefixed or bare) and as a payload string; a non-command title still pays it and a matched one is refused; a shell frame's OTHER payload strings still pay it, pinned with a structured use_aws-shaped call whose ~/.aws/credentials argument is refused while the command string is not resolved; _path_tier_exempt is the command for a sandboxed shell frame and None for a non-shell, an MCP-served, or an unrecoverable-command frame; end to end through _resolve_permission, a path tier answering True for everything cannot refuse a shell command, a use_aws call with a credential-path argument is rejected, and an MCP-served shell event whose path tier would refuse is rejected; a source pin that each tier's body gates its single is_sensitive_path( call on the exempt-command test. The _event/_resolve helpers gain an is_shell keyword defaulting to False, so every existing call is unchanged.
  • test/test_llm_helpers_non_shell_gate.py: the spy on _first_tool_input_denial forwards keyword arguments.
  • test/test_deny_diff.py, test/test_security_conductor_verify_fix.py: the fake security modules and tier parametrizations drop the path tier; the gate-vs-table pin asserts the exemption lines (exempt_command = command if (is_shell and command and not mcp_server_name) else None feeding reason = sensitive_path_refusal(target) if target != exempt_command else None) and equates the table with the remaining per-target checks plus is_denied.

Run locally on the current head (rebased onto b2bc03ab5b): test_hooks, test_deny_diff, test_security_conductor_verify_fix, all test_llm_helpers* and test_security_path_resolve_bounded (700 tests) pass; black, isort, flake8, mypy on the changed files, the comment-history gate against the merge-base and docs-lint pass. Earlier heads: the two files above plus test_hooks_coverage, test_security, test_security_facade, test_security_path_resolve_bounded, test_deny_guidance, test_workflow_security, test_member_essential_context, test_prompts, test_cc_agent_resolution, test_acp_client_more_coverage (about 2,300 tests) pass; isort, flake8, mypy, the black gate, the comment-history gate and docs-lint pass.

Manual verification

N/A — unit coverage sufficient: the change is one exemption at three call sites, each pinned in both directions (the command skips, everything else still gated) including the two exclusions, plus the composite tables the differential test ties to the gate.

Related Issues

Refs #10255 (the shell-text half). Companion to #11221 (stall wording, merged) and #10256, which this supersedes in part. No linked issue is closed on merge: #10255 stays open until its resolver-contention half is decided.

Pattern harvest

Rule candidate: review-prompt
Pattern: "a per-target security check applied to every target of a tool kind, where the doctrine for ONE of those targets says a different layer is the control"

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|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

@Pearcekieser
Pearcekieser requested review from a team and dwu96 September 16, 2026 06:37
@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Sep 16, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 16, 2026
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed ac44c088b0f2ad22e416e3de5abc7c0a5fd81bd0 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ac44c08

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of ac44c088b0f2ad22e416e3de5abc7c0a5fd81bd0 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Confirm with a security owner that the stated residual — a shell command that IS a bare credential path bypasses the path tier — is acceptable in standard mode.

[DESIGN-REVIEWED] ac44c08

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — ✅ PASS

Premise-level review of ac44c088b0f2ad22e416e3de5abc7c0a5fd81bd0 via the fork AI-review pipeline — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify on each backend that every non-MCP, shell-classified frame really runs sandbox-wrapped — the exemption's entire safety case rests on that equivalence.

The defect is derivable from the base alone: hooks.py's own comment (line ~906) says a bash command "is NOT matched on its text" while line 930 hands it to sensitive_path_refusal, and the spec bullet (security.md:514) already pins the doctrine; #10255 is the pointable report. Grepped sensitive_path_refusal( across src/: 7 call sites, and the 3 that receive shell command text (hooks per-target loop, _title_denial, _first_tool_input_denial) are exactly the 3 fixed — 0 unfixed siblings; hooks.py:972/2941 read real paths and are rightly kept. The deleted deny_diff/verify_fix path-tier rows follow mechanically from the gate (the table must equal what the gate applies), are declared in the description, and the rewritten pin now asserts the exemption lines in gate source. The residual (bare-path command) is weaker than the posture the base spec already records for cat ~/.aws/credentials.

What this change ships

Inventory (9 items) — 9 justified

Intent: stop the tool gate refusing ordinary shell commands as "sensitive path" under a resolver stall, and stop paying a resolver round-trip per shell call — a FIX.

  1. An ordinary shell command is no longer refused as a sensitive path under a resolver stall — justified
  2. Shell calls no longer spend a path-resolver round-trip on the command text — justified
  3. A shell frame that names an MCP server keeps the path tier on its command — justified
  4. A shell frame's structured arguments (use_aws credential paths) are still refused — justified
  5. A shell command that is a bare path is now left to the sandbox (stated residual) — justified
  6. deny_diff.py reports no sensitive-path tier for shell rows — justified
  7. security-conductor verify_fix.py classifies against three tiers, not four — justified
  8. Spec bullet records the exemption, both exclusions and the residual, same commit — justified
  9. Internal _path_tier_exempt/exempt_command= surface, consumed at both _resolve_permission call sites — justified

[FIRST-PRINCIPLES-REVIEWED] ac44c08

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed ac44c088b0f2ad22e416e3de5abc7c0a5fd81bd0 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ac44c08

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review (fork) — ✅ PASS

Which legitimate operations does ac44c088b0f2ad22e416e3de5abc7c0a5fd81bd0 newly refuse? Model proposes, scripts/deny_diff.py decides — updated in place on each push. A script-confirmed regression blocks PR readiness.

adjudicated, zero confirmed regressions

Scope-Verdict: PASS

TIGHTENING: No mechanism gets stricter in this change — it is a narrowing. The path tier stops resolving a sandboxed shell tool's recovered command text (reason = sensitive_path_refusal(target) if target != exempt_command else None in hooks.on_tool_call, the same exemption via _path_tier_exempt/_is_exempt_command_text in the _resolve_permission title and tool_input tiers), and both classifier composites drop the sensitive-path tier accordingly. The one refusal surface it retains is pre-existing, not new: "Every OTHER string of a shell frame stays path-gated: a shell-kind tool with structured parameters (kiro-cli use_aws) can carry a discrete credential path as an argument, and in standard mode ~/.aws is visible to the shell" — a discrete credential path in a non-command string (an MCP-served shell frame's targets, a structured argument, a title that is not the command) is refused by the path tier exactly as at base. No pattern, fence, validator, or argv floor is broadened anywhere in the diff; every hunk either removes a check or adds an exemption, so the set of refused operations at head is structurally a subset of the set at base.

ADJUDICATED: 14 candidates, 0 confirmed newly-refused
No confirmed rows were handed back; the candidates are written to candidates.json for the adjudication legs. The rows probe the boundary the exemption draws rather than the middle: the diff's own motivating cd /x && ... shape, command text carrying credential-path and heredoc-backtick spellings that historical text passes false-positived on, the maintainers' daily operations in the touched area (reading the edited spec, tracing sensitive_path_refusal call sites, running the extended test file, invoking scripts/deny_diff.py itself), and neighbours inside the two tiers the composite keeps (printenv PATH beside the env-credential detector, a read-only curl GET beside the exfiltration shapes).

PLATFORM COVERAGE: Candidates were written in posix (8 rows), windows (5 rows), and any (1 row) spellings. The diff's platform-relevant assumption is inverted from the usual case: the removed resolver was what imposed path semantics (separators, drive letters, tilde expansion, UNC handling) on command text, while the new exemption is exact string equality on the client-recovered command, which is platform-neutral. Each daily operation is therefore probed in both tokenizers' spellings — worktree cd-and-status (/tmp/... vs cd /d C:\...), the spec read (cat vs type), the source trace (grep -rn vs findstr /s /n), the environment read (printenv PATH vs echo %PATH%), and the pytest invocation with a backslash test path — so a leg on either host would surface a re-tightening written against the other host's spelling. The single any row (curl to a public API) carries no path or separator. No platform spelling the diff assumes was left without a candidate; the per-leg verdicts are the deterministic fold's to report after this review is captured.

[SCOPE-REVIEWED] ac44c08

Security scope review -- adjudicated candidates

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

No candidate flipped from allowed to refused.

@Pearcekieser
Pearcekieser force-pushed the fix/shell-text-leaves-path-tier branch from 8bd3987 to bb72d22 Compare September 16, 2026 07:02
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: no

  • fixed -- source-pin the llm_helpers funnel's two exemption sites as test_deny_diff pins the hooks gate

Head bb72d22 adds test_both_funnel_sites_carry_the_exemption_in_source: for _title_denial and _first_tool_input_denial it asserts the body contains if not is_shell and is_sensitive_path( and exactly one is_sensitive_path( call, so the exemption cannot regress to a comment. The same head also repairs the black failure on test/test_hooks.py (formatted lines were left unstaged in the previous amend).

@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 Sep 16, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/shell-text-leaves-path-tier branch from bb72d22 to bb54963 Compare September 16, 2026 08:23
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 16, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/shell-text-leaves-path-tier branch from bb54963 to 2e5d2ea Compare September 16, 2026 08:57
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: classify_tool_call returns is_shell=True with a non-empty mcp_server_name for a kiro execute-kind frame that also names an MCP server; the exemption keyed on is_shell alone, so an MCP-served tool (which runs outside the sandbox the exemption leans on) skipped the path tier.

  • fixed -- Execute-kind MCP calls bypass sensitive-path enforcement

Head 2e5d2ea gates the exemption on the client's classification AND the absence of an MCP server: hooks.on_tool_call computes path_tier_exempt = is_shell and not mcp_server_name, and _resolve_permission passes _path_tier_exempt(event) (event.is_shell and not event.mcp_server_name) to both funnel tiers, so an MCP-served frame stays path-gated exactly as before. Pinned by test_an_mcp_served_shell_frame_keeps_the_path_tier (gate), test_an_mcp_served_shell_event_is_not_exempt and test_an_mcp_served_shell_event_is_still_path_gated_end_to_end (funnel, through _resolve_permission under AUTO_APPROVE), and the spec bullet states the condition.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: no

  • fixed -- pin that is_shell=True + raw_params paths are still refused

Head 2e5d2ea adds test_raw_params_paths_on_a_shell_frame_are_still_refused: a shell-classified frame carrying raw_params={"path": "~/.ssh/id_rsa"} on a read kind is denied on the raw_params tier, so that tier's independence from the title exemption is pinned rather than an accident of hunk placement.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 16, 2026
@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 Sep 16, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/shell-text-leaves-path-tier branch from 2e5d2ea to e464dff Compare September 16, 2026 09:55
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

@chenmingwei23 thanks for flagging the plan. I am doing the rebase onto current main and working the GPT 5.6 / Opus 4.8 findings on this head now (author side), so you need not spend the time on it. If you have already started, say so here and I will stand down and leave the branch to you; otherwise I will push with --force-with-lease against the current tip (1413ebd) shortly.

@Pearcekieser
Pearcekieser force-pushed the fix/shell-text-leaves-path-tier branch from 1413ebd to d60e80a Compare September 22, 2026 05:00
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (b2bc03ab5b, 133 commits). Old head 1413ebdcc2, new head d60e80a868. Clean rebase; the replayed patch body is byte-identical to the reviewed one (the two git diff --binary bodies match once index/@@ lines are stripped), so every disposition above still applies to the same code.

Triage of the five reds on 1413ebdcc2:

Local gates on d60e80a868: 700 targeted tests pass (test_hooks, test_deny_diff, test_security_conductor_verify_fix, test_llm_helpers*, test_security_path_resolve_bounded); black, isort, flake8, mypy on the changed files, comment-history gate against the merge-base, and docs-lint all green.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 22, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

CI on d60e80a868: the four inherited reds from 1413ebdcc2 are gone -- Backend Lint, Bundle Size, GPT 5.6 Review and Opus 4.8 Review are all green (GPT and Opus each report no blocking findings on this head; Design, First Principles and Security Scope all PASS). Nothing in this diff is red.

The one remaining blocking item is CI's backend matrix, and it is main's, not this PR's:

Plan: once #12713's fix lands on main I will rebase onto it (patch body unchanged) so shard 4 goes green, rather than blind re-running a deterministic main red.

@chenmingwei23

Copy link
Copy Markdown
Contributor

Your own rebase landed first and did the job, so I pushed nothing and discarded my local rebase (it was onto an older main and would only have clobbered yours). Board on d60e80a868: 87 pass, 6 fail, 2 pending. Both objective reds I flagged earlier are gone, and GPT 5.6 / Opus 4.8 are no longer failing.

Attribution of what is left, so nobody spends time on it as if it were this diff:

  • Backend Tests (3.12, 4) -- 1 failed of 15383: test/test_pending_boundary_consumer_semantics.py::test_running_and_turn_running_slot_readers_are_enumerated. This is a main-side breakage, not yours. I ran that file at your base b2bc03ab5b with the PR absent, and at your head d60e80a868: both give an identical 1 failed, 8 passed on the same assertion. That test file is also new on main, added after 2db60de5e6.
  • Coverage Gate -- downstream only, no finding of its own. Its own log reads backend-test=failure -- failing closed, and Coverage Combine skipped. It goes green when the backend shards do.
  • PR Readiness -- 1 blocking item, aggregating the above.
  • Backend Tests (Windows) (1), (Windows) (4), macOS (2) -- not yet attributed; I could not read those logs (see below). Worth checking whether they are the same new test file landing on a different shard index per platform, since shard assignment is per whole file.

So the chain is one main-side test failure fanning out into the coverage gate and readiness. Nothing here asks for a change to your diff.

A caveat on my own evidence: the gateway path resolver on my side is refusing roughly half of all tool calls right now with a fail-closed budget timeout, which is why the three non-Linux shards are unattributed. That refusal is this PR verbatim -- it reports Path: cd ... && gh ..., the whole command text, and once Path: @kirocrew-core/wait, which is a tool name. The second one is a non-shell string reaching the path tier, so it is outside the exemption this PR adds and wants its own fix rather than being folded in here.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Thanks for the attribution, and for not clobbering the rebase. I reached the same conclusions independently:

Plan: no diff change. Once #12713's fix is on main I will rebase this same diff onto it and let CI re-run; that should clear everything except possibly the #12376 flake.

On the Path: @kirocrew-core/wait refusal you saw: agreed that it is a non-shell string (the tool name in the title tier) reaching the path tier, and out of scope for this PR, which exempts only the recovered shell command text. I have opened #12723 to track it separately.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

@chenmingwei23 thanks -- agreed on all of it, and thanks for not pushing over the rebase. Attribution for the three shards you could not read:

So it is one main-side test fanning out, plus one known flake; #12715/#12716 are the fixes in flight and I will rebase onto whichever lands (patch body unchanged).

On the Path: @kirocrew-core/wait refusal you saw: agreed that is outside this PR -- an MCP tool TITLE is a non-shell string, so it pays the path tier by design here, and under a stalled resolver it gets the fail-closed wording from #11221. The stall itself is the resolver-contention half of #10255 (PR C, out-of-process resolver), which is where that belongs; the Path: cd ... && gh ... half is what this PR removes.

@chenmingwei23

Copy link
Copy Markdown
Contributor

Field evidence for this PR, offered as text to fold into Why it matters on your next push rather than as a description edit. All four AI lanes (GPT 5.6, Opus 4.8, Design Review, First Principles) plus Security Scope Review are currently PASSING on d60e80a868, and a description edit re-triggers them on byte-identical code, so I am not editing the body to add prose that the already-created check runs cannot read anyway. On your next push it costs nothing.

Suggested paragraph:

This is reproducible on a loaded gateway today, not only in principle. Across one working session the tool gate refused 23 calls fail-closed on the resolver budget, each refusal naming a non-path as the path. One reported Path: cd <dir> && gh pr checks 11223, a whole shell command. At 03:57 UTC three consecutive refusals landed on three different cooldown keys, one of them keyed off the literal text ls /proc, because each distinct command text mints its own key and every junk key then refuses real paths. The stall case is therefore not rare and not cosmetic: it throttles an agent doing ordinary work, and the refusal it prints is indistinguishable from a genuine credential refusal.

Two of the refusals I saw are worth separating out, because this PR does not cover them and should not be widened to try:

  • Path: @kirocrew-core/wait -- an MCP tool name.
  • Path: Finding **/check-bundle-size.mjs in <worktree> -- a human-readable description of a file-search operation.

Neither is a recovered shell command, so _path_tier_exempt correctly returns None for both and they keep paying the path tier. They are the same defect class (a non-path string reaching the path tier) arriving through a different door, and they belong in their own change with their own reasoning about which non-shell strings are safe to spare. Folding them in here would turn a one-string exemption with a stated residual into a broad one, which is exactly what makes the residual hard to judge.

@chenmingwei23

Copy link
Copy Markdown
Contributor

Attribution is now complete: all six reds on d60e80a868 are main-side. None asks for a change to this diff. This closes the three I left open earlier.

  • Backend Tests (3.12, 4), Backend Tests (Windows) (4), macOS Tests (2) -- all three are the same test, test/test_pending_boundary_consumer_semantics.py::test_running_and_turn_running_slot_readers_are_enumerated. It fails identically at base b2bc03ab5b with this PR absent and at head d60e80a868 (1 failed, 8 passed both ways). Three shard indices because whole-file shard assignment differs per platform.
  • Backend Tests (Windows) (1) -- a different test, test/test_decisions_tool_risk_end_to_end.py::test_a_credential_in_the_command_is_annotated_rather_than_refused, and Windows-only. Attributed to main by controlled comparison: this lane PASSED on the previous head 1413ebdcc2, and the PR patch is byte-identical between 1413ebdcc2 and d60e80a868 (both diffs compare equal once index/@@ lines are excluded). The only variable between a pass and a fail is main moving from 576ee81ee6 to b2bc03ab5b. Independently, the command under test is aws configure set aws_access_key_id ..., which contains no filesystem path, so the path-tier exemption in this PR cannot reach it.
  • Coverage Gate -- no finding of its own. Its log reads backend-test=failure -- failing closed, and Coverage Combine skipped.
  • PR Readiness -- 1 blocking item, aggregating the above.

Meanwhile every review lane is green on this head: GPT 5.6, Opus 4.8, Design Review, First Principles and Security Scope Review all pass. Board is 89 pass, 6 fail, 6 skipping.

So this PR is waiting on main, not on itself. Once test_running_and_turn_running_slot_readers_are_enumerated is fixed on main, a rebase should take it green. I am not merging and not approving.

@Pearcekieser
Pearcekieser force-pushed the fix/shell-text-leaves-path-tier branch from d60e80a to ae819db Compare September 22, 2026 06:12
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 22, 2026
The tool gate's path tier reads a PATH. A shell tool's title and command are
command text, which the gate deliberately does not match paths in: the OS
sandbox is what holds the credential stores away from the shell, and the
spec's "does not match PATHS in command text" records why every text
matcher there was removed. Yet hooks.on_tool_call and the
_resolve_permission title and tool_input tiers still resolved every shell
target as a filename. That never matched, but it cost a resolver round-trip
per shell call and, under a resolver stall, refused the command as
"Blocked: access to sensitive path: cd /x && grep ..." -- a non-path named
as a credential, which is what the agent then acted on.

Gate shell targets by the event's is_shell (the client's classification of
the tool frame, the same provenance the shell tiers already trust): a shell
tool's title, command and payload strings skip the path tier; every
non-shell target is gated exactly as before. The shell corpus classifiers
(scripts/deny_diff.py, security-conductor verify_fix.py) drop the path tier
from their composites to match the gate they measure. The residual is
stated in the spec: a shell tool whose title is a bare path is command text
too and is left to the sandbox with its command.

Refs kirodotdev#10255
@chenmingwei23
chenmingwei23 force-pushed the fix/shell-text-leaves-path-tier branch from ae819db to ac44c08 Compare September 22, 2026 07:07
@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 Sep 22, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor

Rebased to a new head ac44c088b0 (was ae819dbd90), and the reason is specifically about three stuck lanes rather than anything wrong with your diff.

Internal Content Scan is now green: clean, no internal marker in the added lines. That lane is a real Actions check, so re-running it worked (attempt 2, 07:02 to 07:04).

Security Scope Review, Opus 4.8 Review and GPT 5.6 Review could not be cleared the same way. All three published a fail-closed verdict at 06:22 while the GitHub App installation quota was exhausted, and their check runs show started_at == completed_at at 06:22, meaning a verdict was posted rather than a review actually run. Fresh runs of all three completed at 07:01 to 07:03 and those check runs did not move, because a posted verdict stays pinned to its head. The only thing that makes them re-measure is a new head, which is what this push is for. No override was sought, and none is warranted for a verdict nobody ever measured.

What was preserved: still one commit, author still you (Pearce Kieser); the committer line reads differently only because I replayed it. The patch is byte-identical to the reviewed diff, verified by comparing both diff bodies with index/@@ lines excluded. New base is current main 64fbda5f91, whose only two commits since your base touch CHANGELOG.md and README.md, so no code changed and nothing needed re-testing.

For the record on the previous head: every backend lane, macOS (2) and Coverage Gate were all green there with no code change, so those reds were base defects, and the test_running_and_turn_running_slot_readers_are_enumerated tripwire cleared via #12718.

The field-evidence paragraph I offered earlier is still yours to fold into the body whenever you next push, if you want it there. I have not touched your description. Not merging and not approving.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 22, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor

Fully green on ac44c088b0: 95 success, 5 skipped, zero failures, zero neutral, nothing in flight. PR Readiness reports Eligible automated validation passed for this revision, the overall commit status is success, mergeable is true, and there are no BLOCK-MERGE markers. Still 1 commit, authored by you.

The new head did what it was for. All four lanes that had been pinned to fail-closed verdicts from the 06:22 installation rate-limit window re-measured properly and came back green, GPT 5.6 Review with a real 3.5-minute run rather than the zero-duration posted verdict it had before.

Nothing in this diff ever needed changing. Every red this PR carried today came from its base: the mypy payload_kind error, the all chunk bundle budget, the test_running_and_turn_running_slot_readers_are_enumerated tripwire on three platforms (#12713, fixed by #12718), the Windows-only test_decisions_tool_risk_end_to_end failure, and Coverage Gate failing closed behind the backend matrix. No override was used anywhere, and none was needed.

mergeable_state is still blocked, which is purely the missing review approval. That is the only thing left, and it is not mine to give: I am not merging and not approving. The field-evidence paragraph offered earlier is still yours to fold into the body if you want it there; I have not touched your description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants