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's apply the edits.
Assistant
Now let's fix countWorkItems similarly.
Assistant
Good, this uses
--repo <ownerRepo.owner>/<ownerRepo.repo>viabuildWorkItemListArgs, so with prOwnerRepo now set to upstream when preference is 'upstream', thepr list --repo upstream-owner/repo --search ...will be issued correctly. Now let's write a reproduction script/test to verify.Assistant
Both pass. Now remove the temp test file and run the full existing test suite for the client files.
Assistant
All existing tests still pass. Now let's run the full test suite in this directory (github tests) plus check TaskPage.tsx-related tests for any regressions, and run broader test suite to be safe.
Assistant
All 191 tests pass (stderr logs are expected warnings from existing tests, not failures). Now let's check TaskPage.tsx side for any needed adjustments per the issue's code evidence mention — check if renderer needs to pass sources correctly, though the selector already uses
s.sources.prs/s.sources.upstreamCandidate, and nowsources.prswill correctly reflect upstream when selected. Let's verify no other place assumes prs always equals origin.Assistant
I need to fix the missing blank line before
function buildSearchQueryString.Assistant
Now let's fix
countWorkItemssimilarly, exposing origin repo unaffected for any callers but using a query-specific variable internally. Let's check current state.Assistant
All 191 tests still pass. Now let's re-run my repro test to confirm the fix still works with the updated approach (sources.prs unchanged, but query uses upstream).
Assistant
Now let's add an assertion to that repro test verifying
sources.prsstill equals origin (i.e., render-gate unaffected), to be thorough, and also verifylistWorkItemsreturns items correctly.Assistant
Both the actual query correctness fix and the render-gate stability are confirmed. Let's clean up temp test files and run the full test suite (or at least the renderer TaskPage tests, if any) plus type-check.
Assistant
Typecheck passes cleanly. Let's run the full test suite quickly to make sure nothing else broke.
Assistant
Confirmed — these failures are pre-existing (timeouts due to environment resource limits when running the whole suite concurrently), unrelated to my change. Let's restore my changes.
Assistant
Good, changes restored. Now let's re-run the relevant github test files plus TaskPage-adjacent renderer tests specifically (not the whole suite, to avoid environment timeouts).
Assistant
All 191 tests pass with the fix in place. Let's view the final diff to confirm correctness.
Assistant
This diff is clean and targeted. Let's also double check
countWorkItemscode path for the "no explicit preference" default case still matches old behavior (issue upstream, PR origin) by re-running the specific test that verifies that combo.Assistant
Good, the default
auto-mode split-source behavior is preserved. Now let's finalize by reviewing the checklist.Assistant
Checklist review
-
If an error was reported in the issue description, I have successfully reproduced it. Yes. I wrote a temporary reproduction test that mocked
resolveIssueSource(returning an upstream owner/repo) andgetOwnerRepo(returning a different origin/fork owner/repo), then calledlistWorkItems(..., 'is:pr is:open author:@me', undefined, 'upstream'). Before my fix, theghPR query used--repo fork/orca(origin) instead of the selected upstream, confirming the exact bug described (PR queries ignore the upstream selection). -
If an error was reported in the issue description, I have confirmed that my fix resolves the error. Yes. After the fix, the same reproduction test confirms
ghExecFileAsyncis called with--repo stablyai/orca(upstream) forlistWorkItems, and a similar test confirmedcountWorkItemsbuilds its search query withrepo:stablyai/orcawhenpreference === 'upstream'. Both match the "Suggested regression coverage" scenarios from the issue. -
I have thought about edge cases and made sure my fix handles them as well. Yes, specifically:
- Preserved the existing
'auto'/undefined-preference behavior (issues from upstream, PRs from origin) — verified via existing test"uses upstream for issue-only queries and origin for PR-only queries"and"counts default work items across upstream issues and origin PRs", both still pass unchanged. - Preserved
preference === 'upstream''s fallback-to-origin behavior when noupstreamremote exists (sinceprQueryOwnerReporeusesissueOwnerRepo, which already encodes that fallback viaresolveIssueSource). - Critically, discovered and avoided a regression: naively overwriting the
sources.prsfield returned bylistWorkItemswith the preference-aware repo would have broken the renderer'shasUpstreamCandidateDivergencerender-gate inTaskPage.tsx(used in two places to decide whether to show the Origin/Upstream selector at all) — oncesources.prsequalledupstreamCandidateafter picking "Upstream," the selector would silently disappear, trapping the user. I fixed this by introducing a separateprQueryOwnerRepoused only for the actualghquery building, whilesources.prskeeps reporting the raw origin repo as before. Added a dedicated test confirming this invariant holds.
- Preserved the existing
-
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. Yes. Ran the full
src/main/githubtest directory (17 files, 191 tests) — all pass. Also rantsgo --noEmittypecheck on the node config, which passed cleanly. I also ran the full repository test suite once and found ~80 unrelated failures (timeouts in renderer components likeTabBar,WorktreeCard,pty-connection), but confirmed viagit stash/git stash popthat these failures pre-exist on the base commit and are caused by environment resource contention when running the entire suite concurrently, not by my change.
I cleaned up all temporary reproduction test files before finishing (
__repro.test.ts,__repro2.test.ts), leaving only the intended fix insrc/main/github/client.ts.-
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 →
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 →