Skip to content

fix(server): avoid PRs inherited from default upstreams - #7317

Merged
maria-rcks merged 5 commits into
pingdotgg:mainfrom
gsimone:t3code/fix-wrong-pr-autosettle
Aug 18, 2026
Merged

fix(server): avoid PRs inherited from default upstreams#7317
maria-rcks merged 5 commits into
pingdotgg:mainfrom
gsimone:t3code/fix-wrong-pr-autosettle

Conversation

@gsimone

@gsimone gsimone commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Problem

A local feature branch can legitimately track the repository's default branch when it is created from a remote start point:

git worktree add -b feature/local-worktree /tmp/local-worktree origin/main

Git records origin/main as the new branch's upstream. T3 currently derives the PR head selector from that upstream, so it searches for PRs whose head is main instead of feature/local-worktree.

If the repository has ever merged a reverse PR with main as its head and another branch as its base, T3 associates that historical merged PR with the unrelated feature thread. The merged PR state then feeds the normal thread lifecycle and auto-settles the thread once its session is idle.

This is intermittent across repositories and worktrees because it requires both:

  1. a differently named local feature branch tracking the remote default branch; and
  2. historical PR metadata with the default branch as the PR head.

Anonymized reproduction

A public repository containing only synthetic fixture data is available at:

https://github.com/gsimone/t3-default-upstream-pr-repro

Its merged PR #1 deliberately uses main as the head and maintenance-target as the base:

gsimone/t3-default-upstream-pr-repro#1

Reproduce the Git state with:

git clone git@github.com:gsimone/t3-default-upstream-pr-repro.git
cd t3-default-upstream-pr-repro
git worktree add -b feature/local-worktree /tmp/t3-pr-repro-worktree origin/main
git -C /tmp/t3-pr-repro-worktree status --short --branch
git -C /tmp/t3-pr-repro-worktree rev-parse --abbrev-ref --symbolic-full-name '@{upstream}'

Before this fix, opening a T3 thread for /tmp/t3-pr-repro-worktree can show the merged synthetic PR even though feature/local-worktree has no PR. When the thread becomes idle, the unrelated merged state can move it to the settled shelf.

Expected behavior: the remote default branch is treated as the feature branch's starting/base relationship, not as its published PR head.

Fix

  • Expose the resolved default branch in the internal remote Git status details.
  • Include it in PR lookup cache identity.
  • Skip PR lookup when a differently named local branch resolves through its upstream to the default branch.
  • Preserve existing same-repository remote aliases and cross-repository/fork PR detection.
  • Add an integration-style GitManager regression that constructs the tracking relationship with real Git commands and verifies that no provider PR lookup occurs.

Verification

  • vp test run apps/server/src/git/GitManager.test.ts — 83 passed
  • pnpm --filter t3 typecheck — passed (existing unrelated Effect suggestions only)

Implemented with GPT-5.6 Sol through the Codex harness in T3 Code.

Note

Fix PR status resolution to ignore PRs inherited from default branch upstreams

  • When a local branch tracks origin/main (or the repo's default branch) in the same repository, GitManager.status now returns null for the PR lookup instead of inheriting a merged PR from that default branch.
  • Fork PRs whose head branch happens to share the name of the default branch (e.g., contributor:main) are still resolved correctly, since the early-exit only applies to same-repo branches.
  • The PR lookup cache key in prLookupCacheKey now includes defaultBranch so cache entries are correctly segmented when the default branch varies.
  • defaultBranch is added to GitRemoteStatusDetails and propagated from GitVcsDriverCore through to lookupStatusPr.

Macroscope summarized 81a3765.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b7e8e46-9e77-4514-9288-e0981606630b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 17, 2026
Comment thread apps/server/src/git/GitManager.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found.

You can customize Macroscope's approvability policy. Learn more.

@maria-rcks
maria-rcks merged commit 636caf4 into pingdotgg:main Aug 18, 2026
15 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 18, 2026
## What's Changed
* feat(web): show project location in new thread picker by @StiensWout in pingdotgg/t3code#7392
* fix(packaging): install AUR launcher icons where icon themes look by @AugusDogus in pingdotgg/t3code#7421
* fix(web): label pull request merge actions by @tarik02 in pingdotgg/t3code#7381
* fix(server): avoid PRs inherited from default upstreams by @gsimone in pingdotgg/t3code#7317
* fix(desktop): stop the passkey dialog from popping as soon as sign-in opens by @t3dotgg in pingdotgg/t3code#7437

## New Contributors
* @AugusDogus made their first contribution in pingdotgg/t3code#7421

**Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260818.1127...v0.0.34-nightly.20260818.1128

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260818.1128
frankdavidcorona pushed a commit to frankdavidcorona/t3code that referenced this pull request Aug 18, 2026
ohbentos pushed a commit to ohbentos/t3code that referenced this pull request Aug 18, 2026
sheehanmunim added a commit to munimtechnologies/mtcode that referenced this pull request Aug 19, 2026
pingdotgg#7437, pingdotgg#7459, pingdotgg#7460, pingdotgg#7445, pingdotgg#7122, pingdotgg#7317, pingdotgg#7381, pingdotgg#6563)

Where upstream reworked something the fork had already built, upstream's
version wins and the fork's extras ride on top:

- Browser tab mute (pingdotgg#7252): upstream's rollback-on-refusal setAudioMuted and
  tabMuteMenuItem replace the fork's earlier copies; the fork's guest viewport
  override (setViewport/automationSetViewport) stays.
- Passkey autofill (pingdotgg#7437): upstream's `passkeys` const replaces the fork's
  duplicate manualOnlyPasskeys.
- Settle-once-on-merge (pingdotgg#7454): the sidebar now reports the whole change
  request (state + updatedAt) instead of a bare state, so the new rules can
  tell a fresh merge from inherited branch history. The fork's per-row
  reporting stays; upstream's semantics win.
- Merge action labels (pingdotgg#7381): upstream's confirmation state object, extended
  with the fork's merge-stack action.

Also: Clerk v6 moved `layout` into `options`, so the appearance override moves
with it, and the connect-providers helper joins the web tsconfig include list.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
bcotrim pushed a commit to bcotrim/mognet that referenced this pull request Aug 20, 2026
roughcoder added a commit to goodbirdhq/phoenix that referenced this pull request Aug 20, 2026
* test(web): remove duplicate lookup assertion (pingdotgg#7364)

* fix(mobile): show structured input option descriptions (pingdotgg#7321)

* fix(orchestration): do not revive idle tasks from status-free progress (pingdotgg#7172)

* refactor(server): simplify error transformation with Effect.mapError in GitHubPullRequestCli (pingdotgg#7385)

Signed-off-by: aoright <102943475+aoright@users.noreply.github.com>

* fix(preview): open local environment ports on localhost (pingdotgg#7300)

* fix(desktop): prevent quit shortcut spillover (pingdotgg#7397)

* fix(desktop): stop overwriting a custom dock icon on launch (pingdotgg#7125)

* feat(web): show project location in new thread picker (pingdotgg#7392)

Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com>

* fix(packaging): install AUR launcher icons where icon themes look (pingdotgg#7421)

* fix(web): label pull request merge actions (pingdotgg#7381)

* fix(server): avoid PRs inherited from default upstreams (pingdotgg#7317)

* fix(desktop): stop the passkey dialog from popping as soon as sign-in opens (pingdotgg#7437)

* feat(desktop): mute a browser tab (pingdotgg#7252)

* fix(web): improve disconnected composer placeholder (pingdotgg#7122)

Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com>
Co-authored-by: maria <254055478+maria-rcks@users.noreply.github.com>

* fix(desktop): throttle hidden preview rendering (pingdotgg#7445)

Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com>
Co-authored-by: maria <254055478+maria-rcks@users.noreply.github.com>

* fix(server): stop probing Grok, Cursor, and OpenCode unless turned on (pingdotgg#7459)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* fix(desktop): boot the main window unthrottled so cold start paints at full speed (pingdotgg#7460)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* fix(threads): a merged PR settles its thread only once (pingdotgg#7454)

* feat(cli): npx t3 triage hands broken installs to your own coding agent (pingdotgg#6563)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* fix(marketing): Safari gets the arm64 Mac download (pingdotgg#7473)

* feat(web): add shortcuts to the surface dropdown (pingdotgg#7318)

* fix(marketing): never serve the Intel build to Apple Silicon Macs (pingdotgg#7477)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* fix(web): animate command palette when closing (pingdotgg#5169)

* fix(desktop): upgrade Clerk OAuth transport (pingdotgg#7479)

* feat(server): run the background service on macOS via launchd (pingdotgg#6286)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* fix(web): align sidebar statuses with project names (pingdotgg#7491)

Co-authored-by: GPT-5.6 <noreply@openai.com>

* fix(desktop): close the window before quit cleanup (pingdotgg#6562)

* fix(desktop): stop automatic passkey prompts (pingdotgg#7522)

* docs(user): document phoenix triage and macOS background service

The 2026-08-19 upstream sync added the triage command with no docs/user
entry, and the docs index still called the background service Linux-only
after launchd support landed. Found by PR #61 code review.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Signed-off-by: aoright <102943475+aoright@users.noreply.github.com>
Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com>
Co-authored-by: Nick Anisimov <n.anisimov.23@gmail.com>
Co-authored-by: Maslin Edwin <maslinje@gmail.com>
Co-authored-by: aoright <102943475+aoright@users.noreply.github.com>
Co-authored-by: Guilherme Barros <gbarros1095@gmail.com>
Co-authored-by: Bilal Bakr <62337003+Bil0000@users.noreply.github.com>
Co-authored-by: Rishet11 <154429365+Rishet11@users.noreply.github.com>
Co-authored-by: Wout Stiens <71498452+StiensWout@users.noreply.github.com>
Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com>
Co-authored-by: Augie <augie@luebbers.email>
Co-authored-by: Taras <Taras.Fomin@gmail.com>
Co-authored-by: Gianmarco <gianmarcosimone89@gmail.com>
Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Chris Deeming <chris@xenforo.com>
Co-authored-by: Inaya Yousfi <zied.essaber@gmail.com>
Co-authored-by: maria <254055478+maria-rcks@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Rakshith Bhat <88523594+RakshithBhat03@users.noreply.github.com>
Co-authored-by: GPT-5.6 <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants