From f463f49b462b322e4eb9fe037e1404b328a0606a Mon Sep 17 00:00:00 2001 From: m3taversal Date: Mon, 20 Apr 2026 22:41:14 +0100 Subject: [PATCH] fix: prevent false 'already up to date' on fork PRs with merge commits When a contributor merges main into their fork branch (standard GitHub workflow), merge-base equals main SHA, triggering the 'already up to date' early return. This closes the PR without cherry-picking the new content. Cameron's PR #3377 hit this exact bug. Fix: add a diff check before returning 'already up to date'. If the branch has actual content changes vs main, proceed to cherry-pick instead of short-circuiting. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/merge.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/merge.py b/lib/merge.py index 1d54bf2..0e4ccef 100644 --- a/lib/merge.py +++ b/lib/merge.py @@ -308,7 +308,14 @@ async def _cherry_pick_onto_main(branch: str) -> tuple[bool, str]: rc, merge_base = await _git("merge-base", "origin/main", f"origin/{branch}") rc2, main_sha = await _git("rev-parse", "origin/main") if rc == 0 and rc2 == 0 and merge_base.strip() == main_sha.strip(): - return True, "already up to date" + # Branch is descendant of main — but fork workflows (merge main into branch) + # create this state while still having new content. Check for actual diff. + rc_diff, diff_out = await _git( + "diff", "--stat", f"origin/main..origin/{branch}", timeout=10, + ) + if rc_diff != 0 or not diff_out.strip(): + return True, "already up to date" + logger.info("Branch %s is descendant of main but has new content — proceeding", branch) # Get extraction commits (oldest first), skip merge commits from fork workflows rc, commits_out = await _git(