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
Now let's add the
resolvePrSourcehelper function nearresolveIssueSourceusage, and updatelistWorkItemsandcountWorkItems.Assistant
Now let's insert the helper function right before
listWorkItems, and update the two Promise.all calls.Assistant
I'll use
open/editcommands instead.Assistant
Now let's update
countWorkItems.Assistant
Now let's check that
OwnerRepoandgetOwnerRepoForRemoteare imported properly (already used elsewhere so should be fine). Let's run typecheck/build and existing tests.Assistant
Good, already imported. Now let's check the TaskPage.tsx piece mentioned in the issue to see if anything else needs updating there (likely nothing since backend fix handles it, but let's check).
Assistant
Good, preference is already threaded through from
repo.issueSourcePreference. That's the same preference used for both issues and PRs (single per-repo selector), consistent withTaskPage.tsxusing one selector for both origin/upstream. Now let's run the relevant test suites.Assistant
All existing tests pass. Now let's write a quick temp test script simulating the suggested regression coverage to confirm the fix works.
Assistant
Fix import paths since file placed in same directory as client.ts.
Assistant
The fix works exactly as expected:
--repo upstream-owner/orcaforlistWorkItemsandrepo:upstream-owner/orcain the search query forcountWorkItems. Now let's remove the scratch test file and run full test suite for the github module to make sure nothing else broke.Assistant
All 191 tests in the github module pass (those console errors are expected test output for error-path assertions). Let's also run the broader test suite to be safe, and check TypeScript compiles.
Assistant
No TypeScript errors. Let's also run the full test suite quickly to double check nothing else broken (might take a while, but let's try).
Assistant
Confirmed this test fails on the base commit too (pre-existing environment issue, unrelated to our change). Let's restore our changes.
Assistant
Good, the pre-existing failures (timeouts, permission mode, etc.) are unrelated environment issues, not caused by my change. Let's view the final diff to confirm correctness.
Assistant
This is a minimal, targeted fix. Let's run lint to be safe.
Assistant
Lint passes cleanly. Now let's run the full github test module once more plus the client-issue-source/work-items suites to be thorough, and view the final diff once more.
Assistant
All 191 tests pass. Now let me go through the checklist.
Checklist review
- If an error was reported in the issue description, I have successfully reproduced it.
Reproduced via a temporary test script mocking
resolveIssueSource/getOwnerRepoForRemote/ghExecFileAsync, confirming that before the fix,listWorkItems/countWorkItemswithpreference: 'upstream'still issued PR queries againstorigin(viagetOwnerRepo), not the upstream repo.
- If an error was reported in the issue description, I have successfully reproduced it.
Reproduced via a temporary test script mocking
Assistant
Confirmed the bug reproduces on the original code (the PR query used
fork/orca(origin) instead ofupstream-owner/orca). Now restore the fix and verify it no longer reproduces.Assistant
Good, the fix is back in place. Let's do a final verification run of the affected test suites.
Assistant
All 191 tests pass, only
src/main/github/client.tsis modified. The fix is confirmed working and minimal. Let's do a final review of the complete diff before submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.