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 trace the GitHub client’s work-item list/count paths and the source-selector data flow, then update the repository resolution so PR queries honor the selected origin/upstream preference. I’ll inspect related tests and run the focused test suite (without modifying tests), plus a temporary or existing reproduction where useful.
- Assistant
The relevant code is concentrated around lines 1188 onward. I’m now reading the resolver contracts and call signatures, because the fix must preserve issue-source behavior while making the PR owner/repo selected-source aware, including SSH/connection handling and count pagination.
- Assistant
The defect is confirmed: both
listWorkItemsandcountWorkItemsindependently callgetOwnerRepo(origin), whileresolveIssueSourcealready resolves the preference. I’ll retain origin as the default/auto PR source for compatibility, switch PR resolution to upstream when explicitly selected, and fall back to origin if the selected upstream remote is unavailable—matching the existing issue-source fallback semantics. - Assistant
The first edit attempt was blocked because this environment has no
pythonexecutable; no files were changed. I’ll apply the same targeted replacement with Node, then inspect the diff and run focused tests. - Assistant
The implementation now selects
upstreamCandidateonly forpreference === 'upstream', with origin fallback, and uses that same selected PR repo in both list and count paths. This avoids changing automatic behavior and keeps the returnedsources.prsaccurate. I’ll run the GitHub work-item tests and typecheck the affected configuration. - Assistant
The combined verification command did not reach the tests: Corepack attempted to download pnpm and stopped at an interactive confirmation, so this is an environment/tooling issue rather than a test failure. I’ll use the repository’s installed binaries directly (and separately check formatting/type safety) to avoid the prompt.
- Assistant
The installed tools are available. Vitest rejected an outdated pool option, and oxfmt identified only formatting issues in the edited file; the node typecheck produced no diagnostics. I’ll format the file and rerun Vitest with supported options, then inspect the final diff.
- Assistant
Verification passed: both focused GitHub test files pass (29 tests), formatting is clean, and the node TypeScript typecheck passes. The final diff is limited to
client.ts; no tests were modified. The fallback behavior also covers missing upstream remotes and preserves origin/auto behavior. I’ll submit this completed change now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.