fix: advisory-mode Stop hook emits its finding instead of returning silently - #8
Merged
Merged
Conversation
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.
Found by dogfooding Leadline on a real Claude Code install.
Bug. In
advisorymode the Stop hook returned bare{}.decision.blockis false by design in advisory, and the Stop path had no advisory branch (unlike PostToolUse), so it fell through to silence. The finding was still written to the trace, but nothing surfaced live in the session.Why it mattered. The README tells every new user to start with
--dry-run. In exactly that mode the product's headline behavior, that the agent cannot claim "done" while an obligation is unmet, was invisible. A first run showed route corrections and receipt failures but never a completion-gate finding.Fix. One guarded line, after the existing enforce-block and anti-lockup branches:
systemMessagerather thanhookSpecificOutput.additionalContext: per the Claude Code hook docs,systemMessageis a user-visible warning, while StopadditionalContextcontinues the agent loop, which would undermine the advisory fail-open invariant.Verification (independently reproduced by the reviewer):
npm test232/232 in a clean worktreenpm run benchunchanged (62.5% / 61.1% / 0-4 / 1-1 / 0-2){"systemMessage":"Unmet obligation: ... Satisfy it via ... Alternatively, explicitly abstain"}and nodecisionkey, so it still never blocks{}, so there is no false noise🤖 Generated with Claude Code