This was generated by AI during triage (#657 sweep housekeeping, T8h batch conversion).
Two valid P2 edge cases on plugins/source-control/scripts/worktree-create.sh, deferred as follow-ups from the 2026-07-22 PR #898 verifier-resolver lane review threads (codex P2, dispositioned + resolved under delegation — deferred as follow-ups, change-freeze on the branch at the time, no fix-repush that cycle). Folded from a #657 line (checked off there, this issue is the batch).
Site 1 — bare-repo roots (in-checkout guard)
A worktree_root under a bare clone (e.g. /repos/other.git/worktrees) makes git rev-parse --show-toplevel fail (no working tree), so the guard falls through and git worktree add creates a checkout inside the bare repo's git dir — violating the "root outside every repository" contract.
Fix direction: also detect a bare-repository ancestor (e.g. probe git rev-parse --is-bare-repository / --git-dir on the nearest existing ancestor) before creating.
Site 2 — git ref-syntax validation (name check)
Names like feat/foo..bar, feat/., foo.lock pass the char-class regex + 64-char limit but git rejects them as refs, so the helper reaches git worktree add and returns environment exit 4 despite documenting an up-front exit 2 for invalid names.
Fix direction: run git check-ref-format --branch after the schema check so the correction flow receives the intended usage error (exit 2).
Acceptance: a bare-repo-rooted worktree_root is rejected before git worktree add runs; an invalid ref-syntax name returns exit 2 (not exit 4). Both sites are mechanical validation-guard fixes; no open design fork.
Work-class: C3 (bug-fix-shaped) — attended triage 2026-07-23, operator-ratified. 🤖
This was generated by AI during triage (#657 sweep housekeeping, T8h batch conversion).
Two valid P2 edge cases on
plugins/source-control/scripts/worktree-create.sh, deferred as follow-ups from the 2026-07-22 PR #898 verifier-resolver lane review threads (codex P2, dispositioned + resolved under delegation — deferred as follow-ups, change-freeze on the branch at the time, no fix-repush that cycle). Folded from a #657 line (checked off there, this issue is the batch).Site 1 — bare-repo roots (in-checkout guard)
A
worktree_rootunder a bare clone (e.g./repos/other.git/worktrees) makesgit rev-parse --show-toplevelfail (no working tree), so the guard falls through andgit worktree addcreates a checkout inside the bare repo's git dir — violating the "root outside every repository" contract.Fix direction: also detect a bare-repository ancestor (e.g. probe
git rev-parse --is-bare-repository/--git-diron the nearest existing ancestor) before creating.Site 2 — git ref-syntax validation (name check)
Names like
feat/foo..bar,feat/.,foo.lockpass the char-class regex + 64-char limit but git rejects them as refs, so the helper reachesgit worktree addand returns environment exit 4 despite documenting an up-front exit 2 for invalid names.Fix direction: run
git check-ref-format --branchafter the schema check so the correction flow receives the intended usage error (exit 2).Acceptance: a bare-repo-rooted
worktree_rootis rejected beforegit worktree addruns; an invalid ref-syntax name returns exit 2 (not exit 4). Both sites are mechanical validation-guard fixes; no open design fork.Work-class: C3 (bug-fix-shaped) — attended triage 2026-07-23, operator-ratified. 🤖