Repository navigation
fix(server): reused merge request worktrees stay on the recorded head - #47596
Conversation
Co-authored-by: Claude Opus 5.5 <[email protected]>
When the host no longer publishes a request's head ref, the reused worktree followed the source branch's upstream, which can move on after a merge. Prefer the head commit the host recorded for the request. Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
…rded head Open requests without a head ref keep following their source branch, since their recorded head can lag a new push. Settled requests without a recorded head stay where they are and report the checkout as off-head. Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Reused worktrees for settled requests now fall back to the recorded request head instead of a source branch that may have advanced. Existing checkout protections remain in place, limiting the change's risk. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dismissing prior approval to re-evaluate 51a663a
EvidenceEnvironment: Linux web app, Chromium, 1280×800, light theme, fresh isolated server state, real Azure DevOps CLI/API and git remote. Create and merge a real Azure DevOps request while retaining review-source; push a later commit to that branch. On each app build, create fresh synthetic project state and a clean existing review-source worktree at the recorded head, tracking origin/review-source. Open the branch picker, search for the request, choose Checkout pull request, confirm Merged, click Worktree, and open review.txt with the file picker. Scenario: A completed request reuses its recorded head after the source branch advancesProven: the scenario fails on base a19b9187b3 and passes on head 51a663a3e3.
Before recording · After recording Scenario source · Azure seed script · Setup notes Not shown:
|
Merges upstream `pingdotgg/t3code` `3067c49847` (301 commits since `fc5ddf3d3c`). > **Merge this PR with "Create a merge commit". Do not squash it.** > pingdotgg#323 was squash-merged, so `fc5ddf3d3c` stopped being an ancestor of `main` and this merge's base fell back to `c16ad0ce17`: 1013 commits and 180 forecast conflicts. The first commit here, `git merge -s ours fc5ddf3` with the tree unchanged, puts the ancestry back. A squash would throw that repair away along with this merge's own parent. ## Commits (read in order) 1. `chore: record upstream fc5ddf3 as merged`: the ancestry repair, with no content change (`git diff f455503 HEAD^` is empty). 2. `chore: merge upstream t3code to 3067c49`: the merge itself, the `threads.moveWorkspace` union entry, and the docs/fork updates. ## Numbers - Landed 817 files against 819 in the upstream range. The two missing files are `apps/server/src/cli/pair.ts` and its test, which the fork deletes on purpose. - Fork delta: 802 files. ## Conflicts (5, each resolved by its verdict) - `cli/pair.ts` and `cli/pair.test.ts`: upstream modified them and the fork deletes them, so they stay deleted. - `ui/textarea.tsx`: upstream's class string, plus the fork's `font` prop. - `agentContextBudget.json`: upstream's values, with `mcpToolListJsonBytes` set to upstream + 108 (63684). `AgentContextBudget.test.ts` passes. - `pnpm-lock.yaml`: re-derived from upstream's copy. `duplicate-adds` and `resolution-check` are clean. The owned-concern sweep matched 6 new files: four vendored libghostty headers and two e2e scenarios, all false positives. ## Feature classification **Usable as-is** - Effect 4.2.0 (pingdotgg#47767) and libghostty-vt 1.0.2 (pingdotgg#47842). - Several hundred web, mobile and shared fixes: footnotes, previews, the workflow panel, PR UI and more. **Unsupported in Moatless / needs implementation** - `threads.moveWorkspace` (pingdotgg#47234: "Move to project…", the palette folder pick, and recovery from a missing workspace). The union entry is added. Every entry point checks the `threadWorkspaceMoves` capability, which Moatless does not report, so the surface is hidden with no fork gate. Recorded in gaps.md under the methods and capabilities entries. - Blume docs site at t3.codes/docs (pingdotgg#44630): upstream publishing, not relevant to the fork. **Backend behavior to consider reproducing in Moatless** (added to gaps.md under runtime fixes) - Worktree recovery and setup reruns after a stopped turn, a retry, or a failed hook (pingdotgg#47694, pingdotgg#47681, pingdotgg#47679, pingdotgg#47685). - Commits stop when the checkout moves under them (pingdotgg#47617, pingdotgg#47526, pingdotgg#47438), and reused PR worktrees stay on the recorded head (pingdotgg#47596, pingdotgg#47528, pingdotgg#47799). - Scheduled runs resume watching their turn after a restart (pingdotgg#47732) and don't fire twice for one slot (pingdotgg#47722). - Codex resumes and forks keep the selected reasoning effort (pingdotgg#47811). - Perf: shell snapshot queries (pingdotgg#47780), workflow questions answered in one query (pingdotgg#47734), bounded history reads (pingdotgg#47544), event-log pruning (pingdotgg#47862). ## Verification - `verify.mjs`: the parallel pass got the pod evicted, so it was re-run with `--sequential`. Everything except tests is green: duplicate-adds, tripwires, resolution-check, unsupported-methods (after the ADD), lockfile, fmt, lint, typecheck and build. - Tests: 39 of 40 completed packages pass. `@t3tools/shared` fails only `AgentScope`, a known OOM-score sandbox gap. - **Not fully verified: `t3` (apps/server) did not finish.** The container stopped after about 3 hours, 84 files in. Every failure up to that point is a known sandbox gap: - git `insteadOf`, Chromium, and the Codex `/tmp` sticky bit. - `ProjectionStore` and `Orchestrator.control-reads`, which call Node 26's `StatementSync.stat` while the sandbox runs Node 24. - The `t3` tests beside the fork's server delta were run separately: 12 files, 366 tests, all passing. CI should run the rest. - The commit skipped the known knip pre-commit failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- Moatless task: https://moatless.soaplabstest.com/tasks/bc02b1b2-62c6-4ed0-9429-49bb17da1c4c





Reopening a merged or closed request in its existing worktree could move that worktree to later source-branch commits once the host had dropped the request's head ref, and the checkout reported no off-head warning. When there is no head ref, a settled request now stays on its recorded head commit. If it has no recorded head, the checkout stays where it is and the off-head warning shows. Open requests still follow their source branch, because their recorded head can lag a new push (for example Azure DevOps' lastMergeSourceCommit).
Related: #23368
Reproduction on main
Commit ca36afaeb1 (main). The worktree advances to the later source-branch commit and the checkout completes without an off-head warning. Expected: The existing worktree remains at the commit recorded for the merge request.
The cause is at
apps/server/src/git/GitManager.ts:4172. Ranpnpm scenarios:prove scripts/scenarios/merged-request-reuses-its-recorded-head.e2e.ts --target webwith the repro scenario added: it failed in 2 of 2 runs on a clean boat.dev VM, withexpected "Work after merge" to be "Head at merge"in the output.Evidence
Environment: The web app in Chromium on Linux x64, a fresh checkout on a boat.dev VM reset before each run.
Proven: the repro fails at the test commit 0bb0a7b252 and passes on the head edc34186f7, both on main 37b55b5ccc.
The worktree advances to the later source-branch commit and the checkout completes without an off-head warning.
The existing worktree remains at the commit recorded for the merge request.
Tests
pnpm exec vp run check:changed 37b55b5cccc372793b5e6796aabcdf50b2064f20passed on head.Not in this change
Who did the work
Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5