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.
- Assistant
Let me look at the github client file mentioned in the issue.
- Assistant
Let me search for listWorkItems and prOwnerRepo and related code.
- Assistant
rg is not available, let me use grep.
- Assistant
Let me read the listWorkItems and countWorkItems implementations.
- Assistant
Let me look at how resolveIssueSource works and related tests.
- Assistant
Need to use find or grep -r
- Assistant
Let me examine resolveIssueSource and the related test files.
- Assistant
Let me read the resolveIssueSource function and getIssueOwnerRepo fully.
- Assistant
Let me read resolveIssueSource
- Assistant
Let me inspect TaskPage and how sources are used for the selector.
- Assistant
Let me examine existing work-items and issue-source tests for patterns.
- Assistant
There's an existing test that says "uses upstream for issues and origin for PRs in mixed recent results" - so the intentional design was originally that issues use upstream and PRs use origin.
- Assistant
Looking at the tests for preference='/upstream', they only check that issues query upstream, and they still mock getOwnerRepo as fork (origin). They don't yet check PR source. I understand the issue you're describing with the Tasks page in Orca, where selecting the "Upstream" source for PRs doesn't actually query the upstream repo correctly. The backend is still resolving PR queries to the origin/fork repo instead.
Let me break down my reasoning for the checklist items:
Checklist Item 1 - If an error was reported in the issue description, I have successfully reproduced it. I haven't actually run the reproduction steps in the provided environment since this is a code analysis task rather than a live testing scenario.
- Assistant
I'll also check how PR scope is handled and look for any design docs.
- Assistant
Let me also read the test for "uses upstream for issue-only queries and origin for PR-only queries" to understand the default behavior carefully.
- Assistant
Let me also check types for sources.
- Assistant
Let me search more specifically.
- Assistant
Let me read that type definition.
- Assistant
I'll implement the fix so PR queries honor the upstream preference while keeping
sources.prsas origin for the selector. - Assistant
The edit went to the wrong file. I'll restore types.ts and apply the change to client.ts.
- Assistant
Applying the fix to client.ts with the --file option.
- Assistant
There's a duplicate finally block. I need to fix that.
- Assistant
There's still an extra
}on line 1260. Let me fix that. - Assistant
listWorkItems looks clean. Fixing countWorkItems the same way.
- Assistant
I need to update countWorkItems similarly.
- Assistant
I'll clean up formatting and verify the full listWorkItems function.
- Assistant
I'll verify how listQueriedWorkItems uses the repo and run the related tests.
- Assistant
Running the related tests to verify the change.
- Assistant
Let me run the client-issue-source tests.
- Assistant
It timed out. Let me try again with a longer approach or check if ensure-native is needed.
- Assistant
Something is hanging. Let me check the vitest config and try running differently.
- Assistant
Vitest is hanging/terminating. Let me try with more debug info.
- Assistant
Let me try without those options.
- Assistant
Existing tests pass. I'll verify the fix with a temporary script instead of adding repo tests.
- Assistant
The vitest config only includes certain paths. Let me put the temp test in a path that will be picked up but outside of normal test naming - wait, the instruction says not to add new tests to the repository. I should put it somewhere temporary that vitest can run, or use a different config.
- Assistant
All temporary verification tests pass. Removing the temp test and running related suites.
- Assistant
Everything looks good. Verifying the final diff.
- Assistant
Checking IssueSourcePreference type for all values.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.