Skip to content

guardrails: hooks ship false-positive over-fires with no per-hook fixtures or shared precision convention (6-issue class: diff-scope, quoted-arg, boolean-intent, stdin, path-branch) #547

Closed as not planned

Description

@kyle-sexton

Lane: triage · Category: improvement (prevention umbrella) · Source: triage cycle 2026-07-19 — routing #543/#544/#545/#546 surfaced a class with no prevention layer.

Pattern — guardrails hooks recurrently ship false-positive over-fires, each caught in production and hand-filed

Open guardrails-hook false-positive / imprecision issues, one root class, zero prevention:

Note: #544 and #543 were filed ~3s apart by two babysit workers — the same over-fire found twice, independently, in production.

Root cause

Two systemic gaps behind every instance:

  1. No false-positive regression fixtures per hook. Hooks ship with no golden corpus of "commands/edits that MUST stay quiet" alongside "that MUST fire." So an over-fire is only discoverable by a worker tripping it live, then hand-filing — the pipeline pays at production time, repeatedly, for a defect a fixture would catch at hook-authoring time. (Directly analogous to source-control:babysit-prs: one shared authorship/finding/approval classifier + golden fixtures; gate script owns the merge-ready boolean (6-issue class) #534's shared-classifier + golden-fixtures argument for babysit, and quality-net: skill changes ship with zero regression detection — 120 evals.json unexecuted, skill-quality:check uninvoked (staged eval/gate/pass^k umbrella) #530's skill-regression net.)
  2. No shared precision convention. The same imprecision recurs across independent hooks: whole-file instead of diff-scoped (guardrails: cli-flag-verify PostToolUse hook scans whole file, warns on pre-existing lines outside the edited hunk #543/guardrails: cli-flag-verify PostToolUse hook flags pre-existing unrelated lines (not diff-scoped) #544), substring co-occurrence instead of structural match (block-hook-bypass: false-fires when a Bash command contains both an echo token and a redirect (script-stdout capture, or quoted-string arguments) rather than an actual file-authoring bypass #546), quoted-argument blindness (block-hook-bypass: false-fires when a Bash command contains both an echo token and a redirect (script-stdout capture, or quoted-string arguments) rather than an actual file-authoring bypass #546), boolean-intent inversion (guardrails:flag-commit-pr-skill-bypass: advisory false-fires on canonical git commit -F - with inline heredoc Co-Authored-By trailer (requires BOTH markers, contradicting documented "either marker -> stay quiet" intent) #545), unbounded stdin (guardrails: cli-flag-verify.sh still reads fd0 unbounded (last Win32-stall stdin site) #446), path-branch over-broad matching (guardrails: hardcoded-path-check false positives — repo-path branch flags all paths under home; percent-env interpolations flagged #389). Each is a fresh hand-fix with no reusable discipline.

Observed vs expected

  • Observed: guardrails hooks are authored ad hoc; false-positives are found by babysit workers during real passes and filed one at a time; fixing one hook teaches the next nothing.
  • Expected: (a) a per-hook golden-fixture harness (true-positive MUST-fire + false-positive MUST-stay-quiet cases; every filed instance above becomes a fixture), run in CI on any plugins/guardrails/hooks/** change; (b) a documented hook-precision convention — diff-scope PostToolUse:Edit checks to the changed hunk (whole-file only for new files), match structural producers not token co-occurrence, ignore tokens inside quoted args, bound stdin reads, and prefer either/or marker logic where "already-canonical → stay quiet" is the intent. New hooks and the fixes for the members conform to it.

Category

improvement (prevention). Kills a recurring false-positive class + the babysit-worker-time it burns finding them live, instead of N hand-fixes plus indefinite recurrence.

Relations

Members #389 #390 #446 #543 #545 #546 (#544 dup of #543); #534 (same fixtures-as-prevention pattern for the babysit classifier); #530 (skill regression net — behavior-level sibling); #540 (shared dogfood-filing — the #543/#544 concurrent-duplicate is its motivating example); #531/#532 (sibling prevention umbrellas). Decompose candidate.

Activity

  1. added
    needs-triage
    on Jul 19, 2026
  2. kyle-sexton commented on Jul 19, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage. · Category: improvement (prevention umbrella) · Priority: priority: high (kills a recurring false-positive class + the babysit-worker time spent finding over-fires live). Routed needs-human + wayfind: design. Decompose candidate.

    Why needs-human

    Two systemic deliverables, both design decisions the maintainer must shape (the body has the full analysis):

    1. Per-hook golden-fixture harness — true-positive MUST-fire + false-positive MUST-stay-quiet corpus per hook, run in CI on any plugins/guardrails/hooks/** change; every filed member becomes a fixture. (Same fixtures-as-prevention pattern as source-control:babysit-prs: one shared authorship/finding/approval classifier + golden fixtures; gate script owns the merge-ready boolean (6-issue class) #534 / quality-net: skill changes ship with zero regression detection — 120 evals.json unexecuted, skill-quality:check uninvoked (staged eval/gate/pass^k umbrella) #530.)
    2. Documented hook-precision convention — diff-scope PostToolUse:Edit to the changed hunk (whole-file only for new files), structural-producer match not token co-occurrence, quoted-arg-ignore, bounded stdin, either/or marker logic.

    The harness shape + the convention content are the design; not a defaultable fork.

    Members (cross-linked, mostly already routed ready this session)

    #543 (diff-scope) · #544 (dup of #543) · #545 (||→&&) · #546 (echo+redirect) · #446 (stdin) · #389/#390 (path-check). Recommend the member fixes land AS the first fixtures of the harness rather than as isolated patches. Related: #534, #530 (sibling prevention), #540 (shared dogfood-filing — the #543/#544 concurrent-dup is its motivating example).

  3. added
    needs-human
    wayfind: design
    and removed
    needs-triage
    on Jul 19, 2026
  4. kyle-sexton commented on Jul 19, 2026

    @kyle-sexton
    MemberAuthor

    Dogfood example (work lane, this session): multiple implementation subagents reported the /commit and /pull-request advisory hooks firing as false positives on direct git commit -F - / gh pr create even when the canonical contract was fully met (heredoc message with required trailers; PR body with ordered sections + closing keyword + non-empty ## Related, confirmed by green pr-title/pr-issue-linkage). The advisory suggested routing through the skills when the raw path already satisfied them — recurring across the #434, #422, #413 workers. If the commit/PR skill-suggestion advisory isn't already in this issue's 6-hook class, it's a 7th sibling: same root (fires without checking whether the canonical contract is already satisfied).

  5. kyle-sexton commented on Jul 19, 2026

    @kyle-sexton
    MemberAuthor

    Decision brief (2-minute read)

    Prepared by an AI agent from a read-only checkout at 789ec6c — verify before acting. This is a decision brief, distinct from the triage routing note already on this issue; it does not supersede the wayfind: design / needs-human routing.

    Problem. Guardrails hooks recurrently ship false-positive over-fires (#389/#390/#446/#543/#544/#545/#546), each found live by a babysit worker and hand-filed. The umbrella asks for two prevention layers — per-hook fixtures and a shared precision convention — so the class stops recurring.

    Today (verified). One premise in the issue body is inaccurate and it changes the scope:

    • A per-hook false-positive fixture harness already exists and is CI-gated. Every hook has a plugins/guardrails/hooks/<name>.test.sh; they share plugins/guardrails/hooks/guardrails-test-helpers.sh; scripts/run-plugin-tests.sh runs all plugins/**/*.test.sh; .github/workflows/ci.yml gates on it ("Run plugin contract tests"). MUST-stay-quiet negative cases are pervasive — cli-flag-verify.test.sh alone has ~31 (prose flag, shell/fenced comment, cross-span, table cell), secret-pattern-detection.test.sh ~19, hardcoded-path-check.test.sh ~17. So "no per-hook fixtures / no golden MUST-fire+MUST-stay-quiet corpus" is not the real gap.
    • What is genuinely missing: (1) a documented precision convention — there is a cross-hook convention precedent at docs/conventions/hook-telemetry/, but no hook-precision sibling, so each hook reinvents precision ad hoc; (2) the discipline that binds every filed production false-positive to a new MUST-stay-quiet case in that hook's existing .test.sh (today the FP is filed as an issue, never as a fixture); (3) specific uncovered defects — chiefly diff-scoping: cli-flag-verify.sh reads only tool_input.file_path (line 50) and re-scans the whole file in emit_fragments() (lines 97-117), so its test suite cannot assert hunk-scoping because the hook never reads new_string.

    Options.

    Related.

  6. kyle-sexton commented on Jul 19, 2026

    @kyle-sexton
    MemberAuthor

    Operator decision (2026-07-19, decision-session batch 3; relayed).

    ACCEPTED — the decision brief's RECOMMENDED option verbatim.

    Re-intake: removing needs-human, adding priority: needs-triage for routing.

  7. added
    needs-triage
    and removed
    needs-human
    on Jul 19, 2026
  8. kyle-sexton commented on Jul 20, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Routing status: ready per ratified decision. Operator ACCEPTED Option A verbatim: the per-hook fixture harness already exists and is CI-gated (*.test.sh per hook + guardrails-test-helpers.sh + run-plugin-tests.sh, gated in ci.yml) — the real gap is (1) a documented hook-precision convention sibling to docs/conventions/hook-telemetry/, and (2) the discipline that every filed production false-positive becomes a new MUST-stay-quiet fixture case in that hook's existing test file, not a fresh one-off. The 6 members (#543, #544, #545, #546, #446, #389, #390) land as the first conforming fixes under this convention, not as a from-scratch harness build (Option C explicitly rejected — would duplicate existing CI infra).

    Priority: not in the explicit scaling-chain list — downgraded from priority: high to priority: medium. wayfind: design removed (approach settled).

  9. removed
    needs-triage
    wayfind: design
    on Jul 20, 2026
  10. 9 remaining items

  11. kyle-sexton commented on Jul 21, 2026

    @kyle-sexton
    MemberAuthor
    No description provided.
  12. removed their assignment
    on Jul 21, 2026
  13. kyle-sexton commented on Jul 21, 2026

    @kyle-sexton
    MemberAuthor

    Picked by work lane, released unclaimed: this issue self-flags "Decompose candidate" (see closing line) and bundles a golden-fixture harness + shared precision convention across 6 member hooks — too broad for a single clean PR under the one-PR-per-issue contract. Routing to /work-items:decompose instead of direct execution. amendment-round: 15

  14. kyle-sexton commented on Jul 22, 2026

    @kyle-sexton
    MemberAuthor

    Another live instance of the path-branch over-broad-matching member (#389/#390's class), caught during a disk-hygiene audit session today.

    hardcoded-path-check.sh fires on any absolute path appearing anywhere in file content, not just an operative/destination path the write is actually creating. Reproduced 3x in one session:

    1. A disk-hygiene:clean plan JSON's evidence field quoting a comparison path (diff against C:/Users/.../chezmoi/AGENTS.md: identical) — purely documentary text explaining why a candidate is a duplicate, not a path the tool would ever write to.
    2. Same pattern again on a second plan file's evidence strings.
    3. A session-flow:running-retro checkpoint subagent's own findings draft tripped the same guard while it was describing the first two occurrences (quoting the flagged text as evidence of the bug).

    All three are content that talks about a path for documentation/evidence purposes, not a hardcoded path that would break portability if a script executed it. Confirms #547's root-cause framing: "path-branch over-broad matching (#389)" — the branch doesn't distinguish an operative path (real portability risk) from a quoted/documentary path (the whole point of an audit-evidence field), and JSON plan files / markdown findings docs are exactly the file shapes where "explaining what path was found" is the entire content.

    Workaround used each time: rewrite the evidence string to ~/-relative form. Fine for a one-off, but for an audit tool whose entire job is reporting concrete on-disk paths as evidence, this will recur every time.

  15. added
    needs-human
    on Jul 23, 2026
  16. kyle-sexton commented on Jul 24, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during an attended-queue pass.

    New instance of the redirect/precision class, observed 2026-07-23 in melodic-software/ci-runner: block-hook-bypass.sh blocked the work-items plugin's own inlined lane-telemetry upsert snippet (the byte-identical block attend-queue/work-loop carry from the loop-lane convention). The snippet contains printf '%s\n' "$LIST" | sort (no redirect), gh api ... >/dev/null, and echo "..." >&2 — the hook fired "BLOCKED: echo/printf > file write bypasses Write/Edit hooks" although no file is written: the only redirect targets are /dev/null and stderr. Removing every echo/printf that lexically precedes a > let the same logic through unchanged.

    Two consequences worth a fixture each:

    • False positive on redirect targets that are not files (>&2, >/dev/null), including when the echo/printf and the > belong to different pipeline members.
    • A shipped plugin snippet that consumers execute verbatim (work-items telemetry upsert; the loop-lane convention mandates it byte-identical across lanes) is un-runnable under guardrails — either the hook gains precision or the snippet needs a hook-compatible shape upstream; tracked here since the hook side owns the precision convention.
  17. kyle-sexton commented on Aug 13, 2026

    @kyle-sexton
    MemberAuthor

    Frontier disposition (drain session)

    Ruling: Close as not planned.

    Hook false-positive precision class is owned by the guardrails umbrella (#532); child observation closed as folded.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanstatus: ready

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions