Tasks PR Upstream source still queries origin This was generated by AI during triage.…
- User
Tasks PR Upstream source still queries origin
This was generated by AI during triage.
Summary
In the Tasks page, selecting the
PRstab and choosingUpstreamin the source selector can showNo matching GitHub workeven when matching upstream PRs exist.The upstream/origin selector is visible in the PRs view, but the GitHub client still resolves PR list/count queries from
origin, sois:pr is:open author:@mesearches the fork/origin repo instead of the selected upstream repo.Reproduction
- Open a forked repository in Orca where
originpoints to the fork andupstreampoints to the canonical repo. - Open Tasks.
- Select
PRs. - Select
Upstreamin the source selector. - Use a PR-only query such as
is:pr is:open author:@me.
Actual behavior
The list can be empty with
No matching GitHub work, despite matching PRs existing in the upstream repository.Expected behavior
When
Upstreamis selected, PR list and PR count queries should use the upstream owner/repo, so the PRs tab returns matching upstream PRs.Code evidence
src/main/github/client.tsresolvesissueResolvedwith the selected preference, but resolvesprOwnerReposeparately viagetOwnerRepo(repoPath, connectionId), which is the origin repo.listWorkItemspasses thatprOwnerRepointo both recent and queried PR fetches.countWorkItemsuses the sameprOwnerRepofor PR count queries, so pagination/count can also be wrong.src/renderer/src/components/TaskPage.tsxrenders the selector usingorigin={s.sources.prs}andupstream={s.sources.upstreamCandidate}, which makes the control appear relevant in the PRs surface while the backend still routes PR queries to origin.
Suggested regression coverage
Add tests for:
listWorkItems('/repo-root', 10, 'is:pr is:open author:@me', undefined, 'upstream')using the upstream slug in--repo.countWorkItems('/repo-root', 'is:pr is:open author:@me', 'upstream')building a search query withrepo:<upstream-owner>/<repo>.
- Open a forked repository in Orca where
- Assistant
Investigating how PR list/count queries resolve the repo when "Upstream" is selected.
- Assistant
Implementing
resolvePRSourceso PR queries honor the preference while keepingsources.prsas the origin remote for the selector UI. - Assistant
Implementing the fix and adding tests.
- Assistant
Updating tests to mock
resolvePRSourceand adding regression coverage. - Assistant
Refactoring to resolve the PR source from already-fetched remotes, avoiding duplicate mock consumption and extra git calls.
- Assistant
Fixed. PR list and count queries now respect the upstream/origin preference, while
sources.prsstill reports the origin remote for the selector UI.Root cause
listWorkItemsandcountWorkItemsresolved issues viaresolveIssueSource(preference)but always usedgetOwnerRepo()(origin) for PR queries. Selecting Upstream in Tasks only changed issue queries.Fix
- Added
resolvePRSourceFromRemotes()ingh-utils.ts— same preference semantics as issues, but PRs default to origin in'auto'mode (fork workflow). - Updated
listWorkItemsandcountWorkItemsto:- Resolve
prQueryRepofrom preference + already-fetchedoriginRepo/upstreamCandidate - Use
prQueryRepofor PR fetches and counts - Keep
sources.prsas the origin remote (for the selector pills)
- Resolve
- Set
issueSourceFellBackwhen either issue or PR resolution falls back from an explicit upstream preference.
- Added
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.