fix(installer): honor CODEDB_NO_HOOKS + removal marker so hook removal sticks (#658) - #669
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3eb1a0dccc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not skip_pretooluse: | ||
| merge_hook("PreToolUse", {"matcher": "Bash", "hooks": [{"type": "command", "command": "$HOME/.claude/hooks/codedb-block-legacy.sh"}]}) |
There was a problem hiding this comment.
Remove existing hook when opt-out is active
When CODEDB_NO_HOOKS=1 is used on a machine that already has the codedb PreToolUse entry in ~/.claude/settings.json, this branch only skips calling merge_hook; it never deletes the existing entry, and the generated hook script only checks the runtime env var, not the new ~/.codedb/no-hooks marker. As a result, the install-time opt-out persists the marker but the legacy-tool blocker still runs in later Claude sessions that do not export CODEDB_NO_HOOKS, so existing users cannot actually disable the hook via the new installer path.
Useful? React with 👍 / 👎.
Benchmark Regression ReportThresholds: 10.00% and 50,000 ns absolute delta
|
The remaining half of #658 (problem c): the installer silently re-added the
codedb-block-legacy.shPreToolUse hook on every run, even after the user removed it (reporter removed it 3×). The scope+redirect half was #663; this makes removal stick.CODEDB_NO_HOOKS=1at install time skips the PreToolUse hook merge entirely (SessionStart warmup unchanged), and writes a~/.codedb/no-hooksmarker so the opt-out persists across future installs without re-passing the env var.Verified: installer Python heredoc compiles;
bash -nOK; simulated all three scenarios (opt-out creates marker + skips; marker-present later run still skips; baseline unchanged). Produced by a Sonnet agent; independently re-verified.🤖 Generated with Claude Code