-
Notifications
You must be signed in to change notification settings - Fork 0
Fix stacked PR reviews to use PR base, not main #59
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 |
|---|---|---|
|
|
@@ -118,7 +118,7 @@ export function collectCandidates( | |
| } | ||
|
|
||
| // Fetch the diff once, here in the runner — codex reviews it from the prompt with no network/gh of its own. | ||
| const read = getDiff(cfg, pr.number) | ||
| const read = getDiff(cfg, pr) | ||
|
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. 🔴 src/sweep/sweep.ts:121 · bug · conf 0.98 |
||
| if (!read.ok && read.reason === 'too-large') { | ||
| // Terminal: gh will never hand us this diff, so there is nothing to retry and nothing to measure. Say so | ||
| // plainly — the old wording promised a retry that could not possibly succeed. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Detached worktree at a PR's head SHA so codex reads the same tree the diff describes — required for stacked | ||
| // PRs whose base is not main (the shared checkout stays on defaultBranch for refreshRepo). | ||
| import { rmSync } from 'node:fs' | ||
| import { dirname, join } from 'node:path' | ||
|
|
||
| import { exec } from '@bevyl-ai/agent-tools' | ||
|
|
||
| import { type Pr } from './prs' | ||
|
|
||
| export function headWorktreePath(repoDir: string, pr: Pr): string { | ||
| return join(dirname(repoDir), 'worktrees', `${pr.number}-${pr.headRefOid.slice(0, 8)}`) | ||
| } | ||
|
|
||
| /** Fetch base+head and add a detached worktree at the PR head. Returns null on failure. */ | ||
| export function prepareHeadWorktree(repoDir: string, pr: Pr): string | null { | ||
| const dir = headWorktreePath(repoDir, pr) | ||
| rmSync(dir, { recursive: true, force: true }) | ||
| exec('git', ['worktree', 'prune'], { cwd: repoDir }) | ||
| if ( | ||
| !exec('git', ['fetch', '-q', 'origin', pr.baseRefOid, pr.headRefOid], { cwd: repoDir }).ok || | ||
|
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. 🟠 src/sweep/worktree.ts:20 · footgun · conf 0.93 |
||
| !exec('git', ['worktree', 'add', '--detach', dir, pr.headRefOid], { cwd: repoDir }).ok | ||
| ) { | ||
| return null | ||
| } | ||
| return dir | ||
| } | ||
|
|
||
| export function removeHeadWorktree(repoDir: string, pr: Pr): void { | ||
| const dir = headWorktreePath(repoDir, pr) | ||
| exec('git', ['worktree', 'remove', '--force', dir], { cwd: repoDir }) | ||
| rmSync(dir, { recursive: true, force: true }) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.