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 instead of the upstream repo for PRs.
Let me explore the repository structure first.
Assistant
Let's explore the relevant files mentioned in the issue.
Assistant
Let me run these one at a time.
Assistant
Let me look at the key functions mentioned in the issue.
Assistant
Let me look at the critical sections:
Assistant
Let me see the
countWorkItemsfunction:Assistant
Now let me look at
resolveIssueSourceto understand how it resolves the source:Assistant
Let me look at
resolveIssueSourceandgetOwnerRepoin gh-utils.ts.Assistant
Let me do one at a time.
Assistant
Now let me look at the other key functions.
Assistant
Let me see these functions.
Assistant
Let me look at the TaskPage.tsx to understand the UI selector setup
Assistant
Let me look at the TaskPage.tsx section with the PR source selector
Assistant
Let me check the type definition for
IssueSourcePreferenceAssistant
Let me look at how
listRecentWorkItemsandlistQueriedWorkItemsuseprOwnerRepoAssistant
Now let me look at
listQueriedWorkItemsand howprOwnerRepois used in search queriesAssistant
Let me look at
buildWorkItemListArgsand the search queriesAssistant
Let me see
buildWorkItemListArgsAssistant
Let me see the function definition.
Assistant
Now let me look at the exact lines to understand the full context of both functions before editing
Assistant
Now I have a clear understanding of the issue and the fix. Let me apply the changes.
First, let me fix `listWorkItems
Assistant
I need to open the file first
Assistant
Now let me go to the relevant section for
listWorkItems.Assistant
Now let me apply the fix. First, I'll replace the
Promise.allfor `listWorkItemsAssistant
Now let me find and fix `countWorkItems
Assistant
Now apply the fix for `countWorkItems
Assistant
Now let me verify the changes look correct by checking the diff
Assistant
Now let me check if the TypeScript compiles correctly and look for any tests
Assistant
Good, no TypeScript errors. Let me check if there are existing
Assistant
Let me check if there are unit tests for the
listWorkItemsandcountWorkItemsfunctionsAssistant
Let me check the tasks page e2e test
Assistant
Let me look for any vitest tests related to the client
Assistant
Let me run the existing tests related to the client to make sure my changes don't break them
Assistant
All 29 tests pass. Let me also run the broader test suites that reference these functions
Assistant
The IPC test passes (15 tests). The other test failure is due to a missing native module (
pty.node), unrelated to my changes.Let me verify my changes one final
Assistant
Let me check the
IssueSourceSelectorcomponent to understand how it uses the origin/upstream propsAssistant
Let me look at the IssueSourceSelector component
Assistant
Wait, I need to reconsider my approach. Looking at the
IssueSourceSelector, theoriginprop comes froms.sources.prs. If I changeprOwnerRepoto be upstream when preference is 'upstream', thensources.prswould equalsources.upstreamCandidate, and the selector would stop rendering (becausehasUpstreamCandidateDivergencechecks they're different). The UI needssources.prsto stay as origin for the selector to work, but PR queries should use the preference-aware repo.Let me refine my fix.
Assistant
Let me update my approach. I need to keep
sources.prsas origin for the UI selector, but use a separate preference-aware repo for PR queriesAssistant
Now I need to update the call sites to use
prQueryRepoinstead ofprOwnerRepoAssistant
I see there's a duplicate line. Let me check the current state
Assistant
Let me fix the duplicate line
Assistant
Let me use a different approach to fix the duplicate
Assistant
Now let me verify both functions look correct
Assistant
Let me check the full diff
Assistant
Let me run the tests again
Assistant
Let me also run the IPC test
Assistant
All tests pass. Let me now do a final review of the complete changes
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.