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 implementation, related source-resolution helpers, and existing tests to reproduce the routing mismatch before making a focused change.
- Assistant
The search confirms the mismatch is localized:
listWorkItemsandcountWorkItemsresolve issues with the preference but PRs via origin-onlygetOwnerRepo. I’ll now examine those functions and the preference resolver’s semantics so PR routing stays consistent forauto,origin, upstream fallback, SSH, and partial failures. - Assistant
Existing tests encode the old split behavior (“upstream issues and origin PRs”), so the implementation change will intentionally alter those expectations in hidden/new coverage. Since tests may mock
resolveIssueSource, the cleanest fix is likely to use its resolved source for both work-item kinds while retaining origin and upstream-candidate resolution for envelope metadata. I’ll verify exact call ordering and helper behavior before editing. - Assistant
The selected source should govern both issues and PRs on the Tasks surface; therefore
prOwnerReposhould be the preference-resolved source, not a separately resolved origin. This also simplifies counts to one repository query when both kinds are selected. I’ll confirm the resolver contract, then patch only the two callers and source metadata. - Assistant
A key metadata nuance emerged: the renderer explicitly treats
sources.prsas the origin slug (origin={s.sources.prs}). Changing that field to upstream would break the selector and violate the “no new interfaces” constraint. I’ll preservesources.prsas origin metadata while introducing an internal effective PR target equal to the preference-resolved source for list/count execution. - Assistant
I’ll implement the split explicitly:
originOwnerReporemains metadata, whileselectedOwnerRepois passed as both issue and PR query target. For counts, only the selected source is needed, but retaining origin lookup is unnecessary and could fail independently; I’ll remove it there and use the resolved selected source directly. This handles upstream absence through the resolver’s existing fallback. - Assistant
Python is unavailable in this environment, so no file changed. I’ll apply the same exact substitutions using the repository’s Node runtime and then inspect the diff.
- Assistant
The patch now routes queried/recent PRs and counts through the selected source while preserving selector metadata. I’ll run the two focused GitHub work-item suites to identify genuine regressions versus assertions that intentionally codify the old origin-PR behavior.
- Assistant
Corepack attempted an interactive package-manager download, which this environment cannot answer. I’ll disable the prompt and rerun the focused tests separately; dependencies appear likely not yet bootstrapped, so this will also reveal whether network/package setup is available.
- Assistant
The failures reveal an important compatibility boundary: existing
autosemantics deliberately split upstream issues from origin PRs. The reported bug is specifically the explicitupstreamselection. I’ll narrow the fix accordingly: only explicitupstreamroutes PRs to the resolved upstream (or its origin fallback);autoandoriginretain origin PR behavior. This avoids unrelated default behavior changes while satisfying both requested regressions. - Assistant
The focused suites now pass, confirming default, origin, SSH, recent, queried, and count behavior remains intact. The explicit-upstream path uses
issueResolved.sourcefor PR list/count, including fallback when upstream disappears. I’ll run node typechecking and lint the changed file, then inspect the final diff for accidental changes. - Assistant
The change passes typechecking, lint, and diff validation. As a broader regression check, I’ll run all main GitHub client test files (without modifying tests), especially because these functions share mocks and rate-limit/acquire behavior with adjacent client features.
- Assistant
Vitest treated the quoted shell glob literally and found no tests; this is a command-selection issue, not a test failure. I’ll rerun with shell expansion so each matching client test file is passed explicitly.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.