Skip to content

fix(guardrails): check-bash-file-changes swallows unexpected errors with no "guard did not run" notice #6905

Closed

Description

@kyle-sexton

Problem

plugins/guardrails/README.md:302 says "Every hook says so when it could not run": every registered hook installs the shared abort boundary and turns an unexpected exit into a one-line "guard did not run" notice. plugins/guardrails/hooks/check-bash-file-changes.mjs is registered on three hook events (hooks.json:86,205,222) but is a Node module, not a shell hook, so it never installs abort-boundary.sh. Its entry point ends with if (invokedDirectly()) main().catch(() => {}); (line 520), so any exception main() does not handle itself exits 0 with no output.

The hook already reports its known skips as notes ("not examined: ..."); only unexpected failures are silent. When one happens, the shell-write check did not run and nobody is told, which is the case the abort boundary exists to prevent.

Found by a Codex review on #6852, which cites this README claim.

Fix

Make the catch report the same way the abort boundary does: write a one-line "guardrails: check-bash-file-changes did not run: " notice on stderr and as a systemMessage, then exit with the hook's declared posture (fail-open). Alternatively, narrow the README claim to the shell hooks and name the Node hook's behavior. The first removes the gap; the second only documents it.

Verification

A test that makes main() throw (for example, an unwritable CLAUDE_PLUGIN_DATA) and asserts the notice appears and the exit status matches the declared posture. Per the hook-precision convention, include a stay-quiet test that a normal run emits nothing new.

Related

Activity

  1. added
    needs-triage
    on Oct 11, 2026
  2. github-actions commented on Oct 11, 2026

    @github-actions
    Contributor

    Thanks for the detailed report. I confirmed plugins/guardrails/hooks/check-bash-file-changes.mjs ends with main().catch(() => {});, so an unexpected exception inside main() exits 0 with no stderr or systemMessage output — the one case the shared abort boundary exists to cover, but this Node hook never installs it. The known-skip paths (missing snapshot, oversized git status, etc.) already report as notes; only the unhandled-exception path is silent, as described.

    Both fix directions you outlined (report a "did not run" notice at the hook's declared fail-open posture, or narrow the README claim) sound reasonable; which to take is a maintainer call. #6674 and the closed #6709 are related prior work on this same hook but don't cover this specific gap, so this doesn't look like a duplicate.

    Automated triage. A maintainer reviews it.

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-triage

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions