Skip to content

fix(drift): pre-delete stale remote branch before push#106

Merged
paultyng merged 1 commit into
mainfrom
fix/drift-stale-branch
May 24, 2026
Merged

fix(drift): pre-delete stale remote branch before push#106
paultyng merged 1 commit into
mainfrom
fix/drift-stale-branch

Conversation

@paultyng
Copy link
Copy Markdown
Owner

Summary

Re-dispatch after #105 surfaced a third bug: cursor's leg failed with non-fast-forward because the branch chore/upstream-drift-cursor-20260524 was left behind on origin when #104 was closed (GitHub only auto-deletes branches on merge, not close). The dedupe guard at the top of the script only checks for open PRs, so it didn't catch this.

Add an unconditional git push --delete origin "$BRANCH" before the push. The dedupe guard guarantees we only get here when no open PR exists, so any leftover remote ref is from a closed/abandoned attempt and safe to drop.

Test plan

  • bash -n + shellcheck clean
  • After merge: delete the orphan chore/upstream-drift-cursor-20260524 branch one-time, re-dispatch, confirm all three vendors complete and cursor opens a clean PR.

🤖 Generated with Claude Code

The re-dispatch after #105 merged failed in cursor's leg:

  ! [remote rejected] chore/upstream-drift-cursor-20260524 (non-fast-forward)
  hint: 'git pull' before pushing again.

The branch on origin was left behind when #104 was closed (no
auto-delete fires on close, only on merge). The dedupe guard at
the top of the script only checks for OPEN PRs with the matching
title, so it didn't catch this case.

Add an unconditional `git push --delete origin "$BRANCH"` before
the push. The dedupe guard guarantees we only get here when no
open PR exists, so any leftover remote ref is from a closed
attempt and safe to drop.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@paultyng paultyng marked this pull request as ready for review May 24, 2026 14:49
@paultyng paultyng enabled auto-merge (squash) May 24, 2026 14:49
@paultyng paultyng merged commit 04ffcca into main May 24, 2026
3 checks passed
@paultyng paultyng deleted the fix/drift-stale-branch branch May 24, 2026 14:51
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