Skip to content
TheChatArchiveThe Chat Archive
x-ai/grok-4.5· unknownHugging 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. Assistant

    I'll start by exploring the repository structure and the files mentioned in the issue to understand how PR queries resolve owner/repo.

  3. Assistant

    I'll inspect client.ts for how prOwnerRepo and issue/PR source preferences are resolved.

  4. Assistant

    rg is not available, let me use grep instead.

  5. Assistant

    Let me read the listWorkItems and countWorkItems functions more carefully, and also look at how issue source preference is resolved.

  6. Assistant

    I need to inspect resolved issue source handling, including resolveIssueSource and preference-based owner/repo selection.

  7. Assistant

    Need to grep recursively properly.

  8. Assistant

    Let me look at resolveIssueSource in gh-utils.ts

  9. Assistant

    So resolveIssueSource already handles preference for issues. For PRs, we need similar resolution. Looking at the issue description:

  10. Assistant

    I'll check existing tests and TaskPage next to see how origin vs upstream preferences are applied to PRs.

  11. Assistant

    Looking next at how the PRs tab uses the source selector and related comments.

  12. Assistant

    So the IssueSourceSelector is used for both. When preference is 'upstream', both issues and PRs should probably go to upstream based on the issue description.

  13. Assistant

    I'll inspect countWorkItems and the full resolveIssueSource logic more closely.

  14. Assistant

    Let me also check if resolveIssueSource is re-exported and whether there's a resolvePRSource or comments about sources.prs meaning origin always.

  15. Assistant

    Let me look at the types and comment about sources.prs more carefully.

  16. Assistant

    Important detail: the selector treats sources.prs as origin. I'll check preference tests and selector behavior when that becomes upstream.

  17. Assistant

    I'll check IssueSourceSelector and how sources.prs is treated as the origin value.

  18. Assistant

    I'll search for other uses of sources.prs to understand the contract.

  19. Assistant

    Confirming: I'll keep sources.prs as origin for the selector and make PR queries honor preference.

  20. Assistant

    Checking how PR queries are built for the search path:

  21. Assistant

    I'll check the imports and any existing resolvePRSource-style helper.

  22. Assistant

    Implementing the fix: PR queries will honor the upstream/origin preference while keeping sources.prs as origin so the selector still works.

  23. Assistant

    I left a duplicate finally block and need to remove it.

  24. Assistant

    Removing the duplicate finally block.

  25. Assistant

    There's a leftover duplicate buildSearchQueryString line to remove.

  26. Assistant

    Still cleaning up the remaining duplicate lines.

  27. Assistant

    Removing the leftover duplicate ): string { line.

  28. Assistant

    listWorkItems looks correct. Updating countWorkItems next.

  29. Assistant

    I'll update countWorkItems similarly.

  30. Assistant

    Checking how PR queries set --repo so I can write a temporary verification script.

  31. Assistant

    I'll run the existing related tests next to make sure nothing broke.

  32. Assistant

    Let me run the issue-source and work-items tests.

  33. Assistant

    The test timed out — checking how tests are run and retrying with pnpm test.

  34. Assistant

    Seems like tests hang. Let me check ensure-native-runtime or try running vitest differently with a longer approach - maybe without the pipe?

  35. Assistant

    Tests seem to hang entirely. Let me check the vitest config and try running more verbosely.

  36. Assistant

    The native runtime check is hanging, so I'll run vitest directly.

  37. Assistant

    Issue source tests passed. Next I'll run the work-items tests and add a temporary checkдержать for the PR upstream preference cases.

  38. Assistant

    I'll create a temporary script to verify the PR upstream preference regression cases.

  39. Assistant

    I'll add a temporary test from the existing patterns, run it, then delete it.

  40. Assistant

    Checking how existing PR-only query tests assert creator/owner arguments.

  41. Assistant

    Creating a temporary verification test for the upstream PR preference cases.

  42. Assistant

    The test needs to live under src/ temporarily.

  43. Assistant

    The file seems empty or wasn't written correctly —I'll inspect it.

  44. Assistant

    The create command didn't write the file.absolute correctly — I'll write it with a shell heredoc instead.

  45. Assistant

    All three temporary tests passed. I'll remove the temp file and check the final diff.

  46. Assistant

    The fix is clean. Running related tests one last time, then submitting.

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