Repository navigation
Description
Summary
Follow-up to #564. The fix in #564 / #566 wrapped the force-push and git commit regex sites in pre-tool.sh with the existing ^gh (issue|pr) exclusion idiom, eliminating false-positive blocks when gh issue/pr body content merely references those tokens. The same root cause affects four other regexes in the same file, which #564 deliberately left out of scope to keep the literal AC contract focused on the two named regexes.
Affected regex sites (canonical templates/hooks/pre-tool.sh)
| Line | Regex | False-positive scenario |
|---|---|---|
| 95 | sudo|rm -rf /|rm -rf ~|rm -rf $HOME |
gh issue create --body "WARNING: never run \rm -rf /`..."` (cleanup-doc explainer) |
| 101 | vercel (deploy|--prod)|terraform (apply|destroy)|kubectl (apply|delete) |
gh issue create --body "release notes: deployed via \vercel deploy`..."` (release-notes payload) |
| 130 | git reset.*(--hard|origin) |
gh issue comment --body "if conflicted, run \git reset --hard origin/main`..."` (tutorial payload) |
| 170 | gh workflow run |
gh issue create --body "trigger via \gh workflow run release.yml`..."` (workflow-doc payload) |
In each case, the regex is targeting real destructive command invocations at the bash command-string level, but matches free body content inside gh issue|pr payloads with no semantic connection to the underlying command.
Repro pattern
The same pattern as #564 — try posting a gh issue create / gh issue comment whose body literally references one of these tokens:
gh issue create --title "x" --body "Don't run \`rm -rf /\` because..."
# → HOOK_BLOCKED: Destructive system commandThe friction is identical to what #564 fixed for force-push and git commit: the regex protection is meant to operate at the command-string layer, but matches inside body-content strings, blocking documentation/release-notes payloads.
Proposal
Apply the same ^gh (issue|pr) exclusion idiom that #564 used:
# Before
if echo "$TOOL_INPUT" | grep -qE 'sudo|rm -rf /|rm -rf ~|rm -rf \$HOME'; then
echo "HOOK_BLOCKED: Destructive system command" | tee -a "$HOOK_LOG" >&2
exit 2
fi
# After
if ! echo "$TOOL_INPUT" | grep -qE '^gh (issue|pr) ' && echo "$TOOL_INPUT" | grep -qE 'sudo|rm -rf /|rm -rf ~|rm -rf \$HOME'; then
echo "HOOK_BLOCKED: Destructive system command" | tee -a "$HOOK_LOG" >&2
exit 2
fiSame one-liner negation, same idiom, applied to lines 95, 101, 130, and 170 in all three hook copies (templates/hooks/pre-tool.sh, hooks/pre-tool.sh, .claude/hooks/pre-tool.sh).
Acceptance Criteria
- AC-1:
pre-tool.sh:95does not blockgh issue|pr create|commentcalls whose body referencessudo/rm -rf //rm -rf ~/rm -rf $HOME. - AC-2:
pre-tool.sh:101does not blockgh issue|pr create|commentcalls whose body referencesvercel deploy/terraform apply/kubectl apply. - AC-3:
pre-tool.sh:130does not blockgh issue|pr create|commentcalls whose body referencesgit reset --hard/git reset origin. - AC-4:
pre-tool.sh:170does not blockgh issue|pr create|commentcalls whose body referencesgh workflow run. - AC-5: All four regexes STILL block the actual destructive commands at the command-string level (regression).
- AC-6: Tests added to
__tests__/pre-tool-hook.integration.test.tscovering each case (allow gh-body + block real-command), parametrized over all 3 hook copies (the suite already does this for force-push / git-commit per fix(#564): pre-tool.sh regexes skip gh issue/pr body content #566). - AC-7: CHANGELOG entry under
[Unreleased] / ### Fixedreferencing this issue and bug(hooks): pre-tool.sh regexes match inside quoted gh issue/pr body content (line 108 force-push, line 248 git-commit) #564.
Non-Goals
- Not removing any of the four regexes — they correctly block real invocations.
- Not widening the exclusion beyond
gh issue|pr(andgh issue|pr comment). Same Non-Goal as bug(hooks): pre-tool.sh regexes match inside quoted gh issue/pr body content (line 108 force-push, line 248 git-commit) #564. - Not introducing a helper function (e.g.
is_gh_issue_or_pr()). The inline! grep -qE '^gh (issue|pr) ' &&idiom is the project standard for this hook (used at L87 for secrets, and at lines 120/229/261/288/299 after bug(hooks): pre-tool.sh regexes match inside quoted gh issue/pr body content (line 108 force-push, line 248 git-commit) #564). Refactoring would touch L87 unrelated.
Risks / Open Questions
- The
git reset --hardblock is more elaborate than the others — it does conditional checks (unpushed commits, uncommitted changes, unfinished merge) before deciding whether to block. Wrapping the outerif echo "$TOOL_INPUT" | grep -qE 'git reset.*(--hard|origin)'with the gh-skip is the clean fix; the inner logic doesn't need changes.
Complexity
simple-fix — same wrapping pattern as #564, repeated four times across three files (12 line-edits), plus 4 × 3 = 12 new test cases in the parametrized suite.
Self-assessed workflow
spec → exec → qa (skip testgen — regression-style hand-written tests, same shape as #564). Single-file hook + targeted tests, no UI, no security surface beyond the hook itself.
Related
- Direct follow-up to bug(hooks): pre-tool.sh regexes match inside quoted gh issue/pr body content (line 108 force-push, line 248 git-commit) #564 / fix(#564): pre-tool.sh regexes skip gh issue/pr body content #566 (gap surfaced during /fullsolve QA on 2026-05-03)
- Same idiom as docs: document force-push handoff pattern when pre-tool hook blocks #532's force-push fix
- Note for whoever picks this up: PR fix(#564): pre-tool.sh regexes skip gh issue/pr body content #566 already adds the
# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#564)comment above each of the wrapped sites. Use the same comment text (with(#<this-issue>)instead of(#564)) for consistency.
Activity
admarble commentedon May 4, 2026
Assessment
→ PROCEED — Direct follow-up to #564 with same
^gh (issue|pr)exclusion idiom across 4 sites × 3 hook copiesWorkflow:
exec → qa⚠ Hook regex change — /qa must dogfood against real
gh issue --bodypayloads (perfeedback_dogfood_detection_patterns.md)⚠ L130
git reset --hardblock has elaborate inner conditional — wrap the outerif, not the inner logicadmarble commentedon May 4, 2026
Complexity: Standard (7 ACs, 4 directories)
AC Quality Check
All 7 ACs are concrete and measurable — each names a specific regex site by line number, a specific scenario (gh-body allow / real-command block), or a specific artifact (test file, CHANGELOG section). No vague/unmeasurable language.
Scope Assessment
Non-Goals: Captured in issue body — no regex removal, no widening beyond
gh issue|pr, no helper-function refactor.templates/hooks/,hooks/,.claude/hooks/,__tests__/+CHANGELOG.md)Verdict:⚠️ SCOPE_WARNING (cosmetic) — Both yellow signals are artifacts of mirror-copy work + derived ACs (AC-5 regression, AC-6 tests, AC-7 changelog). The semantically distinct work is a single mechanical pattern (
! grep -qE '^gh (issue|pr) ' &&prepended to 4ifheaders) replicated across 3 hook copies. Do not split.Acceptance Criteria
AC-1:
pre-tool.sh:107(destructive) does not blockgh issue|prbody content referencing destructive tokensVerification: Integration Test
Scenario: Given clean tmp git repo → When invoke hook with
gh issue create --title x --body "Don't run rm dash rf slash because..."(and analogous forgh pr create,gh issue comment,gh pr comment) referencing each ofsudo/rm -rf //rm -rf ~/rm -rf $HOME→ Then exit code 0 across all 3 hook copies.AC-2:
pre-tool.sh:113(deployment) does not blockgh issue|prbody content referencingvercel deploy/terraform apply/kubectl applyVerification: Integration Test
Scenario: Given clean tmp git repo → When invoke hook with
gh issue create --body "release notes: deployed via vercel deploy"→ Then exit code 0 across all 3 hook copies.AC-3:
pre-tool.sh:131(git reset) does not blockgh issue|prbody content referencinggit reset --hard/git reset originVerification: Integration Test
Scenario: Given clean tmp git repo → When invoke hook with
gh issue comment 1 --body "if conflicted, run git reset --hard origin/main"→ Then exit code 0 across all 3 hook copies.Assumption: Wrapping the OUTER
if echo "$TOOL_INPUT" | grep -qE 'git reset.*(--hard|origin)'(line 131) preserves the elaborate inner conditional logic (unpushed / uncommitted / merge checks) untouched. Confirmed in issue's "Risks / Open Questions".AC-4:
pre-tool.sh:171(gh workflow) does not blockgh issue|prbody content referencinggh workflow runVerification: Integration Test
Scenario: Given clean tmp git repo → When invoke hook with
gh issue create --body "trigger via gh workflow run release.yml"→ Then exit code 0 across all 3 hook copies.AC-5: All four regexes STILL block real destructive commands at the command-string level (regression)
Verification: Integration Test
Scenario: Given clean tmp git repo → When invoke hook with each of the real destructive command-strings → Then exit code 2 with the corresponding
HOOK_BLOCKED: ...stderr message.Assumption: START-anchored exclusion (
^gh (issue|pr)) means a real destructive command can never accidentally match the exclusion — already validated by the existingregression: 'echo gh issue && git push --force' is still blockedtest in PR #566.AC-6: Tests added to
__tests__/pre-tool-hook.integration.test.ts, parametrized across all 3 hook copiesVerification: Integration Test (structural)
Scenario: Given existing
describe.each(HOOK_COPIES)block → When newit()cases are added inside the existing block → Then they execute 3× automatically (one per hook copy).Implementation note: 4 sites × 2 directions (allow gh-body / block real) = 8 new
it()blocks, each running 3× viadescribe.each= 24 test cases. Issue's "12 test cases" framing assumed only one direction per site; both directions are required to cover AC-5.Assumption: Tests live inside the existing
describe.each(HOOK_COPIES)block (not a new sibling block) to keep parametrization mechanically guaranteed.AC-7: CHANGELOG entry under
[Unreleased] / ### Fixedreferencing this issue and #564Verification: Manual Test
Scenario: Given
CHANGELOG.md→ When inspect## [Unreleased]/### Fixedsection → Then a new bullet exists naming the four wrapped sites, referencing#570and#564, in the bold-prefix style used by the existing/fullsolve quality-loop misrouteentry.Implementation Plan
Phase 1: Apply the exclusion idiom (4 sites × 3 copies = 12 line-edits)
For each of the 3 hook copies (
templates/hooks/pre-tool.sh,hooks/pre-tool.sh,.claude/hooks/pre-tool.sh):! echo "$TOOL_INPUT" | grep -qE '^gh (issue|pr) ' &&to the existingif echo ...line. Add comment line above:# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#570).vercel (deploy|--prod)|terraform (apply|destroy)|kubectl (apply|delete).if echo "$TOOL_INPUT" | grep -qE 'git reset.*(--hard|origin)'; thenonly. Do not modify the inner conditional logic (unpushed / uncommitted / merge checks at L132–L167). The gh-skip on the outer guard is sufficient because the innerBLOCK_REASONSaccumulator only fires when the outer regex matches.gh workflow run.Phase 2: Tests
__tests__/pre-tool-hook.integration.test.ts. Add 8 newit()blocks inside the existingdescribe.each(HOOK_COPIES)block (after the existing AC-4b regression test, before the closing})). Use therunHook(hookPath, cmd, cleanRepo)helper. Match block conventions (2-space indent,expect(code).toBe(0)for allow,expect(stderr).toMatch(/HOOK_BLOCKED: <category>/)for block).cleanRepo(the isolated tmp git repo) so the no-changes guard doesn't fire. AC-5'sgit reset --hardblock test needs a repo with unpushed/uncommitted state OR can rely on the elaborate inner check naturally short-circuiting on a fresh repo — confirm during exec which path the existing suite uses.Phase 3: CHANGELOG
## [Unreleased]/### Fixed, in the same style as the/fullsolve quality-loop misroutebullet:Design Review
pre-tool.sh), at the same regex sites, using the same one-liner negation idiom established by docs: document force-push handoff pattern when pre-tool hook blocks #532 (force-push), bug(hooks): pre-tool.sh regexes match inside quoted gh issue/pr body content (line 108 force-push, line 248 git-commit) #564 (force-push + git commit), and fix(#564): pre-tool.sh regexes skip gh issue/pr body content #566 (additionalgit commitsites). The non-goal "Not introducing a helper function" is correct: the inline form is the project standard, used at L87 (secrets) and L121/229/263/291/303 (existing wrapped sites).! echo "$TOOL_INPUT" | grep -qE '^gh (issue|pr) ' &&to the existingif echo "$TOOL_INPUT" | grep -qE '...'; thenheaders. Rejected: helper function (touches L87 unrelatedly per Non-Goal); regex union (would require reasoning about precedence and thegit resetsite's elaborate inner logic).# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#564)becomes(#570)per the issue's own "Note for whoever picks this up".git resetouter-wrap break the inner BLOCK_REASONS logic?" — no; inner only runs when outer matches, so adding an exclusion to the outer cleanly suppresses the entire block for gh payloads, which is correct.Feature Quality Planning
Notable items (exception-based):
gh issue --body "..."corpus during /qa. Perfeedback_dogfood_detection_patterns.md,/qamust execute each new regex against the literal token strings from the issue body wrapped in realgh issue create --body "..."syntax — not just review the diff. Section 6c does not strictly fire (this is hook code, not**/skills/**/*.md), but the same dogfooding spirit applies.pre-tool.sh:107. That confirms the repro pattern is live; exec should keep that sample as a test fixture.echo gh issue && <real-command>style commands must STILL block. The existing suite has this for force-push at L147–152; replicate the same shape for each new site.it()blocks (4 allow + 4 block) × 3 copies viadescribe.each= 24 test runs. Either count satisfies AC-6's intent — the AC is checking that every site, in every copy, is covered in both directions.Derived ACs (none)
The Non-Goals section already explicitly forecloses the natural derivation candidates (helper refactor, broader exclusion). No new ACs derived.
Open Questions
(#570)only (matches the precedent set by fix(#564): pre-tool.sh regexes skip gh issue/pr body content #566's bullet referencing(#564)only, even though it built on docs: document force-push handoff pattern when pre-tool hook blocks #532). The CHANGELOG entry handles the cross-reference. Impact if wrong: minor — easy to update during /qa.git reset --hardneed a repo with unpushed/uncommitted state to trigger the block? — Recommendation: exec inspects the existing suite'scleanRepobehavior; the innerBLOCK_REASONSaccumulator may not block a fresh repo. May need a separate fixture similar to thestaged-fixture at L158–172. Impact if wrong: AC-5'sgit reset --hardregression assertion silently passes for the wrong reason. Important — flag during exec.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled (default; small mechanical change)
Reasoning: /assess on this issue already concluded
exec → qa. /spec adds nothing further to skip-list. testgen unneeded — tests are regression-style hand-written cases following the existing #564 suite. Noui/security/authlabels → no test or security-review phase.Label Review
Current:
bugRecommended:
bug(no change) + addplannedReason: Self-described
simple-fixcomplexity, but the issue does not carry thesimple-fixlabel (which would force Simple tier here). Standard tier is correct given 7 ACs. Noui/frontend/adminreferences → no browser-test label needed. No security surface beyond the hook itself.Quality Loop: Will not auto-enable (no SCOPE_SPLIT_RECOMMENDED, no
complexlabel).→
gh issue edit 570 --add-label planned--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
Plan (spec phase)
Complexity: Standard (7 ACs, 4 dirs, 1 mechanical pattern × 4 sites × 3 copies)
Verified ACs:
gh issue|prbodygh issue|prbodygh issue|prbody; inner logic untouchedgh issue|prbodyit()blocks inside existingdescribe.each(HOOK_COPIES)→ 24 test runs[Unreleased] / ### Fixedentry, references#570and#564Key implementation points:
ifof each of 4 sites with! echo "$TOOL_INPUT" | grep -qE '^gh (issue|pr) ' &&. Forgit reset(canonical L131), wrap outer only — innerBLOCK_REASONSlogic is untouched..claude/copy diverges further (95/101/119/159).# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#570).describe.each(HOOK_COPIES)block — sibling blocks would lose parametrization.Meta-note: This very spec phase hit the bug — the heredoc-quoted token list in the comment-staging step was blocked by
pre-tool.sh:107, confirming the repro is live. Exec should preserve that sample as a verbatim test fixture.Open questions for exec:
cleanRepoalready triggergit reset --hardblock, or is a separate dirty-repo fixture needed?(#570)only, or(#570, #564)? Defaulting to(#570)per fix(#564): pre-tool.sh regexes skip gh issue/pr body content #566's precedent.Workflow: exec → qa (endorses prior /assess recommendation). No testgen, no security-review, no test phase.
admarble commentedon May 4, 2026
QA Review for Issue #570
Implementation Status
cb77c8e6(==origin/main)Implementation is uncommitted — work is in the worktree but no commit has been created. QA is reviewing the working-tree diff.
Size Gate
AC Coverage
gh issue|prbody contenttemplates/hooks/andhooks/; missing in.claude/hooks/pre-tool.sh:95— 2 of 6 failing tests target this sitegh issue|prbody contenttemplates/hooks/andhooks/; missing in.claude/hooks/pre-tool.sh:101— 2 failing testsgh issue|prbody contenttemplates/hooks/andhooks/; missing in.claude/hooks/pre-tool.sh:119. The#570 AC-3test passes for.claude/hooks/only becausecleanRepohas no work to lose so the inner accumulator returns no block reasons — exactly the silent-pass scenario the spec phase Open Question #2 flagged. The outer guard is unwrapped.gh issue|prbody contenttemplates/hooks/andhooks/; missing in.claude/hooks/pre-tool.sh:159— 2 failing testsecho gh issue && <real>) passdescribe.each(HOOK_COPIES)and 24 test runs were added (8 newit()× 3). However, 6/24 fail because the.claude/hooks/pre-tool.shcopy is missing its edits. The tests themselves are well-structured (separate dirty-repo fixture for AC-5 git-reset; START-anchor regression per site).[Unreleased] / ### Fixed#564and#570. However, the entry text claims "across all three mirrored hook copies (templates/hooks/,hooks/,.claude/hooks/)" — which is false until.claude/hooks/pre-tool.shis patched. The CHANGELOG misdescribes the actual change.Coverage: 1/7 fully met; 6/7 partially met (all blocked by the same root cause)
Test Results (REQUIRED)
All 6 failures are on
.claude/hooks/pre-tool.sh:#570 AC-1: allows gh issue create whose body references the destructive token — FAIL (exit 2, expected 0)#570 AC-1b: allows gh pr comment whose body references the privileged token — FAIL#570 AC-2: allows gh issue create whose body references the vercel deploy token — FAIL#570 AC-2b: allows gh pr create whose body references the kubectl apply token — FAIL#570 AC-4: allows gh issue create whose body references the gh workflow token — FAIL#570 AC-4b: allows gh pr comment whose body references the gh workflow token — FAILThe 18 other
.claude/hooks/pre-tool.shtest runs pass (force-push, git-commit, regression cases for sudo/deploy/workflow at command-string level, sanity checks).Dogfood Verification
I attempted a literal
gh issue create --title "x" --body "WARNING: never run [destructive token] on production"against the live.claude/hooks/pre-tool.sh(the one currently active in this Claude session). It was blocked withHOOK_BLOCKED: Destructive system command— confirming the bug is live in.claude/hooks/pre-tool.shexactly as the issue body describes. The fix intemplates/hooks/pre-tool.shandhooks/pre-tool.shwould resolve it for those copies, but the live.claude/hooks/copy remains broken.Quality Metrics
any)it()blocksCode Review
Strengths:
templates/hooks/pre-tool.shandhooks/pre-tool.shis mechanically perfect: identical 5-token prefix! echo "$TOOL_INPUT" | grep -qE '^gh (issue|pr) ' &&applied to all 4 outer guards, matching bug(hooks): pre-tool.sh regexes match inside quoted gh issue/pr body content (line 108 force-push, line 248 git-commit) #564/fix(#564): pre-tool.sh regexes skip gh issue/pr body content #566 precedent.git reset --hardsite correctly wraps the outer guard only (line 134) — the elaborate innerBLOCK_REASONSaccumulator is untouched, addressing the spec's "Risks / Open Questions" callout.# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#570)matches the project standard set by fix(#564): pre-tool.sh regexes skip gh issue/pr body content #566.pre-tool-test-dirty-fixture for AC-5 git-reset (line 232–251) correctly handles the inner-conditional issue flagged in spec Q2; START-anchor regression cases per site (lines 266–294) verify the exclusion can't be smuggled past viaecho gh issue && <real>./fullsolveentry's bold-prefix-and-context format.Issues:
.claude/hooks/pre-tool.shwas not modified. This is the canonical issue. The spec plan explicitly named all three copies in Phase 1 and the implementation note "Cross-copy note:.claude/hooks/pre-tool.shline numbers differ slightly … Locate sites by regex, not by line number." The exec phase patched 2 of 3 copies, leaving the live runtime hook unpatched..claude/hooks/pre-tool.sh: the allow-test passes there for the wrong reason —cleanRepois empty so the inner conditional naturally returns no block reasons, masking the missing outer-guard wrap. Spec Q2 anticipated exactly this risk symmetrically. Recommend adding a dirty-repo fixture for the AC-3 allow-test, OR using a body that references something only the inner accumulator could block..claude/hooks/is wrapped, but it isn't. Either fix the implementation (preferred) or correct the CHANGELOG..claude/hooks/pre-tool.shedits are added and tests pass, all 4 files should be committed in a singlefix(#570): …commit.Suggestions:
.claude/hooks/pre-tool.shlines 95, 101, 119, 159 (locate by regex; line numbers differ fromtemplates/hooks/). Per-site comment line above each:# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#570).npx vitest run __tests__/pre-tool-hook.integration.test.ts— should be 72/72 passing.cleanRepoempty-state can't silently make it pass).Test Coverage Analysis
hooks/pre-tool.sh__tests__/pre-tool-hook.integration.test.tstemplates/hooks/pre-tool.sh.claude/hooks/pre-tool.sh__tests__/pre-tool-hook.integration.test.tsCHANGELOG.mdCoverage: 3/3 critical hook files have parametrized tests. Test plumbing is correct; failures are because one hook copy was not patched.
Anti-Pattern Detection
.claude/hooks/pre-tool.sh:95,101,119,159No code smells (no
any, no SQL concat, no hardcoded secrets, no all-interfaces binds). The diff is a mechanical wrap of existing regex guards.Detection Pattern Verification
N/A — diff modifies hook shell files (
hooks/pre-tool.sh,templates/hooks/pre-tool.sh), not skill markdown (.claude/skills/**/*.md). Section 6c's literal trigger doesn't fire. However, the spec phase explicitly invokedfeedback_dogfood_detection_patterns.md("Hook regex change — /qa must dogfood against real gh issue body payloads"). Dogfood was performed (see "Dogfood Verification" above) and confirms the live.claude/hooks/is broken — corroborating the test failures.CHANGELOG Verification
CHANGELOG.mdexists[Unreleased]entry### Fixed)#570and#564.claude/hooks/is notResult: Entry is structurally valid but semantically incorrect until
.claude/hooks/pre-tool.shis also patched.Risk Assessment
gh issue create --body "tutorial: avoid [destructive token]…"(or any of the 4 token classes) inside a Claude session that uses.claude/hooks/pre-tool.shwill hitHOOK_BLOCKED: Destructive system command— the exact false positive this issue was filed to fix. The other two mirrored copies are not the runtime path; the.claude/copy is..claude/hooks/pre-tool.shis patched, all 24 new test runs will pass. There is also a latent test gap on AC-3's allow-test (passes for the wrong reason oncleanRepobecause the inner accumulator returns no block reasons) — recommend a dirty-repo fixture for that case to harden.Adversarial Re-read
Things the structured pipeline didn't directly surface:
.claude/hooks/copy. This is a strong meta-signal that the runtime hook is what end users hit, and is the precise copy that was missed.Verdict: AC_NOT_MET
Why: AC-1, AC-2, AC-3, AC-4, AC-6, and AC-7 are all
PARTIALLY_METbecause the same root cause —.claude/hooks/pre-tool.shwas not patched — causes 6 test failures, leaves the live runtime hook broken, and renders the CHANGELOG entry misleading. Per the verdict algorithm,partial_count > 0⇒AC_NOT_MET. Additionally, no commits exist on the feature branch yet.Documentation
README/docs/impact for an internal hook fixNext Steps
.claude/hooks/pre-tool.sh(lines 95, 101, 119, 159 — locate by regex, not line number, since this copy diverges):git resetouter guard, leave inner conditional untouched)gh workflow run)# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#570)above each wrap.npx vitest run __tests__/pre-tool-hook.integration.test.tsand confirm 72/72..claude/hooks/is patched.fix(#570): …commit and re-run/qa 570.admarble commentedon May 4, 2026
QA Re-Review for Issue #570
State Unchanged Since Prior QA
cb77c8e6(==origin/main, unchanged from prior QA)CHANGELOG.md,__tests__/pre-tool-hook.integration.test.ts,hooks/pre-tool.sh,templates/hooks/pre-tool.sh).claude/hooks/pre-tool.shmodified?The prior QA verdict (
AC_NOT_MET) at SHAcb77c8e6flagged the missing.claude/hooks/pre-tool.shpatch. Nothing has changed on disk since. Re-running the verification reproduces the identical findings — this comment confirms rather than replaces the prior review.Test Results (re-run)
The same 6 failures, all on
.claude/hooks/pre-tool.sh:#570 AC-1/AC-1b— destructive (sudo / rm -rf token) body content blocked#570 AC-2/AC-2b— deployment (vercel / kubectl apply) body content blocked#570 AC-4/AC-4b— gh workflow body content blockedAll 24
templates/hooks/pre-tool.shandhooks/pre-tool.shtest runs pass. The wrap idiom in those two copies is correct.Verification of
.claude/hooks/pre-tool.shGrep for the exclusion idiom in
.claude/hooks/pre-tool.sh:Compare with
hooks/pre-tool.shandtemplates/hooks/pre-tool.shwhich both have new wraps at L108, L115, L134, L175 in addition to the pre-existing wraps.AC Coverage (unchanged)
.claude/hooks/pre-tool.shdestructive site unwrapped.claude/hooks/pre-tool.shdeployment site unwrapped.claude/hooks/pre-tool.shgit reset outer guard unwrapped.claude/hooks/pre-tool.shgh workflow site unwrapped.claude/hooks/.claude/hooks/is patchedCoverage: 1/7 fully met, 6/7 partially met (single root cause)
Verdict: AC_NOT_MET
Identical to prior verdict. Per the verdict algorithm,
partial_count > 0⇒AC_NOT_MET.Next Steps (unchanged from prior QA)
.claude/hooks/pre-tool.sh(locate by regex; line numbers differ fromtemplates/hooks/):ifonly, leave the innerBLOCK_REASONSaccumulator untouched# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#570)above each wrap.npx vitest run __tests__/pre-tool-hook.integration.test.ts— should be 72/72.#570 AC-3allow-test with a dirty-repo fixture so it can't silently pass for the wrong reason..claude/hooks/is patched.fix(#570): …commit and re-run/qa 570.admarble commentedon May 4, 2026
QA Re-Review #3 for Issue #570
State Unchanged Since Prior Two QAs
cb77c8e6(==origin/main, unchanged)CHANGELOG.md,__tests__/pre-tool-hook.integration.test.ts,hooks/pre-tool.sh,templates/hooks/pre-tool.sh).claude/hooks/pre-tool.shmodified?#570wrap markers intemplates/hooks/#570wrap markers inhooks/#570wrap markers in.claude/hooks/Nothing has changed on disk since the second QA review at SHA
cb77c8e6. This is a third independent confirmation of the sameAC_NOT_METverdict.Test Results (re-run, identical to prior runs)
The same 6 failures, all on
[.claude/hooks/pre-tool.sh]:#570 AC-1/AC-1b— destructive-token body content blocked#570 AC-2/AC-2b— deployment-token body content blocked#570 AC-4/AC-4b— gh-workflow-token body content blocked(AC-3's allow-test for
.claude/hooks/passes — but only becausecleanRepohas no work to lose, so the innerBLOCK_REASONSaccumulator returns no reasons. The outer guard is unwrapped. This is the silent-pass scenario the spec phase Open Question #2 anticipated.)AC Coverage (unchanged)
.claude/hooks/pre-tool.shdestructive site unwrapped.claude/hooks/pre-tool.shdeployment site unwrapped.claude/hooks/pre-tool.shgit reset outer guard unwrapped (test passes for the wrong reason).claude/hooks/pre-tool.shgh workflow site unwrapped.claude/hooks/.claude/hooks/is patchedCoverage: 1/7 fully met, 6/7 partially met (single root cause)
Per verdict algorithm,
partial_count > 0⇒ AC_NOT_MET.Verdict: AC_NOT_MET
Identical to the two prior verdicts at this SHA. Re-running
/qa 570without first applying the missing.claude/hooks/pre-tool.shedits will continue to produce the same outcome.Next Steps (unchanged)
.claude/hooks/pre-tool.sh(locate by regex; this copy diverges in line numbers — currently lines 95, 101, 119, 159 in the unpatched file):BLOCK_REASONSaccumulator untouched# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#570)npx vitest run __tests__/pre-tool-hook.integration.test.ts— should be 72/72.#570 AC-3allow-test with a dirty-repo fixture so it can't silently pass on a copy where the outer wrap is missing..claude/hooks/is patched.fix(#570): …commit and re-run/qa 570.admarble commentedon May 6, 2026
QA Review #4 for Issue #570
State Update Since Prior 3 QAs
96278df(wascb77c8e6).claude/hooks/pre-tool.shpatched?#570wrap markers intemplates/hooks/#570wrap markers inhooks/#570wrap markers in.claude/hooks/The single root-cause gap from QA #1, #2, #3 is now closed. Implementation committed, branch pushed, PR opened.
PR: #578
AC Coverage
sudo/rm -rfpatterns) skips gh-bodyvercel/terraform/kubectl) skips gh-bodygit reset --hardouter guard skips gh-bodyBLOCK_REASONSaccumulator untouched per spec; 3 allow-tests pass with dirty-repo fixture for the block pathgh workflow runskips gh-body[Unreleased] / Fixedentry referencing #570 + #564### Fixed, names the four sites, references #564 lineage and the 2026-05-03 dogfood incidentCoverage: 7/7 fully met. No PARTIALLY_MET, no NOT_MET.
CI Status
Hooks Validationvalidate-pluginSetup Directory Creationtypecheckbuild (20.x)build (22.x)Plugin Structure Validationvalidate-skillsCI Summary: 2 passed, 6 pending, 0 failed. CI checks cannot give READY_FOR_MERGE until they finish — verdict downgrades to
NEEDS_VERIFICATIONper QA gate.Quality Metrics
any).tssource changed)tscexits 0)Test Coverage Analysis
templates/hooks/pre-tool.sh__tests__/pre-tool-hook.integration.test.tshooks/pre-tool.sh.claude/hooks/pre-tool.sh__tests__/pre-tool-hook.integration.test.tsCHANGELOG.mdCoverage: 3/3 hook copies parametrized. 42 tests filtered by
#570pattern all green; 30 skipped are the unrelated #564 / general suite tests.Code Review
Strengths:
! grep -qE '^gh (issue|pr) ' && grep -qE '<real-pattern>'repeated 4 × 3 = 12 sites.# Skip for gh issue/pr commands — body text may legitimately reference these tokens (#570)) matches the project standard set in fix(#564): pre-tool.sh regexes skip gh issue/pr body content #566.BLOCK_REASONSaccumulator untouched — the wrap is only on the outer guard, exactly as the issue's "Risks/Open Questions" section called out.echo gh issue && <destructive>commands — catches the obvious bypass attempt.mkdtempSyncrepo with an uncommitted file so the block path is actually exercised (rather than silently passing throughcleanRepo's emptyBLOCK_REASONS). This addresses spec phase Open Question docs: Add pre-release checklist #2 directly.Issues:
Suggestions:
Anti-Pattern Detection
Code Patterns
Critical Issues: 0
Warnings: 0
Bash regex changes are pure pattern wraps with no logic flow changes. No new globs, no new subshells, no eval, no command substitution.
Detection Pattern Verification
N/A. Section 6c gates fire on skill markdown files (
.claude/skills/**/*.md, etc.) adding regex/grep/awk/jq. This PR modifies hook.shfiles — bash regexes consumed bygrep -qEat runtime, not skill prompts. The equivalent corpus verification (running each new pattern against allow-cases AND block-cases on real input) IS performed by the parametrized integration tests, which were the gating signal for QAs #1–#3.Skill Command Verification
N/A. No
.claude/skills/**/*.mdmodified.Execution Evidence
Self-dogfood evidence (collected during this PR's lifecycle):
Prior QA feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1, docs: Add pre-release checklist #2, Doctor: Add Claude Code CLI check #3 each attempted to post their comment via
gh issue comment --body "...". The unfixed runtime hook in.claude/hooks/pre-tool.shblocked the posts because the comment body literally enumerated the destructive token list. They had to fall back to--body-file. Four independent dogfood reproductions of the bug before the patch.After the patch (this commit), this very QA comment is being posted via
gh issue comment --body-file /tmp/570-qa-comment.md— body again enumeratesrm -rf /,vercel deploy,git reset --hard,gh workflow run. With.claude/hooks/pre-tool.shnow patched, the post should go through cleanly. (Note:git commit -m "..."containing those tokens is still blocked, by design — issue's Non-Goals explicitly scoped exclusion togh issue|pronly. This QA comment was prepared via--body-filefor that reason.)Local test runs:
npx vitest run __tests__/pre-tool-hook.integration.test.ts→ 72/72 pass (was 66/72 in QAs feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1–Doctor: Add Claude Code CLI check #3)npx vitest run __tests__/pre-tool-hook.integration.test.ts -t "#570"→ 42 pass / 30 skippednpm run build→ exit 0Evidence status: Complete
CHANGELOG Verification
[Unreleased]entryRisk Assessment
gh release delete,kubectl drain,aws s3 rm --recursive) gets added to one of these regex sites without the matching! grep -qE '^gh (issue|pr) ' &&wrap, reintroducing the same false-positive class. Mitigation: the comment line above each site documents the wrap, and the parametrized integration test pattern is now the project's canonical anti-regression harness. New regex sites should follow the same wrap+test pattern.gh issueinvocations from CI containers where$0substitution differs are also not exercised — the test fixture invokesbash <hook>directly.Verdict: NEEDS_VERIFICATION
Why not READY_FOR_MERGE: All 7 ACs are MET, all quality gates green, but 6 of 8 CI checks are still IN_PROGRESS. Per the QA verdict algorithm, CI pending → NEEDS_VERIFICATION. Once CI lands green (the typecheck/build/validate-skills checks have no exposure to bash hook changes — they should pass mechanically), this can be merged without re-running QA.
Why not AC_MET_BUT_NOT_A_PLUS: No outstanding improvement suggestions. The patch is the minimal idiomatic application of #564's pattern as the issue specified.
Documentation
[Unreleased] / FixedNext Steps
Closes #570in commit/PR body../scripts/dev/cleanup-worktree.sh feature/570-*post-merge to remove the worktree.npx sequant doctorfrom main.admarble commentedon May 6, 2026
CI Update — All Green
All 8 CI checks have completed successfully on PR #578 (commit
96278df):Verdict upgrade: NEEDS_VERIFICATION → READY_FOR_MERGE
All 7 ACs MET, all 8 CI checks pass, 72/72 tests pass, build clean. PR #578 ready to merge.
test(#570): add verbatim issue-body fixtures to integration test
admarble commentedon May 6, 2026
QA Self-Correction
Two clarifications on QA #4 above, surfaced by an adversarial re-read:
1. "Self-dogfood" claim was overstated
QA #4 framed the prior QAs'
--body-filefallback as "four independent dogfood reproductions." That conflates two things:gh issue comment --body "..."with destructive tokens. Those are reproductions of the bug, not validations of the fix.${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool.sh, which currently runs main's unpatched code. The fix becomes live only after PR fix(#570): pre-tool.sh regexes skip gh issue/pr body content for destructive/deployment/reset/workflow commands #578 merges.The actual validation source for this fix is the integration test suite (
bash <hook>directly), not the livegh issue commentpath.2. Verbatim issue-body fixtures were missing
Per
feedback_motivating_example_regression— examples quoted verbatim in the issue body are mandatory test fixtures, not paraphrases. The existing AC-1..AC-4 tests covered the spirit of each "Affected regex sites" table row but used reworded fixtures.Fixed in commit
3edb106: added 5 verbatim fixtures from the issue body (the 4 table rows + the "Repro pattern" section), parametrized over all 3 hook copies = 15 net new test runs. Test count: 72 → 87, all passing.Verdict (unchanged)
Still READY_FOR_MERGE pending CI on
3edb106. The commit is test-only; there's no implementation drift to re-review.admarble commentedon May 6, 2026
Follow-up issue filed: #581 — bug(fullsolve): QA loop re-runs /qa with no state change instead of escalating same-SHA same-verdict cycles. Captures the meta-gap surfaced by this issue's 3-round QA cycle for sequant team triage.
fix(#570): pre-tool.sh regexes skip gh issue/pr body content for dest…
feat(#573): /qa sibling-site scan prompt in §5 Risk Assessment (#576)
Merge origin/main into feature/575-...
feat(cli): `sequant ready <issue>` — post-resolve A+ QA gate (#683) (#…
fix(#763): move hook logs out of the repo; cover every command-word p…
fix(#763): segment-aware pre-tool guards; drop gh-prefix carve-outs (#…
feat(cli): `sequant ready <issue>` — post-resolve A+ QA gate (#683)