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
Now let me implement the fix in
client.ts.Assistant
Now edit
listWorkItems:Assistant
I'll use the
replacecommand instead.Assistant
Now update
sources.prsto report origin and add the helper function.Assistant
Now insert the
resolvePrSourcehelper beforelistWorkItems(line 1188).Assistant
Now update
countWorkItems.Assistant
Reproduced pre-fix failures and confirmed the fix. Now run the broader GitHub/tasks test suites and typecheck.
Assistant
Checklist review:
- Reproduced the reported error: Yes. I wrote a temporary vitest file (
src/main/github/tmp-pr-upstream.test.ts, since deleted) mockingresolveIssueSource/getOwnerRepo/getOwnerRepoForRemote. With the originalclient.ts(verified viagit stash),listWorkItems('/repo-root', 10, 'is:pr is:open author:@me', undefined, 'upstream')issued--repo fork/orcaandcountWorkItems(..., 'upstream')searchedrepo:fork/orca— 3 tests failed, confirming PR queries hit origin instead of upstream. - Confirmed the fix resolves the error: Yes. After the change, all 5 temporary tests pass: PR list uses
--repo stablyai/orca, PR count buildsrepo:stablyai/orca is:pull-request is:open author:@me, origin fallback still works, andauto/originpreferences keep using origin. Temp test file was removed before submitting. - Edge cases considered: (a)
preference='upstream'but the upstream remote is gone →issueSourceFellBackshort-circuits back to origin, matchingresolveIssueSource's fallback and the existing fellBack toast; (b) issue side unresolvable → the rawupstreamCandidateis a backstop, then origin; (c)sources.prsstill reports the origin slug because the renderer uses it as the "origin" side of the upstream/origin selector — reporting upstream there would make the selector collapse and strand the user on upstream; (d)countWorkItemsonly performs the extraupstreamremote lookup when the preference is explicitlyupstream, so the common path costs nothing, and itssameOwnerReposhort-circuit now correctly issues a single upstream-scoped search; (e) null origin/upstream cases return null as before; (f) GitLab has no upstream/origin source selector, so no parallel change was needed. - Ran existing tests that could be affected: Yes.
src/main/githubsuite (17 files / 191 tests) passes, includingclient-issue-source.test.ts(preference matrix) andclient-work-items.test.ts; rendererTaskPage*andsrc/main/ipc/repos*suites pass; typecheck (tsgo -p config/tsconfig.node.json),oxlint, andoxfmt --checkare clean. The full suite has pre-existing environment-related flaky failures (native modules/timeouts) — baseline before my change had more failures (80 files/23 tests) than after (72 files/12 tests), and none are in GitHub/tasks code.
- Reproduced the reported error: Yes. I wrote a temporary vitest file (
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 →