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
I’ll inspect the GitHub client and its tests first, then reproduce the owner/repo resolution mismatch with the narrowest relevant test or script before changing the implementation.
- Assistant
The initial search did not include the repository’s actual test naming/layout, so I’ll locate the function definitions, preference resolver semantics, and all GitHub client test files directly.
- Assistant
rgis unavailable in this environment, but the focused test suite exists. I’ll usegrepto inspect the relevant implementation and tests, including how upstream fallback is intended to behave. - Assistant
The existing tests explicitly codify the old split (“upstream issues, origin PRs”), while the new requirement says an explicit source preference must route PRs too. I’ll inspect the exact orchestration and current three-state preference tests to preserve
autobehavior and fallback metadata while changing only explicit selection semantics. - Assistant
resolveIssueSourcealready provides exactly the desired preference-aware effective repository, including upstream→origin fallback. The minimal coherent fix is to use that resolved source for PRs when a preference is explicitlyupstreamororigin, while retaining origin PRs inauto/undefined mode. I’ll verify call ordering and count logic before editing. - Assistant
The bug is reproduced at the code-path level: for
preference='upstream',issueResolved.sourcecan bestablyai/orca, but both list and count independently assignprOwnerRepofromgetOwnerRepo(fork/orca). I’ll now make explicitorigin/upstreampreferences control both work-item kinds;autoand omitted preference will keep the existing upstream-issues/origin-PR heuristic. Avoiding the origin lookup for explicit preferences also prevents needless remote probing. - Assistant
Python is not installed, so no file was changed. I’ll apply the same two targeted replacements using the repository’s Node runtime.
- Assistant
The implementation now aligns list and count routing. I’ll run the two relevant GitHub work-item suites; this should validate legacy auto behavior, explicit preference/fallback behavior, query construction, recent REST calls, and count aggregation.
- Assistant
The test command did not run because Corepack attempted an interactive pnpm download, which this environment disallows. Since dependencies are already present, I’ll invoke the installed Vitest binary directly.
- Assistant
Both focused suites pass (29 tests), confirming the legacy/default behavior remains intact. I’ll now run the node typecheck and lint the changed file directly, then inspect the final diff for unintended changes.
- Assistant
The targeted tests, typecheck, lint, and whitespace checks all pass. Before submitting, I’ll run the formatter in check mode to ensure the changed ternary/layout matches repository formatting without rewriting unrelated files.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.