Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Merging a PR linked to one thread moves an unrelated Local thread on the same branch to Settled #40554

Closedvatsa31(GitHub profile, opens in a new tab) opened this issue 0 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. In Settings → Auto-settle, enable Auto-settle merged threads ("Settle a thread when its pull request merges."). Disable inactivity auto-settle so only merge-based settlement is active.
  2. In a project using Local mode (root checkout, worktreePath === null), start Thread A on branch feat/example, open a PR, and explicitly link that PR to Thread A.
  3. Before Thread A's PR merges, create Thread B in the same project in Local mode (so it shares the root checkout on feat/example) with 0 linked PRs, and send a message / start activity so Thread B is saved on the server and idle on that branch.
  4. Merge Thread A's PR (with mergedAt >= Thread B's latest activity).

Expected behavior

Only Thread A should auto-settle. Thread B never created or linked that PR, so it should remain active.

Actual behavior

Both Thread A and Thread B are automatically moved to Settled when Thread A's PR merges.

In apps/server/src/orchestration-v2/ThreadSettlementService.ts:

  • Thread A settles via its explicit pullRequests link and is excluded from lookupCandidates.
  • The merge event resweeps lookupCandidates (threads with no visible explicit pullRequests). Thread B falls into the ["branch", workspaceRoot, "feat/example"] lookup group (or resolves via branchPullRequest), picks up Thread A's merged PR, and passes pullRequestSettles because mergedAt >= latest(createdAt, latestUserAuthoredMessageAt).
  • Explicit PR ownership on a sibling thread is not checked before attributing that PR to Thread B.

Impact

Minor bug or occasional failure

Version or commit

0.1.12-nightly.20261121.5038

Environment

macOS 27.3 (arm64), T3 Code (Nightly) 0.1.12-nightly.20261121.5038

Workaround

Pinning Thread B, manually disabling auto-settle on Thread B in advance, or setting the project's default environment mode to Worktree.

  1. tanstack-source added labelsbug

  2. juliusmarminge closed this

Sign in to join this conversation.