ISSUE DESCRIPTION Tasks PR Upstream source still queries origin This was generated by AI…
- User
ISSUE DESCRIPTION
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 with .
- Open a forked repository in Orca where
- Assistant
I'll start by exploring the repository structure and the files mentioned in the issue to understand how PR queries resolve owner/repo.
- Assistant
Let me look at the GitHub client code mentioned in the issue.
- Assistant
rg is not available, let me use grep instead.
- Assistant
I'll inspect
listWorkItems/countWorkItemsand how issue source preference is resolved. - Assistant
I'll read
resolveIssueSourceand related helpers, then check existing tests for the expected PR-source behavior. - Assistant
Let me inspect TaskPage and the existing issue-source tests to confirm how PR preference is meant to flow.
- Assistant
I'll read the full preference resolution and the preference-matrix tests next.
- Assistant
The second part of the command may have failed. Let me get the countWorkItems and preference tests.
- Assistant
I'll check docs and any PR-source resolution helpers for intended auto vs explicit preference behavior.
- Assistant
Checking whether the GitLab client already applies source preference to merge requests.
- Assistant
Interesting! Looking at the GitLab client:
- Assistant
The selector treats
sources.prsas origin — I'll verify that before changing PR resolution. - Assistant
Yes -
sources.prsis used as the "origin" chip in the selector. So we should keep reporting origin in sources.prs for the UI, while using the preference-aware repo for actual PR queries. - Assistant
I'll update
listWorkItemsandcountWorkItemsso explicit upstream/origin preference routes PR queries while keeping auto's origin PR behavior. - Assistant
I'll add a shared helper and wire both list and count paths to use the preference-aware PR owner/repo.
- Assistant
Now I'll apply the same preference-aware PR resolution in
countWorkItems. - Assistant
Let me read countWorkItems at that line.
- Assistant
I need to update countWorkItems to use the helper.
- Assistant
I'll write a temporary script to verify upstream preference routes PR list and count queries correctly.
- Assistant
I'll add a temporary Vitest file to verify upstream preference routing, run it, then remove it.
- Assistant
Next I'll run the temporary regression tests plus the related existing client tests.
- Assistant
Let me run the temp test and existing tests.
- Assistant
The command timed out. Let me check vitest config and try a more targeted run.
- Assistant
Let me try running vitest with only the temp test and see if there's mac path issues. Maybe vitest is hanging on something.
- Assistant
Temporary tests passed. Next I'll run the existing related client tests.
- Assistant
All existing tests pass. I'll check the selector tooltip copy for stale claims that PRs ignore the source preference.
- Assistant
Cleaning up the temporary test file, thenchecking the final diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.