fix(hooks): stop the guard from blocking heredocs and unindexed sessions (v2.1.2) - #31
Merged
Merged
Conversation
The guard kept denying calls in a session that had already used the index: the first codebase-index command ran before the index existed, so the guard returned early and never recorded it. Session state now lives in the temp directory and is written before the index lookup. Heredoc bodies are stripped before scanning, retries are keyed by search term instead of the full tool input, quoted alternations are parsed whole, and newlines separate commands.
Version bump with every mirror synced (plugin.json, requirements.lock, skill stamps) and the 2.1.2 release notes.
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
The
PreToolUseguard from 2.1.1 blocked calls it should have let through. In a real session it:codebase-index search, because that search was the one that built the index: the guard saw no index, returned early, and never recorded that the index was used;cat > x.ps1 <<'EOF', because; Select-String "BUILD FAILED"inside the heredoc body looked like a code search;grep "a\|b"at the\|, producing a broken suggested query.Solution
CBX_HOOK_STATEoverrides it) and is written before the index lookup, so the first index command always turns the guard off.Verification
tests/test_hooks_guard.py, all failing before the fix; full suite passes (coverage 86%), ruff and mypy clean.grep --include=*.javais nudged once and its retry passes; the heredoc scripts pass.Compatibility
Sessions started before the upgrade keep their old state inside the index, so they may be nudged once more. No settings changes needed.
Also bumps the version to 2.1.2 with every mirror synced.