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 at hand.
The issue is about:
- In the Tasks page, when selecting "PRs" tab and choosing "Upstream" source, the PR queries still use origin repo instead of upstream repo.
- The code evidence points to
src/main/github/client.tswhereprOwnerRepois resolved separately viagetOwnerRepo(repoPath, connectionId)which returns the origin repo. listWorkItemsandcountWorkItemsuse thisprOwnerRepofor PR queries.- The fix should use the upstream owner/repo when
sourceisupstream.
Let me explore the repository structure first.
Assistant
Let me look at the key files mentioned in the issue.
Assistant
The output was truncated. Let me look at the specific functions mentioned in the issue
Assistant
Let me look at the
listWorkItemsandcountWorkItemsfunctions in detail:Assistant
Now let me look at
resolveIssueSourceand understand how it worksAssistant
Let me look at the resolveIssueSource function.
Assistant
Let me now look at the functions where
prOwnerRepois used in listQueriedWorkItems and listRecentWorkItemsAssistant
Now let me look at
countWorkItems:Assistant
Let me look at the
getOwnerRepoandgetOwnerRepoForRemotefunctions to understand the differenceAssistant
Let me look at these two functions to understand their semantics.
Assistant
Now I have a clear understanding of the issue. Let me implement the fix.
The problem is:
- In
listWorkItems(line 1202-1204):prOwnerRepois always resolved viagetOwnerRepo(repoPath, connectionId)which returns origin, even whenpreferenceis'upstream'. - In
countWorkItems(line 1355-1357): Same issue —prOwnerRepois always origin.
The fix: when
preferenceis'upstream'and the upstream remote exists, use the upstream owner/repo forprOwnerRepo.Let me first look at those exact lines to make precise edits:
- In
Assistant
Now let me look at
countWorkItemslinesAssistant
Now I'll apply the fix. First, let's fix `listWorkItems
Assistant
I need to use the proper syntax with heredoc. Let me try
Assistant
Let me open the file first
Assistant
Now let me edit the
listWorkItemsfunctionAssistant
Good,
listWorkItemsis fixed. Now let me fixcountWorkItemsAssistant
Now let me edit `countWorkItems
Assistant
Let me try using the
replacecommand insteadAssistant
Both changes look correct. Let me verify by checking TypeScript compilation
Assistant
Let me check for existing tests related to these functions
Assistant
No tests found in the tests directory. Let me look at the tests directory structure.
Assistant
Let me look for unit tests in the source directories
Assistant
Let me check the relevant test files for GitHub work
Assistant
Let me check these test files for relevant test patterns
Assistant
Let me look at the full test context for the relevant tests
Assistant
Let me run the relevant tests to verify my changes don't break anything
Assistant
Tests pass. Let me also run the github store tests
Assistant
That test failure is pre-existing and unrelated to my changes (module resolution issue). Let me check for any other tests related to the gh-utils functions I'm
Assistant
Let me look at the relevant test
Assistant
Let me look at the client-work-items test
Assistant
Let me run the client-work-items tests to verify my changes
Assistant
All tests pass. Let me also run the issue-source and gh-utils tests
Assistant
All tests pass. Let me look at the issue source test to make sure I understand the test
Assistant
Let me look at the test case "uses upstream for issues and origin for PRs in mixed recent results
Assistant
Let me see the test details
Assistant
Let me check the preference-aware tests
Assistant
Let me look at the preference-aware tests in more
Assistant
Let me see the last test and understand the full
Assistant
Let me also run the main client test
Assistant
All tests pass. Let me verify my changes look correct by reviewing them
Assistant
The changes look correct. Let me run all GitHub-related unit tests to make sure everything passes
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.