fix: fix: dev-agent failure cleanup should preserve remote branch and PR for debugging (#131) #132
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#132
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-131"
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 #131
Changes
AI Review
Bug: branch rename clobbers recovery branch\n\n- high
dev/dev-agent.sh:266-272: The new ATTEMPT logic runs unconditionally — even when is set and BRANCH has already been assigned to the actual existing PR branch (lines 208 or 226). As a result, a second run for issue N finds 1 existing branch (fix/issue-N), sets BRANCH tofix/issue-N-1, then callsworktree_recoverwith that non-existent name, which fails to fetch the remote ref and aborts. The fix is to skip the rename when already in recovery mode:\n\nbash\nif [ "$RECOVERY_MODE" = false ]; then\n ATTEMPT=$(git ls-remote --heads "$FORGE_REMOTE" "fix/issue-${ISSUE}*" 2>/dev/null | wc -l)\n if [ "$ATTEMPT" -gt 0 ]; then\n BRANCH="fix/issue-${ISSUE}-${ATTEMPT}"\n fi\nfi\n\n\n### Minor: glob can match sibling issues\n\n- lowdev/dev-agent.sh:268:fix/issue-${ISSUE}*matches issue 1 when ISSUE=1 but also matchesfix/issue-10,fix/issue-11, etc., inflating ATTEMPT and producing confusing branch names (e.g.,fix/issue-1-3when onlyfix/issue-1actually existed). Use a trailing slash-anchored or exact pattern such asrefs/heads/fix/issue-${ISSUE}$via--refsfiltering, or anchor the count tofix/issue-${ISSUE}/andfix/issue-${ISSUE}-*separately.\n\n### Positive\n\nPreserving the remote branch and PR on failure is the right debugging affordance and the cleanup simplification is clean.Verdict
REQUEST_CHANGES — branch rename logic overwrites RECOVERY_MODE branch, breaking worktree recovery
Reviewed at
d6709cc| AGENTS.mdAI Review: REQUEST_CHANGES — branch rename logic overwrites RECOVERY_MODE branch, breaking worktree recovery
d6709cc2cbto2db32b20ddAI Re-review (round 2)
Previous Findings\n\n- high branch rename clobbers recovery branch → FIXED: guarded with
if [ "$RECOVERY_MODE" = false ]at line 269, so recovery runs always use the branch already set from the existing PR.\n- low glob matches sibling issues → FIXED: replaced with two-pass exact count —grep -c "refs/heads/fix/issue-${ISSUE}$"for the base branch and a separatewc -lon the-*pattern. The$anchor in the grep correctly prevents issue 1 from matching issue 10/11/etc.\n\n### Notes\n\nThegrep -c ... || echo 0is correct:grep -cexits 1 on no match (which would triggerset -e); the fallback suppresses that. No new issues introduced.Verdict
APPROVE — both previous findings fixed correctly
Reviewed at
2db32b2| Previous:d6709cc| AGENTS.mdAI Re-review (round 2): APPROVE — both previous findings fixed correctly