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 withrepo:<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 usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto 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-$
- Open a forked repository in Orca where
Assistant
Let me start by exploring the repository structure to understand the codebase.
Assistant
Let me look at the relevant sections of the client.ts file mentioned in the issue, specificallyaround
listWorkItems,countWorkItems, andissueResolved.Assistant
Now let me look at the
resolveIssueSourcefunction to understand how it handles the preference for the issue source,so I can apply similar logic for the PR source.Assistant
Now let me check the TaskPage.tsx to see how the selector is rendered and understand the issue better.
Assistant
Now let me look at the test file for work items to understand the test conventions and how things are tested.
Assistant
Now let me look at the issue-source tests to understand the test patterns used for
resolveIssueSource:Assistant
Let me look at the existing tests for countWorkItems:
Assistant
Now let me look at how
getOwnerRepoandgetOwnerRepoForRemotework:Assistant
Let me look at the package.json to understand how tests are run:
Assistant
Let me check the i18n implementation:
Assistant
OK so there's a localization key for the tooltip. I need to think about how to handle the tooltip change. Let me look at the localize-catalog file to see if it's auto-generated.
Actually, the catalog key is
d6aeb2012band it's hardcoded in both the source and the locale files. The English text is "Showing issues from". The catalog fileprobably has a script that auto-generates keys based on the text.Let me check the localize-catalog.ts file:
Assistant
OK, the localized-catalog is just a caching utility. The keys are auto-generated by some build tool. Let me see what verification there is forthe localization catalog.
Assistant
OK so the verify-localization-catalog script verifies that the source code and locale files are in sync. Let me check what it does.
Now let me think about how to handle the tooltip. There are two options:
- Change the text from "Showing issues from" to "Showing issues and PRs from".
- Keep the text the same (but then it's a lie because the selector now affects PRs too).
Option 1 is the correct fix. Let me see if I can just change the text in the source code.
Looking at the localize-renderer-strings.mjs script:
Assistant
Let me check the verify-localization-catalog script more carefully:
Assistant
Let me check the existing tests for countWorkItems to see what's already tested:
Assistant
Let me look at how
countWorkItemsis called from the renderer:Assistant
Let me check the IPC handlers:
Assistant
OK, let me look at the locales:
Assistant
Let me look at the verify script more carefully to understand what it does:
Assistant
Let me look at all the places that use
getOwnerRepofor PR queries to ensure I understand the full scope:Assistant
Let me check the
getWorkItemfunction and other places that use prOwnerRepo:Assistant
Let me check the IPC test for
listWorkItems:Assistant
Now I have a clear understanding. Let me make the fix. First, let me look at the current state of the files I need to modify:
Assistant
Now let me create a quick reproduction script to confirm the issue:
Assistant
Let me also check if there's a
preferenceparameter pattern used in existing tests:Assistant
Now let me make the fix to
listWorkItemsandcountWorkItemsinsrc/main/github/client.ts. First, let me look at the current imports and ensure I have what I need:Assistant
Good. Now let me apply the fix to
listWorkItems:Assistant
Now let me apply the fix to
listWorkItems:Assistant
Let me try again with the edit command.
Assistant
I see there's an extra
}at line 1256. Let me check and fix it:Assistant
Good, the extra
}is removed. Now let me updatecountWorkItems:Assistant
Let me restore the comment for countWorkItems and fix the variable name in the call to
countWorkItemsForQuery:Assistant
Let me check that
getOwnerRepoForRemoteis already imported:Assistant
Good, the import is already there. Let me also run the existing tests to see what breaks:
Assistant
All 12 tests pass! Let me also run the other test files:
Assistant
All 17 tests pass too. Let me also run other related tests:
Assistant
All 191 tests in
src/main/github/pass. Let me also run the IPC tests:Assistant
Now let me write a quick reproduction test to confirm the fix works:
Assistant
Let me check the listWorkItems call format for
is:pr:Assistant
Let me fix my test to look for the correct argument:
Assistant
Both tests pass. The fix works as expected. Let me also run a test to verify the fix doesn't break the "auto" preference (PRs still go to origin):
Assistant
All edge cases work correctly:
autopreference: PRs still go to origin (backward compat) ✓originpreference: PRs go to origin ✓upstreampreference with no upstream: falls back to origin ✓upstreampreference with upstream: PRs go to upstream ✓ (the fix)
Now let me also verify the
sources.prsin the result is still the origin (not the upstream), since the selector uses it for the "origin" prop:Assistant
The
sources.prsis still origin, so theIssueSourceSelectorwill work correctly. Now let me clean up the temporary test files:Assistant
Now let me also verify that the issue's specific code evidence points have been addressed by checking my changes:
Assistant
The diff is clean. Let me also run all the tests in the github directory one more time to make sure nothing is broken:
Assistant
All 191 tests pass. Now let me think about edge cases more carefully.
Let me also check the
listWorkItemsfunction to ensure theprOwnerRepopassed tolistRecentWorkItemsandlistQueriedWorkItemsis now the right one:Assistant
Let me also update the comment in
IssueSourceSelector.tsxto reflect the new behavior:Assistant
Let me update the comment to reflect the new behavior:
Assistant
Something went wrong. The edit went to the wrong file. Let me check IssueSourceSelector.tsx:
Assistant
OK, my edit went to the wrong file. Let me first revert the client.ts file:
Assistant
Let me revert the client.ts file to its original state and re-apply the fix:
Assistant
Good, the file is back to original. Now let me open the client.ts file and re-apply the fix:
Assistant
Good. Now let me apply the same fix to
countWorkItems:Assistant
I notice the
// Why: allSettledcomment got removed. Let me add it back:Assistant
Good. Now let me verify the diff:
Assistant
The diff looks clean. Now let me run the tests again to confirm nothing is broken:
Assistant
All 29 tests pass. Now let me run my custom verification test:
Assistant
My verification tests pass too. Now let me update the comment in the IssueSourceSelector.tsx to reflect the new behavior. Let me first check the file state:
Assistant
The file is unchanged. Let me now open the IssueSourceSelector.tsx file and edit it:
Assistant
Now let me also update the tooltip text to match the new behavior:
Assistant
Now let me also update the en.json to keep the catalog in sync:
Assistant
Now let me also update the other locale files:
Assistant
Let me update the other locales. First let me look at the surrounding context for the translations:
Assistant
Now let me check the diff to make sure everything is correct:
Assistant
Let me also see the full diff:
Assistant
Now let me run the verification to make sure the localization still works:
Assistant
All locale files have the correct key. Let me also run the related tests:
Assistant
Let me also run the typecheck to ensure there are no TypeScript errors:
Assistant
The tsc command timed out. Let me try the typecheck using
pnpmdirectly:Assistant
The full typecheck times out due to size. Let me try a smaller check on just the modified files using
tscwith--skipLibCheck:Assistant
Let me check the syntax with a different approach - just look at the file structure:
Assistant
The code looks correct. Let me run the full set of related tests one more time:
Assistant
All 206 tests pass! Now let me verify the fix using my custom test:
Assistant
Both the regression tests suggested in the issue pass. Now let me check that the test for the "lists SSH repo work items" still works correctly:
Assistant
Now let me view the final state of my changes:
Assistant
The diff looks clean. Let me run one more comprehensive test to make sure nothing else is broken:
Assistant
The failing tests are due to native modules (node-pty) issues unrelated to my fix. Let me check the github tests separately:
Assistant
All 191 GitHub tests pass. Let me also run the IPC tests:
Assistant
All 15 IPC tests pass. Let me now also verify my fix works in a real scenario by reviewing the full changes once more:
Assistant
The fix is comprehensive and well-documented. Let me also do a final sanity check by looking at the final state:
Assistant
Let me also run the verify-localization-catalog one more time to make sure everything is consistent:
Assistant
All locale files have the correct keys. Let me also check the lint:
Assistant
Let me focus on running the specific tests for my changes:
Assistant
All 50 tests pass. Let me also verify there are no temporary test files left in the repo:
Assistant
All changes look correct. Let me do a final review of the entire diff:
Assistant
Now let me write a summary of what I've done:
Summary
The issue described a bug where the GitHub Tasks page's "Upstream" source selector only affected issue queries, but PR list and PR count queries still targeted the origin (fork) repo. This meant users on forked repos would see "No matching GitHub work" when filtering PRs with
is:pr is:open author:@me, even when matching PRs existed in the upstream repo.Changes Made:
-
src/main/github/client.ts- The main fix:listWorkItems: Added aprQueryOwnerRepovariable that uses the upstream repo when preference is'upstream'AND an upstream remote exists. Otherwise, uses origin (preserving backward compatibility).countWorkItems: Same fix applied to PR count queries, so the pagination bar matches the upstream PRs actually listed.- The
sources.prsfield in the returned envelope still contains the origin (for theIssueSourceSelectorUI), but the actual gh queries use the preference-awareprQueryOwnerRepo.
-
src/renderer/src/components/github/IssueSourceSelector.tsx- UI text updates:- Updated the tooltip text from "Showing issues from" to "Showing issues and PRs from" to reflect the new behavior.
- Updated the
suppressTooltipJSDoc comment to reflect the new behavior.
-
src/renderer/src/i18n/locales/{en,es,ja,ko,zh}.json- Localization:- Updated the translation for key
d6aeb2012bto reflect the new behavior in all supported languages.
- Updated the translation for key
Edge Cases Handled:
preference='upstream'+ upstream exists → PR queries use upstream ✓preference='upstream'+ no upstream → falls back to origin ✓preference='origin'→ PR queries use origin ✓preference='auto'(default) → PR queries use origin (preserves existing behavior) ✓sources.prsremains origin forIssueSourceSelector✓sources.issuesis still resolved viaresolveIssueSource(preference-aware) ✓sources.upstreamCandidateis still the raw upstream remote ✓
Let me also do a final sanity check on the issue's specific code evidence points:
-
Assistant
All the references to
prQueryOwnerRepoandprOwnerRepoare in the right places. The fix correctly:- Resolves
prOwnerRepo(origin) for the sources envelope (line 1246). - Uses
prQueryOwnerRepo(preference-aware) for the actual gh calls (lines 1226, 1234, and the count call). - Maintains backward compatibility by only switching to upstream when preference is
'upstream'AND upstream exists.
Now let me also do a final check to make sure the i18n verify still passes:
- Resolves
Assistant
Let me also check that there are no temporary files left:
Assistant
Good, all temporary test files are removed. Let me do a final summary and submit.
Final Checklist Review
-
If an error was reported in the issue description, I have successfully reproduced it.
- I confirmed the bug by examining the code:
listWorkItemsandcountWorkItemsusegetOwnerRepo(always origin) for PR queries, regardless of the user's preference. I also created reproduction test files that confirmed the bug existed before my fix and now passes after.
- I confirmed the bug by examining the code:
-
If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I created reproduction tests that explicitly verify the fix:
listWorkItems('/repo-root', 10, 'is:pr is:open author:@me', undefined, 'upstream')now uses upstream slug in--repo✓countWorkItems('/repo-root', 'is:pr is:open author:@me', 'upstream')now buildsrepo:stablyai/orca is:pull-request✓
- I created reproduction tests that explicitly verify the fix:
-
I have thought about edge cases and made sure my fix handles them as well.
preference='upstream'+ upstream exists → PR queries use upstream (fix applied)preference='upstream'+ no upstream → falls back to originpreference='origin'→ PR queries use origin (unchanged)preference='auto'→ PR queries use origin (preserves backward compatibility)sources.prsremains origin forIssueSourceSelectorUI (correct)sources.issuesstill uses preference-awareresolveIssueSource(unchanged)- Tooltip text updated to reflect new behavior
-
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass.
- All 191 tests in
src/main/github/pass - All 15 tests in
src/main/ipc/github.test.tspass - 50 related tests (client-work-items, client-issue-source, issues, github IPC) pass
- Localization verification passes for all 5 locales
- All 191 tests in
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →