Repository navigation
fix: advisory hooks fail open with one stderr line (#3713) - #4853
Merged
Merged
Conversation
Stop/PostToolUse advisory hooks that died of a hard error left Claude Code a hook_non_blocking_error with empty stderr. hook-failure-audit and index-drift install an EXIT trap after the kill switch; unexpected status writes one named line and exits 0. guard_launch_monitor catches SystemExit other than 0 and BaseException the same way. Chosen status is 0 only. claude-ops 0.62.14, instruction-placement 0.15.8, disk-hygiene 0.27.1. Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
…t 0.26.2 #4000 already occupies 0.26.2 on cursor/4000-root-children-loose-files-37e9. This advisory-hook fail-open is a patch, so land at 0.26.3 rather than 0.27.1. Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
…boundary A Stop payload naming a transcript that is not on disk used to die with empty stderr. The abort catch now fail-opens with one line; pin that, and keep an empty existing transcript silent. Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
Contributor
|
PR body contract — issue linkage This PR body does not yet satisfy the issue-linkage contract:
Edit the body and this comment updates itself on the next run. |
The injected exit 3 happens before the hook reads stdin. Piping the payload left printf writing to a closed fd; with pipefail that was SIGPIPE 141, the #4458 abort-boundary harness bug, not a hook failure. Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
Release the guard-launch fail-open as disk-hygiene 0.26.4, above main 0.26.3. Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
Shellcheck SC2034 flags empty_out. The assertion only checks the exit code. Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3713
Summary
Advisory hooks that die of a hard error now fail open with exactly one stderr line, so Claude Code never records
hook_non_blocking_errorwith empty stderr.Fix
claude-opshook-failure-audit.sh: EXIT trap after the kill switch writesclaude-ops hook-failure-audit: did not run (status N); fail-openand exits 0. Chosen status is 0 only.instruction-placementindex-drift.sh: the same trap shape (instruction-placement index-drift: …).disk-hygieneguard_launch_monitor.py:maincatchesSystemExitother than 0 andBaseException, writes one stderr line, and returns 0.SystemExit(0)is re-raised soraise SystemExit(main())still works. Empty transcript is quiet; missing/unreadable transcript fail-opens with one stderr line.secrets-checkis out of scope (it already installs the shared abort boundary).Verification
hook-failure-audit PASS=133 FAIL=0. index-drift 23 passed, 0 failed. guard_launch_monitor 45 tests OK. Empty / malformed / minimal payloads stay exit 0. An injected
exit 3after the trap exits 0 with exactly one stderr line. The inject feeds stdin from a file so a closed pipe cannot turnpipefailinto SIGPIPE 141 (#4458).claude-ops 0.62.14 (above in-flight 0.62.13 on #4050). disk-hygiene 0.26.3 (above in-flight 0.26.2 on #4000; #4009 remains 0.27.0). instruction-placement 0.15.8.