Repository navigation
fix(gitlab): open the New-MR page on the fork project for fork-pushed branches - #7654
Conversation
📝 WalkthroughWalkthroughThis change modifies the GitLab branch of Changes
Sequence Diagram(s)Not applicable; change is a single conditional URL construction adjustment without multi-component interaction. Related issues: None specified. Related PRs: None specified. Suggested labels: bug, gitlab, tests Suggested reviewers: None specified. Poem: A rabbit hopped through forked terrain, 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6debc59a-67d7-42fc-a629-ac8d45199311
📥 Commits
Reviewing files that changed from the base of the PR and between f057c9d and 506840bba97fc829ddc1aa5804b318fb4ba85fa1.
📒 Files selected for processing (2)
src/renderer/src/components/right-sidebar/source-control-manual-review-url.test.tssrc/renderer/src/components/right-sidebar/source-control-manual-review-url.ts
… branches buildSourceControlManualReviewUrl computes headRepo precisely to support forks — the GitHub branch qualifies the head via githubHeadRef — but the GitLab branch discarded it and always built /-/merge_requests/new on the base repo. When the branch was pushed to a fork, GitLab can't see source_branch on the base project, so the user landed on a broken New-MR page. Build the URL on headRepo.webBaseUrl (where the branch actually lives); GitLab defaults the target to the fork's upstream. headRepo === baseRepo for the non-fork case, so it's a no-op there. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
506840b to
638d0ef
Compare
|
Thanks so much for this, @xianjianlf2 — open the New-MR page on the fork project for fork-pushed branches. Reviewed, rebased on latest |
… branches (stablyai#7654) Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Summary
Fixes GitLab "Create MR in browser" landing on a broken New-MR page (404) when the branch was pushed to a fork.
ELI5
When you asked Orca to open a merge request for a branch you pushed to your own fork, it sent you to the wrong project's page — one that couldn't see your branch. Now it opens the right page where your branch actually lives.
Root cause & fix
buildSourceControlManualReviewUrlcomputes aheadRepoto support forks, but the GitLab branch of the switch ignored it and always built/-/merge_requests/newon the base repo. For a fork-pushed branch, thesource_branchonly exists on the fork project, so the base project's New-MR page 404s. The fix builds the GitLab URL onheadRepo.webBaseUrlinstead ofbaseRepo.webBaseUrl, matching what the GitHub branch already does. For non-fork remotesheadRepo === baseRepo, so it's a no-op.Evidence
Validated & rebased onto latest main during a bug-bash triage on 2026-07-23.
src/renderer/src/components/right-sidebar/source-control-manual-review-url.test.tsorigin/mainfails the new fork case (1 failed | 16 passed):7ab601487c, head506840bba9).oxlinton the fixed file reports no findings.Trade-offs
None — pure fix.
Regression risk
Zero-regression: only the GitLab branch of the switch changes, and
headRepo === baseRepofor non-fork remotes, so existing self-hosted/origin GitLab links are byte-identical (covered by the passing self-hosted GitLab test). No other providers (GitHub/Bitbucket) are touched.Credit to original author @xianjianlf2 (Mark Xian). Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.