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's look at
listWorkItemsandcountWorkItemsfunctions in detail.Assistant
Now let's fix line 1204 (in listWorkItems) and line 1357 (in countWorkItems).
Assistant
Let's use node instead.
Assistant
Let's view the result.
Assistant
Now let's check TypeScript compiles and run relevant tests.
Assistant
Existing tests pass. Now let's write a temporary reproduction/test script to verify the new behavior works as expected before removing it.
Assistant
Both confirm the fix works: the PR list query now uses
--repo stablyai/orca(upstream) and the count query search string containsrepo:stablyai/orca(URL-encoded). Now let's run the full github test suite and typecheck to be safe.Assistant
All 191 tests pass. Now let's check typecheck quickly for this file only, and check TaskPage.tsx if any changes needed there too (issue mentions it as evidence, but the fix belongs to backend since selector already exists correctly).
Assistant
No errors in client.ts. Let's also run full test suite briefly for broader confidence (just main folder to save time) and check git diff.
Assistant
The diff looks clean and minimal. Now let's double check
sameOwnerRepo(issueOwnerRepo, prOwnerRepo)logic in countWorkItems still works correctly when preference is 'upstream' (both would resolve to same upstream repo typically, since issueOwnerRepo also resolves to upstream in that case) - this should be fine, even improves correctness (single query instead of split).Assistant
Good. Now let's run full test suite (whole repo) to catch any broader regressions related to renderer TaskPage tests.
Assistant
These failures are clearly pre-existing environment issues (missing native
pty.nodemodule, resource/timeout constraints unrelated to GitHub client). Let's confirm they exist without my change by stashing.Assistant
Good, github tests pass identically with or without my change - the 191 tests all pass. The broader failures (pty.node missing, timeouts) are pre-existing environment issues unrelated to this fix. Let's verify the failing tests aren't related to github/TaskPage by checking a couple of specific failures aren't touched by our diff.
Assistant
Only one file changed. The broader test failures are environment-related (missing native pty module, timeouts) and reproduce identically on the base commit, confirming they're unrelated to this change.
Assistant
Now let's go through the checklist explicitly.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.