fix(loop): strip git's '+' linked-worktree marker in census branch normalization (issue #181) - #195
Merged
Conversation
…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>
Collaborator
Author
|
fix(loop): strip git's '+' linked-worktree marker in census branch normalization (issue #181) (not yet reviewed) |
Collaborator
Author
|
fix(loop): strip git's '+' linked-worktree marker in census branch normalization (issue #181) (not yet reviewed) |
robercano
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 -alists 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-PRheadRefNamematch (case "$branch" in "$b"|*"/$b"). A healthy open PR was misread asin_flight, producing falsestalled=N, real resume drivers spawned against healthy PRs, then a falseneeds-humanescalation.Fix
.claude/scripts/loop-census.sh:623— normalize withsed 's/^[+* ]*//'(strips+in addition to*/space); the existingremotes/strip in the normalization chain is preserved..claude/scripts/loop-census.test.sh— new fixture that forces a genuine+listing via a realgit worktree add(issue 200) with a matching open PR and deliberately stale events, asserting NOTin_flightand NOTstalled; plus a*-marker (current-checkout) regression control (issue 201). Sanity checks assertgit branch -atruly emits the literal+/*lines before trusting downstream census assertions.Verification
.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 olds/^[* ]*//and PASS with the fix (empirical revert-check).Fixes #181