Repository navigation
fix(tasks): resolve PR work items upstream-first under 'auto' like issues - #8727
Conversation
📝 WalkthroughWalkthroughAutomatic pull request source resolution now prefers the upstream repository for non-origin preferences, falling back to the origin repository when needed. Tests cover upstream PR retrieval and source metadata for 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Heads-up: #9384 just landed on main and touched |
a399fbc to
e2ff002
Compare
|
Rebased over #9384 — this PR still only changes the auto-side resolution expression. |
…sues On a fork, 'auto' routed the Tasks PR list/count to origin — the fork's own PR list, which is almost always empty — while highlighting the Upstream pill (issues resolve upstream-first). The PRs tab showed 'No matching GitHub work' until the user explicitly clicked Upstream, and the highlighted pill contradicted where the data actually came from. stablyai#5176 routed explicit picks through the preference for both sides but deferred the 'auto' side. This aligns it: 'auto' resolves PRs upstream-first exactly like issues; an explicit 'origin' pick still pins PRs to the fork.
e2ff002 to
4a38a91
Compare
|
Thanks so much for this, @moseoh — resolve PR work items upstream-first under 'auto' like issues. Reviewed, rebased on latest |
fix(tasks): resolve PR work items upstream-first under 'auto' like issues
Summary
On a fork, opening Tasks → PRs with no explicit source preference showed "No matching GitHub work" even though the user's PRs existed upstream.
ELI5
When you work from a fork, your pull requests actually live on the original project, not your copy. The PRs tab was looking at your (empty) copy by default, so it looked like you had none. Now it looks in the right place.
Root cause & fix
Under the
autopreference, the issue side resolved upstream-first, butresolvePrWorkItemSource()pinned the PR side toorigin(the fork), whose PR list is almost always empty for fork-contribution workflows. The fix flips the default soautoresolves upstream-first, mirroring the issue side; only an explicitoriginpreference still pins PRs to the fork. It's a single resolution expression shared bylistWorkItemsandcountWorkItems, so lists, pagination totals, andsources.prsmetadata stay consistent. Repos without anupstreamremote are unaffected — the?? originfallback preserves current behavior.Evidence
Validated & rebased onto latest main during a bug-bash triage on 2026-07-23. Rebase onto
origin/mainwas clean (base7ab601487c, heade2ff0024c3).src/main/github/client-issue-source.test.tspasses on branch: 30/30 tests passed.git checkout origin/main -- src/main/github/client.ts), keeping the tests, fails 2 tests (28 passed), capturing the bug:npx oxlint src/main/github/client.ts→ exit 0, no warnings/errors.Trade-offs
None — pure fix.
Regression risk
Zero-regression. Only the
autobranch changes (now upstream-first, matching issues); explicitoriginstill pins the fork and explicitupstreamis unchanged. Repos with no upstream remote fall back to origin exactly as before. Callers are unaffected, and this is proven by the passing branch suite plus the fail-on-revert assertions above.Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved. Credit to original author @moseoh.