feat(local): review PR refs from any branch#7
Conversation
Signed-off-by: samzong <samzong.lu@gmail.com>
8fa2a43 to
e614b53
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de24fe7025
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return { | ||
| repoPath: sandboxPath, | ||
| prompt: options.prompt.split(options.repoPath).join(sandboxPath), | ||
| prompt: options.prompt.split(sourceRepoPath).join(sandboxPath), |
There was a problem hiding this comment.
Rewrite relative repo paths in sandbox prompts
When needlefish pr 123 --repo ../app or any relative --repo is used, the bundle still contains that relative repoPath because runLocal/runLocalPr pass cwd through unchanged, but this replacement only looks for path.resolve(options.repoPath). The runner is then started in the temp sandbox, so any model command that follows the bundle's repoPath will fail or inspect a non-sandbox checkout instead of the PR head, defeating the new any-branch PR review path; normalize the bundle path or replace both the original and resolved forms.
Useful? React with 👍 / 👎.
| hasCommit(cwd, pr.baseSha) && | ||
| hasCommit(cwd, pr.headSha) && | ||
| hasMergeBase(cwd, pr.baseSha, pr.headSha); | ||
| if (ready()) return; |
There was a problem hiding this comment.
Avoid returning before deepening shallow PR refs
In a shallow detached checkout where the PR base, head, and merge-base are already present, this returns before the unshallow fallback runs. The later runner sandbox has to clone/fetch from that shallow source; if the PR head only exists through FETCH_HEAD rather than a local ref, Git can reject the shallow-root update or leave no usable FETCH_HEAD, so needlefish pr aborts even though ensurePrCommits declared the repo ready. Keep deepening shallow repos or materialize the PR head under a local ref before returning.
Useful? React with 👍 / 👎.
|
Addressed both Codex findings in a2e793b:
Verified locally:
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2e793ba04
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return { | ||
| repoPath: sandboxPath, | ||
| prompt: options.prompt.split(options.repoPath).join(sandboxPath), | ||
| prompt: options.prompt.split(sourceRepoPath).join(sandboxPath), |
There was a problem hiding this comment.
Replace relative repo paths in sandbox prompts
When GitHub mode is invoked with a relative --repo (the parser still accepts --repo for github commands, and runGithub passes cwd through to makeBundle as repoPath at src/adapters/github.ts:122-124), the bundle contains that relative path. This replacement only searches for the resolved absolute path, so the prompt sent to the runner keeps repoPath: "../checkout" instead of the sandbox path; any runner command that follows the prompt path can read from the caller-relative location or fail outside the clone. Resolve the repo before bundling in runGithub, or replace both the raw and resolved paths here.
Useful? React with 👍 / 👎.
|
Addressed the latest Codex finding in 894d9fe:
Verified locally:
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Prepared changelog for PR #7 in 7b1dc1d:
Verified locally:
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b1dc1d708
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| --focus <text> narrow the review lens | ||
| --deep wider context (call sites, history, adjacent tests) |
There was a problem hiding this comment.
Move local-only flags out of shared help
When users run needlefish --help, --focus and --deep are advertised under “Shared options,” but GitHub mode still rejects both options in this parser. A user following the help text with needlefish --github --pr 1 --focus security gets an error instead, so these flags should either be moved to a local/PR-only section or accepted in GitHub mode.
Useful? React with 👍 / 👎.
What's changed?
--prby resolving PR base/head refs and running against the PR head from any branch.--prbehavior.Why
Verification
./node_modules/.bin/tsc --noEmitnode scripts/test.mjs(39 passed)git diff --check && git diff --cached --check/pre-ship --committed(0 MUST-FIX)