Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-opus-5· anthropicHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Tasks PR Upstream source still queries origin This was generated by AI…

  1. User

    ISSUE DESCRIPTION

    Tasks PR Upstream source still queries origin

    This was generated by AI during triage.

    Summary

    In the Tasks page, selecting the PRs tab and choosing Upstream in the source selector can show No matching GitHub work even 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, so is:pr is:open author:@me searches the fork/origin repo instead of the selected upstream repo.

    Reproduction

    1. Open a forked repository in Orca where origin points to the fork and upstream points to the canonical repo.
    2. Open Tasks.
    3. Select PRs.
    4. Select Upstream in the source selector.
    5. 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 Upstream is 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.ts resolves issueResolved with the selected preference, but resolves prOwnerRepo separately via getOwnerRepo(repoPath, connectionId), which is the origin repo.
    • listWorkItems passes that prOwnerRepo into both recent and queried PR fetches.
    • countWorkItems uses the same prOwnerRepo for PR count queries, so pagination/count can also be wrong.
    • src/renderer/src/components/TaskPage.tsx renders the selector using origin={s.sources.prs} and upstream={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 repo:<upstream-owner>/<repo>.

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /orca, current file: none) bash-$

  2. Claude Assistant

    Now let me implement the fix in client.ts.

  3. Claude Assistant

    Now edit listWorkItems:

  4. Claude Assistant

    I'll use the replace command instead.

  5. Claude Assistant

    Now update sources.prs to report origin and add the helper function.

  6. Claude Assistant

    Now insert the resolvePrSource helper before listWorkItems (line 1188).

  7. Claude Assistant

    Now update countWorkItems.

  8. Claude Assistant

    Reproduced pre-fix failures and confirmed the fix. Now run the broader GitHub/tasks test suites and typecheck.

  9. Claude Assistant

    Checklist review:

    • Reproduced the reported error: Yes. I wrote a temporary vitest file (src/main/github/tmp-pr-upstream.test.ts, since deleted) mocking resolveIssueSource/getOwnerRepo/getOwnerRepoForRemote. With the original client.ts (verified via git stash), listWorkItems('/repo-root', 10, 'is:pr is:open author:@me', undefined, 'upstream') issued --repo fork/orca and countWorkItems(..., 'upstream') searched repo:fork/orca — 3 tests failed, confirming PR queries hit origin instead of upstream.
    • Confirmed the fix resolves the error: Yes. After the change, all 5 temporary tests pass: PR list uses --repo stablyai/orca, PR count builds repo:stablyai/orca is:pull-request is:open author:@me, origin fallback still works, and auto/origin preferences keep using origin. Temp test file was removed before submitting.
    • Edge cases considered: (a) preference='upstream' but the upstream remote is gone → issueSourceFellBack short-circuits back to origin, matching resolveIssueSource's fallback and the existing fellBack toast; (b) issue side unresolvable → the raw upstreamCandidate is a backstop, then origin; (c) sources.prs still reports the origin slug because the renderer uses it as the "origin" side of the upstream/origin selector — reporting upstream there would make the selector collapse and strand the user on upstream; (d) countWorkItems only performs the extra upstream remote lookup when the preference is explicitly upstream, so the common path costs nothing, and its sameOwnerRepo short-circuit now correctly issues a single upstream-scoped search; (e) null origin/upstream cases return null as before; (f) GitLab has no upstream/origin source selector, so no parallel change was needed.
    • Ran existing tests that could be affected: Yes. src/main/github suite (17 files / 191 tests) passes, including client-issue-source.test.ts (preference matrix) and client-work-items.test.ts; renderer TaskPage* and src/main/ipc/repos* suites pass; typecheck (tsgo -p config/tsconfig.node.json), oxlint, and oxfmt --check are clean. The full suite has pre-existing environment-related flaky failures (native modules/timeouts) — baseline before my change had more failures (80 files/23 tests) than after (72 files/12 tests), and none are in GitHub/tasks code.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.