daily-fix: branch-guard false pos: no-checkout + heredoc
kind: infra#wf-fix#wf-fix-fp:6e895a26ec36#daily-auto-filed#trigger-dense
track:Highlight text on any card (body, plan, or an event) to anchor a comment, or leave a whole-task comment here. Mention @claude to summon a reply.
No comments yet.
Overview / Motivation
Auto-filed by /daily 2026-07-22 (transcript sweep). scripts/guard_repo_root_branch.sh produced two distinct FALSE-POSITIVE blocks today, each on a sanctioned/harmless command shape.
Goal
The repo-root branch guard stops blocking (a) the CLAUDE.md-documented scratch-worktree recipe git worktree add --no-checkout --detach <path> origin/main, and (b) commands whose heredoc PAYLOAD text merely quotes git commands (git checkout -b as data inside a plan-edit heredoc).
Workflow gap
- Bug observed: (a) 552fa84d (#1092 inline round, 2026-07-23T03:53:27Z):
git worktree add --no-checkout --detach /tmp/wt1092dash origin/mainBLOCKED as "'git checkout --detach' would move the SHARED repo-root tree" — the regex at guard_repo_root_branch.sh:1364 (\bgit\b[^;&|]*\bcheckout\b +(-{1,2})detach\b) matches the substringcheckout --detachinside--no-checkout --detach(\bmatches after the hyphen). (b) abee1289 (#1602, 17:39:22Z): auv run python - <<'PYEOF'plan-edit whose heredoc payload contained the literal stringgit checkout -b(the plan documents git recipes) was BLOCKED; the session had to restructure via the Write tool. - Why it is a workflow gap: both blocks hit sanctioned workflows (the documented worktree recipe; editing a plan that quotes git commands — routine for #1602-class tasks whose SUBJECT is git behavior).
- Confidence: high.
- verified-at-filing:
sed -n '1364p' scripts/guard_repo_root_branch.sh→ the checkout-detach regex verbatim as quoted above (presence, binds);grep -c 'heredoc' scripts/guard_repo_root_branch.sh→ 19 hits — heredoc handling EXISTS elsewhere in the guard but did not protect this clause on 2026-07-22 (context-consistency note for the planner: extend/route the existing heredoc stripping to the checkout-detach + checkout -b clauses rather than adding a parallel mechanism), 2026-07-23 UTC.
Proposed change (refine in planning)
- Exempt
git worktree addcommand shapes from the checkout-detach clause (or exclude ano--prefixed match). - Strip heredoc bodies (text between
<<'X'/<<Xand the delimiter) before pattern-matching the branch/checkout clauses — reusing the guard's existing heredoc machinery where possible. - Add regression cases for both shapes to the guard's tests.
Scope / surfaces
- Primary target:
scripts/guard_repo_root_branch.sh(+ tests).
Constraints / invariants
- Real branch-moving commands at the repo root stay blocked (
git checkout -b,git switch, baregit checkout --detachon the root tree). - Recursion guard applies (workflow_fix_target Provenance).
Provenance
-
fingerprint: 6e895a26ec36
-
workflow_fix_target: scripts/guard_repo_root_branch.sh
Activity