-
Notifications
You must be signed in to change notification settings - Fork 108
fix(engine): short-circuit zero-commits-ahead branch before AI-merge clean-room churn #1920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -622,6 +622,19 @@ export async function landOneRepo( | |||||
| throwIfAborted(signal, taskId); | ||||||
| const tipSha = await git(["rev-parse", "--verify", `refs/heads/${integrationBranch}`], repoRootDir); | ||||||
|
|
||||||
| // Short-circuit a branch with zero commits ahead of the integration tip | ||||||
| // BEFORE building a clean room + installing deps. A truly-empty branch would | ||||||
| // reach the identical `outcome: "empty"` return below via mergeAndReview → | ||||||
| // no squashSha, but only after the throw-prone dep-install churn (which a | ||||||
| // non-workspace land hard-fails), so the merge gets transient-retried to | ||||||
| // exhaustion and the card is parked failed. Only short-circuit on a CONFIDENT | ||||||
| // 0: a git failure yields "" → parseInt → NaN (≠ 0) and falls through. | ||||||
| const aheadRaw = await git(["rev-list", "--count", `${integrationBranch}..${branch}`], repoRootDir).catch(() => ""); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The empty-branch check still lets Git resolve the integration side as a bare ref. When a repo has a tag or other ref named like the integration branch,
Suggested change
|
||||||
| if (Number.parseInt(aheadRaw.trim(), 10) === 0) { | ||||||
| await audit.git({ type: "merge:ai-empty", target: integrationBranch, metadata: { taskId, tipSha } }); | ||||||
| return { outcome: "empty", tipSha, integrationBranch }; | ||||||
| } | ||||||
|
|
||||||
| // 1. Clean-room worktree at the integration tip. | ||||||
| let mergeRoot: string | undefined; | ||||||
| let worktreeAdded = false; | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This early return uses bare branch names for the rev-list range, while the surrounding code verifies
refs/heads/${integrationBranch}explicitly. If a tag or other ref shares the integration branch name, Git can resolve the range against that ref and report0, causinglandOneRepoto returnemptybefore the normal merge path even though the task branch still has work relative to the branch head.