fix(claude-code): grep-guard liveness probe — block grep unless serve is down - #170
Closed
flupkede wants to merge 3 commits into
Closed
fix(claude-code): grep-guard liveness probe — block grep unless serve is down#170flupkede wants to merge 3 commits into
flupkede wants to merge 3 commits into
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.
What
Reworks the claude-code
grep-guardhook so it blocksgreponly whencodesearch serveis reachable (liveness probe), instead of the previous pattern-extraction approach.grep-guard.sh/grep-guard.ps1: probe the serve endpoint; allowgrepthrough when serve is down (graceful fallback), block when it's up (so semantic search is used instead).Files
integrations/claude-code/hooks/grep-guard.sh,integrations/claude-code/hooks/grep-guard.ps1,integrations/claude-code/README.md,CHANGELOG.mdValidation
bash -n grep-guard.sh✅ (syntax valid)pwshparser checkgrep-guard.ps1✅ (syntax valid)cargoimpact.Notes
integrations/scripts + CHANGELOG; no shared code).