Skip to content

fix(claude-code): grep-guard liveness probe — block grep unless serve is down - #172

Merged
flupkede merged 3 commits into
developfrom
fix/grep-guard-liveness-probe
Jul 29, 2026
Merged

fix(claude-code): grep-guard liveness probe — block grep unless serve is down#172
flupkede merged 3 commits into
developfrom
fix/grep-guard-liveness-probe

Conversation

@flupkede

Copy link
Copy Markdown
Owner

Re-creation of #170 (auto-closed when its stacked base branch fix/watcher-reindex-tui-visibility was deleted on #169 merge). The watcher work landed via #169; this PR now carries only the 3 grep-guard commits against develop.

What: grep-guard hooks (bash + pwsh) now block grep/search unless codesearch serve is down — prevents the agent searching a stale filesystem when the semantic index is live.

  • a3f4ec6 🔒️ fix: grep-guard blocks grep unless codesearch serve is down
  • b40441f ♻️ refactor: drop now-unused pattern extraction
  • f5a1e3d 📝 docs: changelog entry

Validation: bash -n grep-guard.sh ✅; pwsh parser check grep-guard.ps1 ✅.

Test User and others added 3 commits July 28, 2026 18:15
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>
@flupkede
flupkede merged commit a259b38 into develop Jul 29, 2026
1 check passed
@flupkede
flupkede deleted the fix/grep-guard-liveness-probe branch July 29, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant