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
Let me start by exploring the repository structure to understand the codebase.
Assistant
Let me explore the source code structure.
Assistant
Let me look at the relevant files mentioned in the issue.
Assistant
Now let me look at how the renderer uses this:
Assistant
Now let me look at how
resolveIssueSourceworks:Assistant
Now let me look at
getOwnerRepo:Assistant
Now let me check the existing tests:
Assistant
Now let me look at how the source selector and upstream option work in TaskPage:
Assistant
Now let me look at the issue-source preference structure:
Assistant
Now let me look at the source selector component:
Assistant
Let me look at the
listRecentWorkItemsandlistQueriedWorkItemsfunctions:Assistant
Let me check how
IssueSourcePreferenceis typed:Assistant
Let me look at where
sources.prsis used in the renderer:Assistant
Let me look at the countWorkItems tests:
Assistant
Now let me write the fix:
Assistant
<function_calls>
Assistant
Let me look at the existing test for upstream preference:
Assistant
Now let me make the actual fix. Let me first see the area around
listWorkItemsandcountWorkItems:Assistant
Now let me make the fix. First, modify
listWorkItems:Assistant
Now let me make the fix to
listWorkItems. I'll edit the relevant code:Assistant
Let me try the edit command with a different approach:
Assistant
Let me use a different approach with sed:
Assistant
Let me verify the changes:
Assistant
Good. Now let me alsoconfirm there's no double blank line.
Assistant
Let me fix the extra blank line:
Assistant
Oops, my sed command broke the file. Let me restore it:
Assistant
Let me fix the broken stub:
Assistant
Let me also clean up the extra blank line:
Assistant
The replace command didn't work because the escaping was wrong. Let me try a different approach:
Assistant
Now let me verify the entire
listWorkItemsandcountWorkItemsfunctions:Assistant
Now let me run the existing tests to see if any break:
Assistant
All existing tests pass. Now let me run a wider test to make sure no other tests are affected:
Assistant
Let me write a temp script to verify the fix works:
Assistant
Now let me also write a quick test to verify the behavior:
Assistant
Both my temp tests pass. Let me also test more edge cases:
Assistant
Let me fix the test:
Assistant
Let me look at the actual call args. The PR call's first arg is
[ 'api', '--cache', '120s', 'repos/.../pulls?...']. The repo slug is in the URL. Let me check whatprCall[0]looks like:Assistant
I see the issue - the call structure has the args as a nested array. Let me fix the test:
Assistant
All 5 tests pass. The fix works correctly:
- ✅
preference=upstreamroutes PR queries to upstream - ✅
countWorkItemsalso uses upstream - ✅ Fallback to origin when upstream is missing
- ✅
preference=autopreserves existing behavior (PRs from origin) - ✅
preference=originuses origin for PRs - ✅
sources.prsalways remains as the actual fork for selector UI
Now let me remove the temp test files:
- ✅
Assistant
Let me also run the existing tests again to make sure nothing is broken:
Assistant
All 191 tests still pass. Let me also run a broader test to check the rest of the repo:
Assistant
Let me check if any failures are related to my change:
Assistant
Let me check if these failures pre-exist by checking out the original file:
Assistant
The same test failures pre-exist. These are unrelated to my changes. Let me restore my changes:
Assistant
All GitHub tests pass. Let me look at the final diff:
Assistant
Let me also see the final state of the modified functions:
Assistant
Let me also check for lint and typecheck issues:
Assistant
No type errors. Let me also run the other typechecks.
Assistant
All typechecks pass. Let me also check if there are any oxlint switch-exhaustiveness issues:
Assistant
All clean. Let me also check the existing tests to ensure they still pass after my fix:
Assistant
All 29 tests pass. Let me also check that there are no other places that might be affected. Let me check the full set of usages of the prOwnerRepo:
Assistant
All tests pass. Let me now verify the fix once more and check for any issues:
Assistant
Let me also run the test for the issue source one more time to confirm:
Assistant
All 191 tests pass. Let me also run the full ipc tests:
Assistant
Let me check if these failures are related to my change by stashing and running them:
Assistant
Let me check if my changes affect the WorktreeCard test:
Assistant
Let me run the failing tests individually to confirm:
Assistant
All tests pass when run individually. The failures I saw earlier were due to test parallelism/interaction, not my changes. Let me also confirm the GitHub tests pass:
Assistant
All 206 tests pass. Now let me also do a final check on the diff:
Assistant
Only
src/main/github/client.tswas modified. Let me look at the final diff:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.