Repository navigation
fix: answer Claude Code SessionEnd with a valid response (v0.2.2) - #226
Merged
Merged
Conversation
polyhook 0.1.11 labeled Claude Code SessionStart/SessionEnd as Gemini CLI,
so steplock answered {"decision":"allow"} and Claude Code reported the
hook as failed on every session end. Require polyhook 0.1.12, which tells
them apart via CLAUDE_PROJECT_DIR (polyhook/polyhook#81). Bump to 0.2.2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
validate_dir and run_validate never returned Err, so the Validate arm's "validate failed" branch was unreachable. Return bool instead. Also drop clippy::from_iter_instead_of_collect, which clippy has removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Problem
In Claude Code, every session end shows:
polyhook 0.1.11 labeled Claude Code's
SessionEnd, andSessionStart, as Gemini CLI because the two agents share those event names. steplock therefore answered with Gemini's{"decision":"allow"}, which Claude Code rejects.Fix
polyhook = "0.1.12". That release is the 0.1.x backport (fix(core): detect Claude Code SessionStart/SessionEnd (0.1.x backport of #64) polyhook#81) of fix(core): detect Claude Code lifecycle hooks without tool fields polyhook#64, and it tells the two agents apart viaCLAUDE_PROJECT_DIR.approve()on PreToolUse is an explicitpermissionDecision: allow, which would auto-approve every Bash command that steplock gates.Cargo.lockchanges only polyhook, polyhook-core and steplock. Cargo also re-pointed one stale edge: the dev-dependencytempfilenow usesgetrandom 0.4.2, which was already locked.Also: lint ratchet
clippy::unnecessary_wraps.validate_dirandrun_validatenever returnedErr, so the Validate arm's "validate failed" branch was unreachable. They now returnbool, and the tests were updated.clippy::from_iter_instead_of_collect. Clippy has removed it, so it produced the only remaining warning.Verified
I replayed real hook payloads captured from Claude Code and Gemini CLI 0.39.1 through this build, which uses the published crates.io 0.1.12:
{"decision":"allow"}(rejected){}{"decision":"allow"}{}{}{}(PreToolUse stays passive, so no auto-allow){"decision":"allow"}{"decision":"allow"}(unchanged; that's Gemini's format)cargo fmt --check,clippy --all-targets -D warnings(zero warnings) andcargo testare green.🤖 Generated with Claude Code