fix(server): find fork pull requests for branches tracking a local branch #48313
main fromrefs/pull/48313/head·opened View on GitHubProblem#
A branch that tracks another local branch keeps that upstream after a push to a fork without -u. T3 Code treats the local upstream as evidence that the branch already has a remote head, so it misses the fork's open PR.
Deterministic repro on origin/main (43328e8f0a680a491c84995b398f5c635ff37a90): Apply only the GitManager.test.ts hunk to the pinned base and run:
vp test run apps/server/src/git/GitManager.test.ts -t 'finds a fork PR when the branch tracks another local branch'
The test uses real bare origin and fork remotes with configured GitHub identities owner/repo and alice/repo. It runs git checkout -b feature/local-track --track main, git commit --allow-empty -m 'Fork feature', and git push fork feature/local-track. The existing source-control test provider lists an open cross-repository PR #42 from alice/repo:feature/local-track to owner/repo:main.
- Observed:
GitManager.status,GitManager.remoteStatus, andGitManager.branchPullRequestall return no PR. The app'ssubscribeVcsStatusstream carries the remote statusprfield to the shared client runtime unchanged, so an open PR is absent from the status badge.ThreadPullRequestServicealso skips auto-linking on the null branch lookup, and settlement sees no PR from that lookup. - Expected: All three methods identify the fork's published head and return PR #42.
Change#
Treat a local upstream as distinct from a published head. When there is no published remote, reuse the existing branch-ref discovery and resolve the discovered remote against the feature branch's own name, not its local upstream. This fixes the shared server lookup used by web, desktop, mobile, and thread settlement without changing clients, contracts, or provider adapters.
Scope#
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification#
- On base, the focused test exited 1 with
{ status: null, remoteStatus: null, branchPullRequest: null }; on the fix it exited 0 with all three PR numbers equal to 42. vp run check:changedexited 0: format, lint, Knip, GraphQL, typecheck, and 204 tests across two affected files.- Before/after Git and server runtime transcript.
- Not shown: Live GitHub, client rendering or relay transport, and end-to-end thread settlement or worktree removal. The regression exercises real local Git and the server lookup with fixture PR metadata.
Authored by GPT-6.2 Sol (Codex); reviewed by Gemini 4 Neon (Antigravity).
- 1
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
40eba9dMacroscope's review found this PR approvable — This corrects fork pull-request discovery for branches tracking another local branch, using existing remote-inference safeguards. The change is limited to lookup behavior and introduces no repository writes or product-default changes.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review.
Walkthrough
-
GitManager now treats a local upstream as unpublished and can resolve the published remote for a branch whose head context lacks one. A regression test checks that three lookup methods find the matching pull request on a fork.
Changes: Fork pull request lookup
Layer / File(s) Summary Resolve the published branch head
apps/server/src/git/GitManager.ts,apps/server/src/git/GitManager.test.tsA saved upstream on remote .no longer creates an upstream reference. The published-remote fallback also runs when the resolved head context has no remote. The regression test verifies thatstatus,remoteStatus, andbranchPullRequestfind PR 42 for a branch tracking localmainand pushed to a fork.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
pingdotgg/t3code#8209— The change addresses the use of a local upstream as evidence for a published head in fork lookup. The test covers fork discovery, but not the issue’s non-default-base scenario.
Suggested reviewers:
stienswout,iamshadmantaqi
Merge Risk:
Minimal · up to40eba-
The change fixes pull request discovery for branches pushed to a fork when they track a local branch. No concrete merge-blocking risk was found, and a regression test covers the scenario.
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the main change: fork PR discovery for branches that track a local branch. It uses the conventional commit format and is one sentence. It matches the GitManager fix and the regression … Description check The description follows the template sections (Problem, Change, Scope, Verification). The Problem section gives the cause and a reproduction command. The Change section explains the fix. The Scope sec… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title names the main change: fork PR discovery for branches that track a local branch. It uses the conventional commit format and is one sentence. It matches the GitManager fix and the regression test.
Full details: Description check
-
Explanation
The description follows the template sections (Problem, Change, Scope, Verification). The Problem section gives the cause and a reproduction command. The Change section explains the fix. The Scope section explains why no issue is needed. The Verification section reports focused test results, a repo check run, and what was not shown. The description is mostly complete and clear.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: e1b810e
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
686c905b-1b00-463b-8a3b-2c002bfd1b84
Commits-
Reviewing files that changed from the base of the PR and between e1b810e48f8d97cccc34b9ba4a22f58db722c1eb and 40eba9d0e0e626b8700e5bad587ca48533c1e13a.
Files selected for processing: 2-
apps/server/src/git/GitManager.test.tsapps/server/src/git/GitManager.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
-
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes