bug: dev-agent does not clean up branch/worktree on CI exhausted or block #115
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
When
pr_walk_to_mergefails (CI exhausted, review rejected, agent error),dev-agent.shmarks the issue as blocked but does NOT:worktree_cleanup)The success path correctly calls
worktree_cleanup "$WORKTREE"and removes temp files. The failure path skips all of this.Impact
When the issue is later relabeled to
backlogfor a retry,dev-poll.shfinds the oldfix/issue-<N>branch on Forgejo, enters recovery mode, and pushes on top of the same broken code. The agent never gets a clean slate.This caused PR #106 and PR #111 to repeat the same CI failure on issue #90.
Fix
In the failure path of
dev-agent.sh(afterissue_block):pr_close "$PR_NUMBER"or via Forgejo APIgit push "$FORGE_REMOTE" --delete "$BRANCH"worktree_cleanup "$WORKTREE"rm -f "$SID_FILE" "$IMPL_SUMMARY_FILE"This ensures the next attempt starts from a fresh branch off main.
Affected files
dev/dev-agent.sh— failure path afterpr_walk_to_mergefailsAcceptance criteria