Skip to content

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

Description

@robercano-ghbot

What

loop-census.sh's branch normalization (sed 's/^[* ]*//', ~line 268) strips '' and spaces but NOT the '+' marker git prints for branches checked out in ANOTHER worktree. Since every driver leaves its worktree alive while its PR is open, the captured name becomes '+ feat/issue-N-...', which then fails the open-PR headRefName match (case "$branch" in "$b"|"/$b") — so a healthy open PR is misread as in_flight.

Consequences: false stalled=N after stall_minutes, real resume drivers spawned against healthy PRs (post-#161), then a false needs-human escalation. Observed: issue #173 escalated 2026-07-21T16:01Z while its PR #180 was open and fine (the two resume drivers died in the Claude outage, sealing the escalation); same mechanism caused #124's false escalation on 2026-07-16.

Fix

  • Normalize with sed 's/^[+* ]*//' (and keep the remotes/ strip).
  • loop-census.test.sh: fixture with the PR branch checked out in a linked worktree ('+' listing) + matching open PR → NOT in_flight, NOT stalled; plus a regression case for '*' (current checkout) for completeness.

Cleanup done manually 2026-07-21

needs-human label removed from #173; its loop-resume-attempts entry left escalated=true ON PURPOSE (prevents further wasted resume spawns until this fix lands — clear it after merge).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmodule:harnessOrchestrator machinery under .claudeplannedOwner-approved for the autonomous loop (assigned ONLY by the owner)priority:highNext in line

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions