fix: dev-poll abandons fresh PRs — stale branch check fails on unfetched refs #248
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#248
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Problem
dev-poll.sh checks if a PR branch is behind main using local git refs:
When the branch was pushed from inside a container worktree (e.g. /tmp/disinto-worktree-240), the host repo's origin/ refs don't know about it — nobody ran git fetch. The rev-list fails, the fallback returns 999, and dev-poll closes the PR as stale:
This affects every PR created by the dev agent in a worktree. The PR is closed 5 minutes after creation, before review can happen.
Affects lines 344 and 596 in dev/dev-poll.sh.
Root cause
Two issues:
|| echo "999"assumes "definitely stale" when the safe assumption is "unknown, don't touch"Proposed solution
Add
git fetch origin --pruneearly in dev-poll, after the lock check and before any git rev-list comparisons. This ensures local refs reflect the remote state. One fetch per poll cycle (~1-2s overhead, negligible compared to the existing API calls).Change the fallback from
|| echo "999"to|| echo "0"on both lines 344 and 596. If we can't determine how far behind a branch is, the safe default is "not stale" (skip abandonment), not "definitely stale" (close the PR).Affected files
Acceptance criteria