Repository navigation
fix: a hook fails open even on a panic - #29
Merged
Merged
Conversation
Errors already answered {}, but a release build aborts on a panic, which
the host would show as a hook error, and a failed write to stdout could exit
2, which Claude Code treats as blocking. The hook command now installs a
panic hook that answers {} with status 0 before the abort, and ignores a
failed print. A test sends every host malformed events, an unwritable cache
and a forced panic (debug builds only).
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.
A Scopelet failure must never disturb the agent.
{}. A panic in a release build (panic = "abort") would have exited by SIGABRT, and a failed write to stdout could exit 2, which Claude Code treats as a blocking error. Thehookcommand now installs a panic hook that prints{}and exits 0 before the abort, and ignores a failed print.a_hook_fails_open_whatever_goes_wrongsends Claude, Codex and OpenCode malformed events, an unwritable cache and a forced panic (trigger compiled in debug builds only) and requires status 0 with JSON.{}with status 0; the slowest call (a 30 MB output) takes 164 ms against the 5 s hook timeout.