Skip to content

fix(loop): strip git's '+' linked-worktree marker in census branch normalization (issue #181) - #195

Merged
robercano-ghbot merged 1 commit into
mainfrom
feat/issue-181-census-plus-worktree-marker
Jul 28, 2026
Merged

fix(loop): strip git's '+' linked-worktree marker in census branch normalization (issue #181)#195
robercano-ghbot merged 1 commit into
mainfrom
feat/issue-181-census-plus-worktree-marker

Conversation

@robercano-ghbot

Copy link
Copy Markdown
Collaborator

What

loop-census.sh's branch normalization (sed 's/^[* ]*//') stripped * and spaces but NOT the + marker git prints for a branch checked out in ANOTHER (linked) worktree — git branch -a lists such a branch with a leading + instead of */space. Because every driver keeps its worktree alive while its PR is open, the captured name became + feat/issue-N-..., which then failed the open-PR headRefName match (case "$branch" in "$b"|*"/$b"). A healthy open PR was misread as in_flight, producing false stalled=N, real resume drivers spawned against healthy PRs, then a false needs-human escalation.

Fix

  • .claude/scripts/loop-census.sh:623 — normalize with sed 's/^[+* ]*//' (strips + in addition to */space); the existing remotes/ strip in the normalization chain is preserved.
  • .claude/scripts/loop-census.test.sh — new fixture that forces a genuine + listing via a real git worktree add (issue 200) with a matching open PR and deliberately stale events, asserting NOT in_flight and NOT stalled; plus a *-marker (current-checkout) regression control (issue 201). Sanity checks assert git branch -a truly emits the literal +/* lines before trusting downstream census assertions.

Verification

  • Gates (adapter .claude/self/gates.json): build PASS, lint PASS, test PASS.
  • loop-census.test.sh: 96/96 checks pass. Confirmed the new +-marker checks FAIL against the old s/^[* ]*// and PASS with the fix (empirical revert-check).
  • Reviewed through correctness (opus) and tests (sonnet) lenses — both APPROVE.

Fixes #181

…rmalization (issue #181)

git branch -a prefixes a branch with "+" (not "*") when it's checked out in
another linked worktree -- exactly what every driver leaves behind while its
PR stays open. loop-census.sh's branch normalization only stripped a leading
"*"/space, so such a branch was captured as "+ feat/issue-N-...", which then
failed the open-PR headRefName match and made a healthy open PR misread as
in_flight (and, with stale events, falsely stalled too).

Add "+" to the sed strip class and add a loop-census.test.sh fixture that
creates a real linked worktree (git worktree add) to reproduce the genuine
"+"-prefixed git branch -a line, plus a regression control for the existing
"*"-current-checkout marker.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@robercano-ghbot robercano-ghbot added the needs-human Loop escalated: attempt budget exhausted, manual triage required label Jul 28, 2026
@robercano-ghbot

Copy link
Copy Markdown
Collaborator Author

fix(loop): strip git's '+' linked-worktree marker in census branch normalization (issue #181) (not yet reviewed)

@robercano-ghbot robercano-ghbot added needs-human Loop escalated: attempt budget exhausted, manual triage required and removed needs-human Loop escalated: attempt budget exhausted, manual triage required labels Jul 28, 2026
@robercano-ghbot

Copy link
Copy Markdown
Collaborator Author

fix(loop): strip git's '+' linked-worktree marker in census branch normalization (issue #181) (not yet reviewed)

@robercano-ghbot robercano-ghbot removed the needs-human Loop escalated: attempt budget exhausted, manual triage required label Jul 28, 2026
@robercano-ghbot
robercano-ghbot merged commit 3a12007 into main Jul 28, 2026
9 checks passed
@robercano-ghbot
robercano-ghbot deleted the feat/issue-181-census-plus-worktree-marker branch July 28, 2026 19:33
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.

census: '+' worktree marker survives branch-name cleanup — open-PR branches misread as in_flight, false stall/resume/escalate

2 participants