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
resolvePrSourceright afterresolveIssueSource.Assistant
Now let's update client.ts to use
resolvePrSourceinlistWorkItemsandcountWorkItems.Assistant
Now update
listWorkItems:Assistant
I need to use
openfirst, thenreplacein the special command syntax with heredoc.Assistant
Now let's update the fellBack flag to include prResolved.fellBack as well:
Assistant
Good, cached. Now let's update
countWorkItems.Assistant
Good,
getOwnerRepostill used elsewhere so no unused import. Now let's check the TypeScript compiles fine.Assistant
Now let's add a local function definition of
resolvePrSourcein client.ts, right beforelistWorkItems.Assistant
Now insert a local
resolvePrSourcefunction before line 1188:Assistant
Add a blank line between the new function and
export async function listWorkItems:Assistant
Need to import
ResolvedIssueSourcetype in client.ts.Assistant
Now let's revert the gh-utils.ts change since it's not needed anymore (avoid dead/duplicate code), or keep it since it's harmless but unused. Let's remove it to keep things clean.
Assistant
Good, gh-utils.ts is now back to original content (393 lines). Let's confirm with git diff.
Assistant
gh-utils.ts is unchanged now. Let's view the full diff of client.ts.
Assistant
Now let's re-run the tests.
Assistant
There's an extra closing brace at line 1226. Let's fix it.
Assistant
Now let's also update
countWorkItemssimilarly (already using resolvePrSource — fine since it's now consistent). Let's re-run tests.Assistant
Now let's rerun the full test suites again.
Assistant
All tests pass now. Let's run the full github test directory to catch anything else affected.
Assistant
All existing GitHub tests pass. Now let's write a temporary reproduction script to verify the fix behavior for the exact scenario in the issue.
Assistant
Excellent — the fix works as expected.
--repo upstream-owner/orcais used for the PR list query andrepo:upstream-owner/orcafor the count query, matching the issue's suggested regression coverage. Let's remove the temporary test file.Assistant
Now let's also check
TaskPage.tsxmentioned in the issue to see if any renderer changes are needed.Assistant
Now let's rerun tests to check
sourcesobject comparisons liketoEqual/toMatchObjectdon't break due to the extraoriginkey.Assistant
The issue explicitly states "No new interfaces are introduced" — let's revert the
originfield addition since it both breaks existing tests and goes outside the intended scope.Assistant
Now remove the
origin: origin ?? null,line too.Assistant
Now revert the shared/types.ts change too.
Assistant
Good, back to original. Let's confirm git diff for shared/types.ts is now empty.
Assistant
Only client.ts changed now. Let's re-run the full test suite for the github folder plus broader tests to make sure everything passes.
Assistant
This is now a clean, minimal, correctly scoped fix. Let's run the full test suite once more to confirm.
Assistant
All 191 tests in the github test suite pass. Let's also run the broader test suite for renderer components related to TaskPage/IssueSourceSelector to double check nothing else references this behavior.
Assistant
All pass. Let's run the full test suite to be thorough (with a reasonable timeout, excluding the very long ones if needed).
Assistant
Confirmed — this failure is a pre-existing environment issue (missing native
node-ptymodule), unrelated to my change. Let's run the other relevant test files.Assistant
Same pre-existing environment failure, unrelated to my change. Let's do a final review of the diff and finalize.
Assistant
This is a clean, minimal, and correctly scoped diff. Let's do a final sanity check by running the full github test suite once more.
Assistant
All good. Let's also double check
oxlintdoesn't complain about unusedtype ResolvedIssueSourceimport or anything.Assistant
Lint passes clean. Now let's review the checklist items.
Assistant
Clean — only the intended fix remains. Let me summarize the checklist review:
Checklist review:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.