Labels
agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.status: readyTriaged, unblocked, and fully specified; eligible to pick up.
Description
Problem
Session: Windows 11, Claude Code 2.1.278, auto mode, guardrails 0.35.0, PowerShell lane.
- A single blocked command produced two long denial paragraphs, one from block-no-verify and one from block-dangerous-git (guardrails: read-only git inside {} blocked by two guards, with irrelevant commit guidance, Bash-lane advice, and no narrow lever #4235).
- Every PowerShell call in the session went through the full guard chain. The operator's own notes record guard hooks costing about 5x more per PowerShell call on this machine. That figure is not measured by this audit.
- The two false-positive classes in guardrails:
& $var script record dirblocked as a file write; block reason names the wrong cause #4234 and guardrails: read-only git inside {} blocked by two guards, with irrelevant commit guidance, Bash-lane advice, and no narrow lever #4235 are not described in the README, so an operator or agent hitting them has no documented rewrite.
Root cause
Traced by reading the installed source; not executed (the audit session's Bash tool was blocked by another plugin, so nothing was profiled and packet integrity is ungradable).
F5. The dispatcher runs every guard after a block.
run-guards.shlines 367-393:run_fromsources every remaining guard after one exits 2. The code only raises RC (lines 346-347) and never stops early.- On the PowerShell lane, 8 guards run, and the
ps-command.shlibrary is sourced once per event (lines 126-131). That is 2300+ lines of bash parsed on every PowerShell call. RUN_GUARDS_PROFILE=1(lines 340-345) is the built-in way to measure. Not run.
F6. README gap.
- A search of README.md for
& $, "computed", "positional", and "Path+Value" found no coverage of the guardrails:& $var script record dirblocked as a file write; block reason names the wrong cause #4234 class, although it is a deliberate choice pinned in the tests.
Related: #3508, #3623 (hook performance).
Proposed fix
Cheapest first:
- README, block-hook-bypass section:
& $var script arg1 arg2(a call through a variable followed by two or more positionals with at least one bare word) is blocked as a file write. Rewrite it as& 'C:/literal/path.exe' script args, or put a flag first. - README, PowerShell sink section: a
foreach { git ... }loop is refused by the git guards regardless of verb. Unroll it into flatgit -C <path> ...;statements. - Profile the allow path with
RUN_GUARDS_PROFILE=1on a Windows host to confirm or refute the per-call cost. - Stop after the first block. This removes duplicate denial paragraphs and saves time on the block path. Weigh it against losing all reasons in one denial.
Acceptance criteria
- README's block-hook-bypass section documents the
& $varpositional rule and the literal-path rewrite. - README's PowerShell sink section documents the
{}/()git refusal and the unrolled-statement rewrite. - A command blocked by two guards produces at most one full-length denial paragraph.
- A
RUN_GUARDS_PROFILE=1measurement of the PowerShell allow path on Windows is recorded in the issue or the README.
Found by /plugin-quality:audit (run 20260919T170952Z).
Metadata
Metadata
Assignees
Labels
agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.status: readyTriaged, unblocked, and fully specified; eligible to pick up.
Type
Fields
No fields configured for Task.
Activity
kyle-sexton commentedon Sep 23, 2026
This was generated by AI during triage.
Decision defaulted: keep
run-guards.shrunning the full remaining chain after a block (a multi-reason denial is worth more to the operator than the perf save on an already-failing path); ship the two README additions (owned by #4234/#4235 respectively) and aRUN_GUARDS_PROFILE=1measurement as the uncontroversial part — veto before mergekyle-sexton commentedon Sep 23, 2026
This was generated by AI during triage.
Agent Brief
Type: Task
Summary: The guard dispatcher keeps running every remaining guard after one has already blocked a command, and the plugin's documentation does not yet describe two known PowerShell over-block classes or their rewrites.
Current behavior:
Once any guard in the dispatcher's chain exits with a block, the dispatcher still runs every remaining guard in the chain before finishing, rather than stopping at the first block. On the PowerShell lane this means a blocked command can produce multiple long denial paragraphs, one per guard that also objects, and pays the parsing cost of every remaining guard's library on a call that is already refused. Separately, the plugin's documentation does not describe the call-through-a-variable positional-operand block or its literal-path rewrite, nor the read-only-git-inside-grouping block or its unrolled-statement rewrite.
Desired behavior:
Defaulted decision: keep the dispatcher running the full remaining guard chain after a block — a multi-reason denial is judged more valuable to the operator than the time saved on a path that is already failing, so this is not changed. Ship the two documentation additions instead: a section describing the call-through-a-variable positional-operand rule and its literal-path (or flag-first) rewrite, and a section describing the brace/parenthesis grouping git refusal and its unrolled-flat-statement rewrite. Also record one measurement of the PowerShell allow-path cost, taken with the dispatcher's existing profiling mechanism on a Windows host, in the plugin's documentation.
Maintainer-vetoable alternative: stop the guard chain at the first block instead of running the remainder, accepting the loss of every additional reason in one denial in exchange for the time saved on an already-blocked call.
Key interfaces:
Acceptance criteria:
Out of scope:
docs(guardrails): pin dual-sink after-block denials; serialize #4236 …
docs(guardrails): name Windows RUN_GUARDS_PROFILE recheck for #4236
docs(guardrails): document after-block continuation and PS over-blocks (
docs(guardrails): document PowerShell no-token over-blocks and scoped…
docs(guardrails): correct released changelog entries in place
kyle-sexton commentedon Sep 29, 2026
Posted from the 2026-09-29 audit of the Cursor run (499 PRs, 2026-09-27 to 2026-09-29). The owner authorized fixing the findings; merging is not authorized. Fix PR: #5340 (draft).
Reopened. #4848 closed this with "Closes #4236" while its own body said the Windows
RUN_GUARDS_PROFILEcost is unmeasured. Acceptance criterion 3 (a recorded per-guard timing of the PowerShell allow path on a Windows host) is not delivered. Criteria 1, 2 and 4 are met: the README notes, the dual-sink test atrun-guards.test.sh:530-540, and the dispatcher unchanged.#5340 removes the to-do prose and the "this Linux checkout" aside from the README, so user docs no longer carry it. The measurement stays open here (the earlier audit row said "file follow-up"; reopening is the same tracking without splitting the issue). No duplicate exists: searched 2026-09-29 for
RUN_GUARDS_PROFILEand "guardrails Windows measurement".Operator steps on a Windows host with Git Bash: from
plugins/guardrails/hooks, run theBash|PowerShellrow ofhooks.json(its args are pinned inrun-guards.test.shat theBASH_ROW_ARGSdefinition used at L1065) withRUN_GUARDS_PROFILE=1and a PowerShell payload on stdin, for example:Run it 5 times. Paste the per-guard
run-guards: <ms> ms rc=<n> <guard>lines and the wall time for one run, and say which host and load. Record the figure in the README's hook-budget section or on this issue. Close when recorded.fix(guardrails): judge more shell shapes, declare node, correct docs (#…
kyle-sexton commentedon Sep 30, 2026
Owner decision (2026-09-30): Only acceptance criterion 3 is still open (criteria 1, 2 and 4 are met). An agent will take the measurement through /fleet:reach on melo-desk-001's Windows lane (windows-shell, ssh-admin), the always-on Windows host; melo-lap-001 (reachable only on AC) is the fallback or a second data point. The probe is read-only and non-elevated. Steps: (1) confirm Git Bash and a plugin checkout exist there; if none,
git clone --depth 1into a scratch dir and leave existing worktrees alone. (2) From plugins/guardrails/hooks, run theBash|PowerShellrow of hooks.json (args pinned at BASH_ROW_ARGS in run-guards.test.sh, used at L1065) with RUN_GUARDS_PROFILE=1 and stdin{"tool_name":"PowerShell","tool_input":{"command":"git status"},"cwd":"<repo>"}; profiling needs EPOCHREALTIME (run-guards.sh:603-605), which Git Bash's bash 5 provides. (3) Run it 5 times and capture the per-guardrun-guards: <ms> ms rc=<n> <guard>stderr lines and each run's wall time, plus the host, load (idle or not) and bash version. (4) Record the per-guard ms and wall-time table in the README hook-budget section (plugins/guardrails/README.md, "Hook budget accounting") through a normal PR, or as a comment here, then close #4236 as completed. The dispatcher keeps running the full chain after a block (criterion 4 test at run-guards.test.sh:530-540); the measurement does not change that. No credentials, secrets, billing, elevation or deletion are involved.Approved by the owner with all consensus recommendations on 2026-09-30 (three read-only researchers, majority or judge).
Next: run the probe on melo-desk-001;
needs-humanstays until the result is recorded here or in the README.kyle-sexton commentedon Sep 30, 2026
Acceptance criterion 3 measured: per-guard timing of the PowerShell allow path on a Windows host, via the existing
RUN_GUARDS_PROFILE=1mechanism.Host and conditions
melo-desk-001(Windows, Intel Core Ultra 9 285K), reached through the WSL-to-Windows-on-this-machine route of/fleet:reach(WSL interop, console accountKyleSexton; no ssh hop needed because the agent runs on this machine). Read-only and non-elevated.Win32_Processor.LoadPercentagewas 58 before the runs and 68 after; about 10 GB free RAM.bash 5.3.15(1)-release(EPOCHREALTIMEpresent), node v24.21.0, git 2.55.0.windows.3.origin/mainat7fceea88baa99d9e68c24837459a51a92e6d3991intoC:\Users\KyleSexton\claude-lane-sandbox\probe4236(scratch, removed afterwards; existing worktrees untouched).Command (run under Git Bash from
plugins/guardrails/hooks, 5 times;CLAUDE_PLUGIN_ROOTset to the clone'splugins/guardrails). Args are theBash|PowerShellrow ofhooks.jsonverbatim:Wall time is
EPOCHREALTIMEaround the whole pipeline (node launcher, bash start, all guards). Every run exited 0 with empty stdout (allow).Raw
run-guards: <ms> ms rc=<n> <guard>lines, ms per run (1, 2, 3, 4, 5)Run 1 wall time includes cold caches; runs 2 to 5 span 160 to 177 ms.
What it shows against criterion 3: a recorded per-guard timing of the PowerShell allow path on a named Windows host, produced with the dispatcher's existing profiling mechanism, is now on this issue. On a busy host the guards total about 39 to 45 ms; the rest of the 160 to 270 ms wall time is the node launcher and Git Bash start-up. Criteria 1, 2 and 4 were confirmed met in the 2026-09-29 comment; the dispatcher was not touched, so the run-the-full-chain-after-a-block behavior is unchanged.
Closing as completed. The figure can be copied into the README "Hook budget accounting" section in a later docs pass if wanted; the criterion allows "in the issue or the README".
fix(guardrails): allow a computed PowerShell call whose target resolv…
fix(guardrails): allow read-only git inside PowerShell grouping (#5548)