Skip to content

Prevent finish reruns from reopening duplicate PR waits#354

Merged
NagyVikt merged 1 commit intomainfrom
agent/codex/prevent-finish-rerun-from-opening-duplic-2026-04-22-23-58
Apr 22, 2026
Merged

Prevent finish reruns from reopening duplicate PR waits#354
NagyVikt merged 1 commit intomainfrom
agent/codex/prevent-finish-rerun-from-opening-duplic-2026-04-22-23-58

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Automated by gx branch finish (PR flow).

A stale post-merge branch can survive with its worktree still present, and rerunning gx branch finish on that same head was creating a brand-new PR instead of treating the lane as already shipped. The finish flow now checks merged PR history for the exact source HEAD before PR creation so cleanup reruns stay bounded and idempotent.

Constraint: Keep legitimate follow-up PRs working when the branch name is reused with a different head commit
Rejected: Skip PR flow for any previously merged branch name | branch names can be reused for new commits and still need a real PR
Confidence: high
Scope-risk: narrow
Directive: Keep the merged-head guard tied to exact HEAD SHA matches; do not widen it to branch-name-only detection
Tested: bash -n scripts/agent-branch-finish.sh templates/scripts/agent-branch-finish.sh
Tested: node --test test/finish.test.js
Tested: node --test test/metadata.test.js
Tested: git diff --check
Not-tested: Live GitHub cleanup rerun against a hosted repo after a previously merged PR
@NagyVikt NagyVikt merged commit bd9b699 into main Apr 22, 2026
@NagyVikt NagyVikt deleted the agent/codex/prevent-finish-rerun-from-opening-duplic-2026-04-22-23-58 branch April 22, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant