[Bug]: Settled local thread unsettles and loses merged PR# when switching back to main for pull / new branch #4752
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/web
Steps to reproduce#
- Work in a local checkout on a feature branch.
- Follow the usual workflow on that thread: commit → push → open PR → merge to
main. - After the PR is merged, switch the local checkout back to
main, pull, and open a new branch (or start a new thread that does this). - Look at the older thread that owned the merged PR.
Expected behavior#
- The older thread stays settled.
- The merged PR number / PR link remains visible in the UI for that thread.
Actual behavior#
- The older thread unsettles on its own.
- The merged PR
#disappears from the UI for that thread. - Happens every time with this workflow.
Impact#
Minor bug or occasional failure
Version or commit#
latest nightly
Environment#
macOS desktop app, local checkout workflow
Logs or stack traces#
Workaround#
None known
Notes#
This happens specifically with the local checkout path (branch → commit → push → PR → switch back to main to pull → new branch). Closest related open issues do not cover this settle + PR metadata regression (#4706, #4725, #4561, #4356).
Yea I dont use worktrees workflow much so didn't want to change that. Thank You Louis!
juliusmarminge closed this
This is still reproducible on
v0.0.36-nightly.20260828.1210using the Linux desktop app.Reproduction:
- Start a local-checkout thread on a feature branch.
- Push the branch and open a PR. T3 Code infers the PR from the branch.
- Merge the PR and observe the thread auto-settle.
- Switch the checkout to
mainand delete the local feature branch. - Restart the desktop app.
- The thread returns to Active and loses its merged PR association.
The affected thread had no explicit
linkedPullRequestvalue. Nothread.unsettledevent occurred either. Its settled state depended entirely on the merged PR derived by the client.PR #4755 retains the terminal PR in
threadChangeRequestSnapshotsAtom, which handles branch switching within the same client process. That snapshot is only in memory. After restart, the checkout reportsmain, the thread still records the feature branch, and the snapshot is absent.resolveDisplayedThreadPrreturnsnull, theneffectiveSettledreturnsfalse.I reproduced this deterministically against the exact installed tag with a focused test:
vp test run apps/web/src/components/ThreadStatusIndicators.triage.test.ts × keeps a merged-PR thread settled after a client reload on main AssertionError: expected false to be trueThe existing tests for same-process snapshot retention and explicit PR linking pass. The server regression test from #6216 also passes, so this is separate from the server-side unpublished-branch fix discussed in #7653.
Expected: once T3 Code observes that a thread's PR merged, the resulting settlement or PR association should survive a client restart and normal branch cleanup.
Workarounds are to explicitly link the PR before restarting or manually settle the thread afterward.
Could this issue be reopened to cover persistence across client restarts?
Sign in to join this conversation.
Filed #4831 for the worktree half of this root cause — same
resolveThreadPrbranch-equality check from #4460, but a slice #4755 explicitly excludes (it retains only merged/closed PRs, and only for local checkouts).There the stored
projection_threads.branchgoes stale because the agent switches branches inside the thread's own worktree and nothing writes the new HEAD back, so an open PR badge never appears at all rather than being lost on a checkout switch. Cross-linking in case the two are better fixed together.