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 and nearby tests first, then reproduce the owner/repo mismatch through the existing test harness before making a focused change.
- Assistant
The initial evidence confirms
getOwnerRepois imported alongside source-aware issue resolution. I’ll locate the exact work-item functions and all tests that mock GitHub CLI calls, so the fix follows existing conventions and can be validated narrowly. - Assistant
There is dedicated issue-source regression coverage, including upstream selection, but likely only for issue routing. I’ll read the resolution flow and those tests to determine whether the selected source should directly become the PR repository or whether fallback semantics require special handling.
- Assistant
The current tests explicitly encode the old split behavior (“upstream issues and origin PRs”), explaining why the bug escaped. The requested behavior is source-selector-wide for the Tasks PR surface, so both list and count should use the effective repository returned by
resolveIssueSource, including its upstream-to-origin fallback. I’ll inspect function signatures and source metadata to make the smallest consistent replacement. - Assistant
A key UI invariant is that
sources.prsrepresents the origin used to render the selector; replacing that metadata with upstream would hide or mislabel the control. Therefore I’ll keep origin discovery and response metadata unchanged, but derive an effective PR query repository: use the preference-resolved source only when preference is explicitlyupstream, otherwise preserve existingauto/origin behavior. This also naturally handles “upstream missing” fallback. - Assistant
I’ll now patch only the routing variables in
listWorkItemsandcountWorkItems. Origin remains fetched for selector metadata and for non-upstream modes; explicit upstream routes PR calls throughissueResolved.source, which already encapsulates connection-aware resolution and fallback. - Assistant
python3is unavailable in this environment, so no file was changed. I’ll apply the same exact textual transformation with the repository’s Node runtime, then inspect the diff. - Assistant
The patch preserves existing defaults while changing explicit upstream routing. I’ll run the two directly affected GitHub client suites; this checks legacy mixed-source behavior, preference fallback, query construction, SSH handling, pagination counts, and source metadata.
- Assistant
The test command did not start because Corepack attempted an interactive package-manager download, which this environment cannot answer. I’ll disable Corepack’s download prompt and rerun; dependencies appear present, so this should either execute normally or expose a concrete environment limitation.
- Assistant
Both affected suites pass (29 tests). For the exact regression path, the code path now deterministically passes
issueResolved.sourceasprOwnerRepofor explicit upstream: queried lists feed it tobuildWorkItemListArgs(--repo), and counts feed it tobuildSearchQueryString(repo:). I’ll inspect those builders once more and run node typechecking plus focused lint to catch structural issues. - Assistant
Focused lint and the full node typecheck both pass. The builder inspection confirms exact behavior: explicit upstream PR lists receive
--repo upstream-owner/repo, while PR counts generaterepo:upstream-owner/repo; default and origin modes remain unchanged. I’ll run formatting verification and a broader set of GitHub client tests, then review the final diff/status.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.