Skip to content

fix(no-vibes): exempt pure-display echo/printf from destructive matcher (false positive)#31

Merged
waitdeadai merged 1 commit into
mainfrom
fix/no-vibes-echo-display-fp
Jun 1, 2026
Merged

fix(no-vibes): exempt pure-display echo/printf from destructive matcher (false positive)#31
waitdeadai merged 1 commit into
mainfrom
fix/no-vibes-echo-display-fp

Conversation

@waitdeadai

Copy link
Copy Markdown
Owner

What

is_destructive_bash() in hooks/no-vibes.sh matches each destructive pattern as a
substring of the whole command (and a de-quoted copy). So a benign command that
only displays a destructive op — e.g. echo 'reminder: avoid git push --force on shared branches' — is wrongly blocked (exit 2). This is a real, daily false
positive: documentation/reminder echos and comments mentioning destructive ops get
gated.

Fix (narrow, bypass-safe)

Add a precision pre-guard: exempt a command only when it is a pure-display
echo/printf of literal args with no way for the mentioned text to execute or
redirect
— no pipe/background/chaining/redirect (| & ; < >), no backtick, no
$( command substitution. Anything that can execute or redirect (bash -c '…',
$(…), echo … > /dev/sda, echo …; rm …) falls through to the unchanged
matcher. This cannot open a bypass: a lone echo/printf of literal text has no
execution or write path.

Tested

  • Added regression fixture tests/stress/no-vibes/negative/40-echo-mentions-force-push.json
    (negative = expect allow). It failed before the fix, passes after.
  • bash tests/stress/run.sh --hook no-vibes69/69 pass (was 68/69 with the new
    fixture).
  • bash tests/test-pack-loader.sh17/17 pass.
  • Full suite: my change takes it from 332→333 pass (the one flip is this fixture). The
    remaining 5 failures are pre-existing and unrelated — all in no-fake-cite/positive
    (arxiv/doi/citation patterns), failing identically with or without this change. Not
    touched here.
  • Measured with hookbench: on the same
    command corpus the patched hook goes false-positive rate 33% → 0% with recall held
    at 100%
    (the real git push --force origin main still blocks; only the echoed
    mention is now allowed).

Out of scope

The 5 pre-existing no-fake-cite positive failures (a separate hook) — flagged here so
they're visible, but not addressed in this PR.

A benign command that only displays a destructive-op reminder (e.g. an echo of a force-push or recursive-delete note) was blocked, because the matcher substring-matches the whole command. Add a narrow pre-guard exempting pure-display echo/printf with no pipe/redirect/chaining/background/backtick/$( substitution; anything executable or redirecting falls through unchanged (no bypass). Adds regression fixture 40 (negative). no-vibes stress 69/69; pack-loader 17/17; measured FPR 33%->0% recall 100% via hookbench.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@waitdeadai waitdeadai merged commit c80dfe0 into main Jun 1, 2026
2 checks passed
@waitdeadai waitdeadai deleted the fix/no-vibes-echo-display-fp branch June 1, 2026 17:44
waitdeadai added a commit that referenced this pull request Jun 1, 2026
…ix) (#32)

Marks the fix from PR #31 (pure-display echo/printf exemption in the destructive matcher) as a discrete release so a /plugin update maps the change to its own version.

Co-authored-by: Fernando Lazzarin <263019791+waitdeadai@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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