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 the Tasks page in Orca where selecting "Upstream" in the PRs tab still queries the origin repo instead of the upstream repo. Let me explore the codebase to understand the structure and then fix the issue.
Let me start by exploring the repository structure and understanding the relevant files mentioned in the issue description.
Assistant
Let me look at the specific files mentioned in the issue description:
src/main/github/client.tsandsrc/renderer/src/components/TaskPage.tsx.Assistant
I need to make only one tool call at a time. Let me find both files.
Assistant
Let me now look at the relevant files. Starting with
src/main/github/client.tsAssistant
The file is large. Let me search for key functions mentioned in the issue.
Assistant
Let me look at the
listWorkItemsandcountWorkItemsfunctions more carefullyAssistant
Now let me look at `countWorkItems
Assistant
Let me look at the
resolveIssueSourcefunction to understand the pattern:Assistant
Let me find where
resolveIssueSourceis defined:Assistant
Let me look at
resolveIssueSourcein `gh-utilsAssistant
Let me look at
listQueriedWorkItemsandlistRecentWorkItemsto understand howprOwnerRepois usedAssistant
Let me look at the TaskPage.tsx to understand how the source selector works
Assistant
Let me search for the PR source selector in
Assistant
Let me search for how
listWorkItemsandcountWorkItemsare called from the renderAssistant
Let me look at how the store calls
listWorkItemsand passes prefs:Assistant
Let me look at how
listWorkItemsis invoked in the store:Assistant
Let me look at how
listWorkItemsAcrossReposis implemented and how preference is passed:Assistant
Let me find and look at
listWorkItemsAcrossRepos:Assistant
Let me search more broadly:
Assistant
Let me look at the relevant section in TaskPage.tsx where work items are listed
Assistant
Let me look at the store slice more carefully for how listWorkItems is called:
Assistant
Let me look at the type definition and how it's called.
Assistant
Let me find where
listGitHubWorkItemsForRepois called with the preference:Assistant
Let me look at these call sites to understand how preference is threaded
Assistant
Let me look at where preference is stored and used in the store
Assistant
Let me look at the IPC handler for
listWorkItemson the main process sideAssistant
Let me look at the IPC handler for github:
Assistant
Let me look at the IPC handlers more closely:
Assistant
Let me look at the
getOwnerRepofunction to understand the difference with `getOwnerRepoForRemoteAssistant
Let me look at these functions:
Assistant
Now I have a complete understanding of the issue. Let me look at the test files to understand the expected behavior:
Assistant
Now let me look at the test file for client-work-items to understand the testing
Assistant
Let me look at the test file to understand the testing patterns:
Assistant
Let me look at the test setup for `listWorkItems
Assistant
Now I have a full understanding. Let me look at the exact code I need to edit in `listWorkItems
Assistant
Let me look at the exact code of `countWorkItems
Assistant
Now I have a clear understanding. Let me implement the fix.
Step 1: Fix
listWorkItemsinclient.tsAssistant
Let me open the file first:
Assistant
Let me open the file properly
Assistant
Now let me edit the
listWorkItemsfunction:Assistant
Let me try with the heredoc syntax for multiline editing:
Assistant
Let me use the
--fileoption:Assistant
Let me try the edit command correctly with the file already open:
Assistant
Now let me scroll down to
countWorkItems:Assistant
Let me scroll down to see countWorkItems.
Assistant
Let me scroll further:
Assistant
Now let me edit the
countWorkItemsfunction:Assistant
Let me use replace to change countWorkItems step by step. First, the Promise.all:
Assistant
Let me use heredoc syntax for replace:
Assistant
Let me navigate to the correct line:
Assistant
Now I can see the lines. Let me try the replace again:
Assistant
Let me verify the
listWorkItemsfunction looks correct:Assistant
Let me verify
countWorkItems:Assistant
Now let me run the existing tests to verify my changes don't break anything
Assistant
Let me run the relevant tests. First, the work items test:
Assistant
All 12 tests pass. Let me run the other related tests:
Assistant
Let me run the IPC and gh-utils tests:
Assistant
Let me also run the gh-utils tests and the issues tests:
Assistant
Let me also run the client-file-viewed test:
Assistant
Let me run a broader test to make sure nothing is broken in the store slices:
Assistant
All tests pass. Let me also check if the TypeScript compiles without errors:
Assistant
No TypeScript errors. Let me verify my changes with
git diff:Assistant
Let me verify that the PR queries flow correctly by checking
buildWorkItemListArgs:Assistant
Let me check
buildWorkItemListArgs:Assistant
The
buildWorkItemListArgsusesownerRepofor the--repoargument, so my change correctly routes PR queries. Let me also verifylistRecentWorkItemsflows correctly:Assistant
Let me verify
listRecentWorkItems:Assistant
My changes look correct. Let me run a broader test to catch any regressions:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.