Skip to content

fix(create-pr): allow new PR after branch was merged - #698

Merged
baleen37 merged 1 commit into
mainfrom
zesty-willow-stroustrup
Jun 24, 2026
Merged

fix(create-pr): allow new PR after branch was merged#698
baleen37 merged 1 commit into
mainfrom
zesty-willow-stroustrup

Conversation

@baleen37

@baleen37 baleen37 commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • create-pr preflight가 머지된 브랜치에 새 커밋이 쌓여도 MERGED:로 종료해 새 PR을 못 만들던 버그 수정

Changes

  • preflight-check.sh: MERGED: 종료를 현재 HEAD가 머지된 PR tip(headRefOid)과 같을 때로 한정. 머지 이후 새 커밋이 있으면 통과시켜 새 PR 생성 경로로 진행. headRefOid 조회 실패 시 기존 동작 유지
  • create-pr-e2e.bats: 버그 재현 테스트 + HEAD==머지tip 회귀 방지 테스트 추가, stub에 headRefOid/rev-parse HEAD 보강

Tests

  • bats tests/me/create-pr-e2e.bats 8개 통과
  • shellcheck preflight-check.sh 통과

Summary by CodeRabbit

  • Bug Fixes
    • Improved PR status handling so a merged PR is only treated as complete when your current branch still matches the merged commit.
    • If new commits were added after merge, the flow now continues normally instead of stopping early.
  • Tests
    • Added end-to-end coverage for merged-PR behavior, including matching and diverged branch cases.

@baleen37
baleen37 enabled auto-merge (squash) June 24, 2026 05:56
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d791c74-5e21-40dc-af17-fa4852abaced

📥 Commits

Reviewing files that changed from the base of the PR and between 08d05c9 and 26c7a89.

📒 Files selected for processing (2)
  • plugins/me/skills/create-pr/scripts/preflight-check.sh
  • tests/me/create-pr-e2e.bats

📝 Walkthrough

Walkthrough

preflight-check.sh replaces an unconditional early exit for MERGED PRs with a check that fetches the PR's headRefOid via gh and compares it to the local HEAD OID; exit 0 only occurs on a match. The e2e test file adds matching stubs and two new test cases covering both the matching and diverged scenarios.

Conditional MERGED Exit and E2E Coverage

Layer / File(s) Summary
Conditional MERGED exit in preflight script
plugins/me/skills/create-pr/scripts/preflight-check.sh
Replaces unconditional exit 0 on MERGED state with a headRefOid fetch and local HEAD OID comparison; exits 0 only when the two OIDs are equal, otherwise falls through to the wrapper flow.
Test stubs and e2e assertions
tests/me/create-pr-e2e.bats
Adds rev-parse HEAD and pr view --json headRefOid stubs to the fake executables; adds two test cases—one asserting MERGED: output and no PR creation when OIDs match, and one asserting no MERGED: output and a push when HEAD has diverged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • baleen37/bstack#578: Also modifies preflight-check.sh around the MERGED terminal behavior and wait-for-merge logic in the create-pr skill.
  • baleen37/bstack#696: Directly precedes this PR—touches both preflight-check.sh and create-pr-e2e.bats around the early MERGED: exit behavior that this PR further tightens.

Poem

🐰 A merge isn't done just because the flag's set,
The HEAD must align or we're not finished yet!
I sniff the commit OID, left and right,
If hashes don't match, I'll keep pushing with might.
Only when tips meet shall the rabbit rest. 🌿

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zesty-willow-stroustrup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@baleen37
baleen37 merged commit 43bdff7 into main Jun 24, 2026
4 of 5 checks passed
@baleen37
baleen37 deleted the zesty-willow-stroustrup branch June 24, 2026 05:57
baleen-release-app Bot pushed a commit that referenced this pull request Jun 24, 2026
## [17.25.2](v17.25.1...v17.25.2) (2026-06-24)

### Bug Fixes

* **create-pr:** allow new PR after branch was merged ([#698](#698)) ([43bdff7](43bdff7))
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