fix(census): ignore stale merged-remote-only branch in in_flight detection (#158)#168
Merged
Merged
Conversation
…#158) git branch -a --list matches both local branches and remote-tracking refs; after a PR merges the main checkout's local remotes/origin/... ref for it can survive until pruned, so a still-open issue whose branch was already merged kept matching that stale ref forever and was reported in_flight forever, wedging advance_ready. Now a remote-only match (no local branch of the same name) is only counted as existing when no merged PR exists for its bare branch name; a genuine local branch match is unaffected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Collaborator
Author
|
fix(census): ignore stale merged-remote-only branch in in_flight detection (#158) (not yet reviewed) |
robercano
approved these changes
Jul 21, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 2026
Repository owner
deleted a comment from
robercano-ghbot
Jul 23, 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.
Closes #158
Problem
loop-census.sh's in-flight detection matchedgit branch -a --list "*feat/issue-N-*", which includes staleremotes/origin/...refs. After a PR merged, the local remote-tracking ref in the main checkout could survive (until pruned), so a still-open issue whose partial PR already merged kept matching that stale ref and was reportedin_flightforever — wedgingadvance_readyand triggering false stall/escalation.Fix (fix #2, minimal, single-file)
In
loop-census.shonly: when the matched branch for an issue is REMOTE-ONLY (no local branch, only aremotes/...ref), it is treated as in_flight ONLY IF no MERGED PR exists for that bare head branch (bot-gh pr list --state merged --head <branch>). If a merged PR exists, the stale ref is ignored (branch=none) so the issue neither counts as in_flight nor blocks advance. A local branch match keeps prior behavior unchanged; the extraghcall is made only on the remote-only path and is|| true-guarded so a transient failure degrades to prior behavior.Tests
Extended
.claude/scripts/loop-census.test.sh(real git repo + stubbed bot-gh): new issue-44 scenario (remote-only ref with a stubbed merged PR →branch=none, not in_flight); issue-42 retained as the no-merged-PR control (stays in_flight), proving the fix doesn't blanket-drop remote-only refs.Gates
build / lint / test all green (
GATES_FILE=.claude/self/gates.json); loop-census.test.sh 45/45.Review
correctness (opus) APPROVE, tests (sonnet) APPROVE — consensus=all. Non-blocking note: transient-gh-failure fallback is code-inspection-covered, not fixture-covered.
🤖 Generated with Claude Code