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 withrepo:<upstream-owner>/<repo>.
Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /orca, current file: none) bash-$
- Open a forked repository in Orca where
- Assistant
I'll start by exploring the repository structure and the files mentioned in the issue to understand how PR queries resolve owner/repo.
- Assistant
I'll inspect
client.tsfor howprOwnerRepoand issue/PR source preferences are resolved. - Assistant
rg is not available, let me use grep instead.
- Assistant
Let me read the listWorkItems and countWorkItems functions more carefully, and also look at how issue source preference is resolved.
- Assistant
I need to inspect resolved issue source handling, including
resolveIssueSourceand preference-based owner/repo selection. - Assistant
Need to grep recursively properly.
- Assistant
Let me look at resolveIssueSource in gh-utils.ts
- Assistant
So
resolveIssueSourcealready handles preference for issues. For PRs, we need similar resolution. Looking at the issue description: - Assistant
I'll check existing tests and TaskPage next to see how origin vs upstream preferences are applied to PRs.
- Assistant
Looking next at how the PRs tab uses the source selector and related comments.
- Assistant
So the IssueSourceSelector is used for both. When preference is 'upstream', both issues and PRs should probably go to upstream based on the issue description.
- Assistant
I'll inspect
countWorkItemsand the fullresolveIssueSourcelogic more closely. - Assistant
Let me also check if resolveIssueSource is re-exported and whether there's a resolvePRSource or comments about sources.prs meaning origin always.
- Assistant
Let me look at the types and comment about sources.prs more carefully.
- Assistant
Important detail: the selector treats
sources.prsas origin. I'll check preference tests and selector behavior when that becomes upstream. - Assistant
I'll check IssueSourceSelector and how
sources.prsis treated as the origin value. - Assistant
I'll search for other uses of sources.prs to understand the contract.
- Assistant
Confirming: I'll keep
sources.prsas origin for the selector and make PR queries honor preference. - Assistant
Checking how PR queries are built for the search path:
- Assistant
I'll check the imports and any existing
resolvePRSource-style helper. - Assistant
Implementing the fix: PR queries will honor the upstream/origin preference while keeping
sources.prsas origin so the selector still works. - Assistant
I left a duplicate
finallyblock and need to remove it. - Assistant
Removing the duplicate finally block.
- Assistant
There's a leftover duplicate
buildSearchQueryStringline to remove. - Assistant
Still cleaning up the remaining duplicate lines.
- Assistant
Removing the leftover duplicate
): string {line. - Assistant
listWorkItems looks correct. Updating countWorkItems next.
- Assistant
I'll update countWorkItems similarly.
- Assistant
Checking how PR queries set
--reposo I can write a temporary verification script. - Assistant
I'll run the existing related tests next to make sure nothing broke.
- Assistant
Let me run the issue-source and work-items tests.
- Assistant
The test timed out — checking how tests are run and retrying with
pnpm test. - Assistant
Seems like tests hang. Let me check ensure-native-runtime or try running vitest differently with a longer approach - maybe without the pipe?
- Assistant
Tests seem to hang entirely. Let me check the vitest config and try running more verbosely.
- Assistant
The native runtime check is hanging, so I'll run vitest directly.
- Assistant
Issue source tests passed. Next I'll run the work-items tests and add a temporary checkдержать for the PR upstream preference cases.
- Assistant
I'll create a temporary script to verify the PR upstream preference regression cases.
- Assistant
I'll add a temporary test from the existing patterns, run it, then delete it.
- Assistant
Checking how existing PR-only query tests assert creator/owner arguments.
- Assistant
Creating a temporary verification test for the upstream PR preference cases.
- Assistant
The test needs to live under
src/temporarily. - Assistant
The file seems empty or wasn't written correctly —I'll inspect it.
- Assistant
The create command didn't write the file.absolute correctly — I'll write it with a shell heredoc instead.
- Assistant
All three temporary tests passed. I'll remove the temp file and check the final diff.
- Assistant
The fix is clean. Running related tests one last time, then submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →