fix(claude-code): grep-guard liveness probe — block grep unless serve is down - #172
Merged
Conversation
Replace the blind 5-minute retry-cache auto-unblock with an active
/healthz liveness probe. A low-confidence or empty codesearch result is a
successful call ("reformulate"), not a dead server, so it no longer leaks
grep. Grep on an indexed internal path is now allowed ONLY when the
codesearch serve hub is genuinely unreachable.
- grep-guard.ps1: Invoke-WebRequest probe to {base}/healthz (2s timeout)
- grep-guard.sh: curl probe (no -o /dev/null — Git-Bash exit-23 quirk);
requires curl
- base URL: CODESEARCH_SERVER > 127.0.0.1:$CODESEARCH_SERVE_PORT > :39725
- rewrote deny message to forbid grep-on-low-confidence and steer to
find/explore/single-term reformulation
- README: documented liveness-probe behavior, dropped 5-min retry text
web-guard hooks intentionally left unchanged (different tool, no liveness
endpoint) — tracked as a follow-up.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The deny message became a generic template, so the Grep pattern is no longer interpolated. Remove the dead pattern/$pattern extraction from both hooks (path is still used by the internal-path gate). Flagged by code review; no behavior change. Co-Authored-By: Claude Opus 4.8 <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.
Re-creation of #170 (auto-closed when its stacked base branch
fix/watcher-reindex-tui-visibilitywas deleted on #169 merge). The watcher work landed via #169; this PR now carries only the 3 grep-guard commits againstdevelop.What: grep-guard hooks (bash + pwsh) now block
grep/search unlesscodesearch serveis down — prevents the agent searching a stale filesystem when the semantic index is live.a3f4ec6🔒️ fix: grep-guard blocks grep unless codesearch serve is downb40441f♻️ refactor: drop now-unused pattern extractionf5a1e3d📝 docs: changelog entryValidation:
bash -n grep-guard.sh✅; pwsh parser checkgrep-guard.ps1✅.