fix(mcp): anchor PR context at merge base#397
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b624387028
ℹ️ 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".
| } | ||
|
|
||
| fn default_pr_base_ref(project_root: &std::path::Path) -> String { | ||
| crate::branch::detect_default_branch(project_root).unwrap_or_else(|| "main".to_string()) |
There was a problem hiding this comment.
Prefer the fetched remote default for omitted bases
When origin/HEAD is present, branch::detect_default_branch() strips refs/remotes/origin/ and returns only master/main. In repositories where the local default branch is stale but origin/<default> has been fetched, this omitted-base path passes the stale local ref into git_pr_comparison, so the merge base can move back before the PR fork point and pr_context again includes unrelated default-branch changes. Prefer the remote ref when that is what was detected, or otherwise verify the local ref is current.
Useful? React with 👍 / 👎.
Summary
pr_contextuse true three-dot PR semantics by diffing the merge base against the headbase_refis omittedDogfood failure
Reviewing #389 from a branch whose
origin/masterhad advanced madetracedecay tool pr_contextreport 299 files and up to 100 unrelated historical commits for a two-file PR. The same defect inflated another two-file review to 11 files. Rawgit diff origin/master...HEADshowed the correct scope.Tests
pr_contextintegration tests: 2 passedcargo clippy --workspace --all-targets --locked -- -D warnings: pass