You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: PR details fail to load for fork repositories — getOwnerRepo only checks origin #7331
When viewing a PR in a fork repository (where origin points to the fork and upstream points to the original repo), the PR details dialog shows "Unable to load details for this GitHub item."
Root Cause
getOwnerRepo() in src/main/github/github-repository-identity.ts:206 only checks the origin remote:
exportasyncfunctiongetOwnerRepo(...): Promise<OwnerRepo|null>{returngetOwnerRepoForRemote(repoPath,"origin", ...)// only origin}
But getIssueOwnerRepo() at line 214 correctly checks upstream first, then falls back to origin:
The code comment in client.ts:1900 even acknowledges this discrepancy:
"the issue lookup now targets upstream while the PR lookup targets origin"
Steps to Reproduce
Have a repo where origin → fork, upstream → original repo
Open a PR from the PR list in Orca
See "Unable to load details for this GitHub item."
Actual Behavior
# What Orca does:
gh pr view 7221 --repo fsdwen/orca --json ...
# → Could not resolve to a PullRequest with the number of 7221.# What it should do:
gh pr view 7221 --repo stablyai/orca --json ...
# → Successfully returns PR data
Expected Behavior
PR details should load correctly regardless of whether the repo is a fork, just as issue details already do.
Impact
All Orca users working with fork repositories cannot view PR details.
Proposed Fix
Change getOwnerRepo() to check upstream first, matching the behavior of getIssueOwnerRepo().
Confirmed in the current tree. getOwnerRepo() in src/main/github/github-repository-identity.ts:206 resolves the repo from the origin remote only, whereas getIssueOwnerRepo() at line 214 checks upstream first. On a fork checkout (origin→fork, upstream→parent), the PR-detail paths in client.ts (the gh pr view callers that fall back to getOwnerRepo, e.g. lines 3613/3886/3979/4119/…) target the fork, so gh pr view <N> --repo <fork> fails with "Could not resolve to a PullRequest" — surfaced as "Unable to load details for this GitHub item." Issue details work precisely because their resolver already prefers upstream.
Repro test imports the real module and mocks the git runner (origin→fsdwen/orca, upstream→stablyai/orca): getOwnerRepo() returns the fork, getIssueOwnerRepo() returns the parent — the exact divergence reported.
Re-run:
pnpm exec vitest run --config config/vitest.config.ts src/main/github/repro-7331-fork-pr-owner-repo.test.ts
Fix direction: make getOwnerRepo() prefer upstream then fall back to origin (mirroring getIssueOwnerRepo), or route PR-detail lookups through the existing resolvePRRepositoryCandidates(). Preserve fork-push semantics where the fork is the correct head repo for PR creation.
Automated bug-reproduction pass. Repro artifact committed on branch nwparker/bug-repro-pass2; check it out to run the command above. Writeup: docs/bug-reproductions/7331.md.
Activity
fix: resolve PR owner repo via upstream-first lookup
nwparker commentedon Jul 18, 2026
Status: REPRODUCED (unit test)
Confirmed in the current tree.
getOwnerRepo()insrc/main/github/github-repository-identity.ts:206resolves the repo from theoriginremote only, whereasgetIssueOwnerRepo()at line 214 checksupstreamfirst. On a fork checkout (origin→fork,upstream→parent), the PR-detail paths inclient.ts(thegh pr viewcallers that fall back togetOwnerRepo, e.g. lines 3613/3886/3979/4119/…) target the fork, sogh pr view <N> --repo <fork>fails with "Could not resolve to a PullRequest" — surfaced as "Unable to load details for this GitHub item." Issue details work precisely because their resolver already prefersupstream.Repro test imports the real module and mocks the git runner (
origin→fsdwen/orca,upstream→stablyai/orca):getOwnerRepo()returns the fork,getIssueOwnerRepo()returns the parent — the exact divergence reported.Re-run:
Fix direction: make
getOwnerRepo()preferupstreamthen fall back toorigin(mirroringgetIssueOwnerRepo), or route PR-detail lookups through the existingresolvePRRepositoryCandidates(). Preserve fork-push semantics where the fork is the correct head repo for PR creation.Key files:
src/main/github/github-repository-identity.ts,src/main/github/client.tsAutomated bug-reproduction pass. Repro artifact committed on branch
nwparker/bug-repro-pass2; check it out to run the command above. Writeup:docs/bug-reproductions/7331.md.fix(github): load PR details on fork checkouts by preferring upstream (…