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 first inspect the repository structure and the GitHub client implementation/tests, then reproduce the owner/repo resolution path before making the smallest targeted fix.
- Assistant
The relevant focused test suite already exists (
client-work-items.test.ts). I’ll locatelistWorkItems/countWorkItems, their resolver helpers, and current source-preference tests to establish exactly where PR routing diverges from issue routing. - Assistant
The divergence is confirmed structurally: work-item functions resolve the preference-aware issue source but independently call origin-oriented
getOwnerRepofor PRs. I’ll inspect the complete implementations and preference-related test expectations, including fallback semantics, so the fix preserves existing behavior forauto, missing remotes, SSH contexts, and mixed queries. - Assistant
The resolver’s fallback behavior is suitable for both surfaces: explicit upstream falls back to origin, explicit origin stays origin, and auto retains upstream-first behavior. Since the selector represents a shared work source and the requested behavior says PR list/count should use the selected repository, the clean fix is to use
issueResolved.sourceas the PR repository too, eliminating the contradictory second resolution. Before editing, I’ll inspect all source-contract tests to ensuresources.prsand mixed issue/PR counting are intended to align under preferences. - Assistant
Existing tests reveal an important compatibility constraint:
autointentionally means upstream issues plus origin PRs. Therefore, PRs should share the preference-aware source only when the user explicitly selectsoriginorupstream; changing all modes to one source would regress the established auto heuristic. I’ll inspect the explicit preference matrix and then implement a small PR-source resolver that preserves auto while honoring explicit selection for both list and count. - Assistant
I’ll make the explicit-source path avoid resolving origin altogether (not merely ignore it), while retaining the origin lookup for
auto/undefined. I’ll also verify the selector’s props becausesources.prschanging to upstream could affect how the control labels its choices. - Assistant
TaskPageconfirmssources.prsdoubles as immutable origin metadata for the selector, so replacing that field with the effective upstream would make the selector disappear. I’ll preservesources.prsas origin metadata and introduce a distinct localprQueryOwnerRepo: explicit preferences use the preference-resolved source; auto/unset retains origin. This routes requests correctly without breaking selector availability or the response interface. - Assistant
Python is unavailable in this environment, so no changes were made. I’ll apply the same exact, assertion-guarded transformation with Node.js and inspect the resulting diff.
- Assistant
The diff now routes both recent and queried PR lists through the effective explicit source, and count’s same-repository fast path/search fan-out uses the same effective source. Response metadata still exposes the actual origin. I’ll run the two focused GitHub work-item/source suites; these also verify auto-mode split, fallback, SSH behavior, count fan-out, and response contracts.
- Assistant
The combined command exceeded the environment’s short command timeout and produced no diagnostic output because the pipe buffered it. I’ll rerun each focused suite directly with the concise default reporter so results stream promptly.
- Assistant
The blocker is environment setup rather than the code: Corepack is trying to prompt interactively to download the pinned pnpm version. I’ll disable the prompt and check whether dependencies and a local Vitest binary are already installed; if so, I can invoke it without Corepack.
- Assistant
Corepack completed the download non-interactively during the version check, and the local Vitest binary exists. I’ll invoke that binary directly for the focused suites.
- Assistant
Both focused suites pass (29 tests), confirming no regression to auto, fallback, SSH, count, and list behavior. I noticed one renderer comment now falsely states the selector does not affect PRs; I’ll correct that documentation and inspect the source-divergence helpers to ensure they are metadata-only and do not alter routing or hide controls.
- Assistant
The divergence helpers are strictly presentation metadata and the selector gate correctly compares immutable origin against upstream, so preserving
sources.prswas necessary. The stale tooltip wording predates this routing change, but changing localized UI copy would broaden the patch and require catalog updates; I’ll keep this fix backend-focused. Next I’ll run node typechecking and targeted lint on the changed source. - Assistant
Typechecking and targeted lint pass. I’ll now review the shared response contract and final diff/status for semantic consistency, then run the broader GitHub client test group if the contract confirms
sources.prsrepresents origin metadata rather than necessarily the effective query target. - Assistant
Only
client.tsis modified and the diff is clean. The preference type documentation still calls this issue-specific, but the public interface is intentionally unchanged per the issue. I’ll inspect the result type’s field comments and run allsrc/main/github/client*.test.tssuites to catch interactions beyond work-item tests. - Assistant
The result contract documents raw upstream separately but does not explicitly define
prs; renderer usage establishes it as origin. The broader test command failed only because Vitest does not expand a quoted glob. I’ll rerun with the matching file paths supplied explicitly. - Assistant
All seven GitHub client suites pass (104 tests); the stderr lines are expected fallback/error-path logging asserted by those tests. I’ll perform a formatter check and a final diff review, paying particular attention to the exact upstream PR list/count paths requested in the report.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.