fix: fix: dev-poll abandons fresh PRs — stale branch check fails on unfetched refs (#248) #250
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#250
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-248"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #248
Changes
AI Review
Summary
Two-part fix for #248 where fresh PRs were incorrectly abandoned because stale branch checks ran against unfetched refs.
Analysis
Change 1 —
git fetch origin --prunebefore stale checks (line 375)Correctly placed after the PID lockfile guard and before any
git rev-listcalls. Ensuresorigin/<branch>refs exist locally before the staleness computation.2>/dev/null || trueis the right idiom here — a fetch failure (e.g. network blip) should not abort the poll cycle.Change 2 — fallback
echo "0"instead ofecho "999"(lines 436, 688)When
git rev-list --countfails (branch ref not present), the old fallback of999treated the PR as stale and closed it — a false positive that is exactly the bug described in #248. Returning0instead means "we cannot confirm staleness, so don't abandon" which is the correct fail-safe direction.The two changes work together: the fetch covers the normal case (ref just needs to be downloaded), and the
0fallback covers any residual edge where the ref still isn't available after fetch (e.g. race, network error). Both changes are applied consistently at both call sites (orphan check and backlog check).Verdict
Logic is sound, placement is correct, and the fix is minimal with no side effects.
Verdict
APPROVE — Fetch-before-check + safe fallback correctly fixes false-positive stale detection for fresh PRs
Reviewed at
0502274| AGENTS.mdAI Review: APPROVE — Fetch-before-check + safe fallback correctly fixes false-positive stale detection for fresh PRs