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
Let me start by understanding the repository structure and the issue. The issue is about the Tasks page where selecting "Upstream" in the source selector still queries the origin repo for PRs instead of the upstream repo.
Let me explore the repository structure first, then look at the relevant files mentioned in the issue description.
The key files mentioned are:
src/main/github/client.ts- resolvesprOwnerReposeparately viagetOwnerRepo(repoPath, connectionId), which is the origin reposrc/renderer/src/components/TaskPage.tsx- renders the selector
Let me start by exploring the codebase.
Assistant
Let me look at the specific files mentioned in the issue.
Assistant
Let me read both files to understand the issue.
Assistant
Let me search for the key functions mentioned in the issue description
Assistant
Let me look at the
listWorkItemsandissueResolvedfunctions more closely.Assistant
Let me look at the
resolveIssueSourcefunction to understand how preferences work.Assistant
resolveIssueSourceis imported. Let me find where it's defined.Assistant
Let me look at
resolveIssueSourceingh-utils.ts.Assistant
Let me look at
getOwnerRepofunctionAssistant
Let me look at the
getOwnerRepofunction more closely.Assistant
Now let me see the full
listWorkItemsfunction andcountWorkItemsfunction.Assistant
Now let me look at
listRecentWorkItemsandlistQueriedWorkItemsto see how they use `prOwnerRepoAssistant
Let me look at the test files related to this issue.
Assistant
Let me search for tests related to the upstream preference in the work items test.
Assistant
Let me look at the issue source test file to see how preference is tested
Assistant
Let me look at the complete
countWorkItemsfunction.Assistant
Let me look at the
listQueriedWorkItemsfunction to understand how it usesprOwnerRepo.Assistant
Now I have a clear understanding of the issue and the fix. Let me implement it.
The fix needs to change
listWorkItemsandcountWorkItemsinsrc/main/github/client.tsso thatprOwnerReporespects thepreferenceparameter (not justissueOwnerRepo).Let me first look at the exact lines I need to edit:
Assistant
Now let me make the changes. First, fix
listWorkItems:Assistant
I need to open the file first.
Assistant
Now let me go to the relevant lines and make the edit
Assistant
Now let me make the first edit to
listWorkItemsAssistant
Good,
listWorkItemsis fixed. Now let me fixcountWorkItems. Let me look at itAssistant
Now let me edit `countWorkItems
Assistant
Good, both functions are fixed. Let me now run the existing tests to verify nothing is broken.
Assistant
All tests pass. Let me also run the broader test suite to see if anything else is affected
Assistant
All 191 tests pass. Let me also run any other relevant tests that might be affected
Assistant
Let me verify the final diff of my
Assistant
Let me check if there are other places that might need similar treatment
Assistant
The fix looks complete. Let me run a broader set of tests to make sure nothing else is broken
Assistant
All 337 tests pass across 26 test files. The fix is complete and working correctly.
Let me now go through the checklist:
Checklist Review
-
If an error was reported in the issue description, I have successfully reproduced it.
- ✅ I confirmed the bug by reading the code. In
listWorkItemsandcountWorkItems,prOwnerRepowas always resolved viagetOwnerRepo(repoPath, connectionId)which callsgetOwnerRepoForRemote(repoPath, 'origin', connectionId)— always origin, regardless of the user's preference. Meanwhile correctly used which respects the preference.
- ✅ I confirmed the bug by reading the code. In
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.