Repository navigation
Commit 180745f
fix(server): a server-started turn recovers its removed worktree after the root goes idle (#1601)
## Problem
A server-started turn (MCP, queue, schedule) can land on a thread whose worktree and branch were removed.
If another thread is running in the project root at that moment, recovery yields and records a failed move.
The turn-start gate retries under the same run's recovery id, and the retry never moves the thread.
Reproduced in VM UAT on the V2 port:
1. Codex thread on worktree `feat-b`
2. Worktree and branch removed
3. Claude thread in the root calls `t3_thread_send`
4. First attempt refused: root busy
5. Retry logs "moved", persists nothing
6. Turn fails: workspace folder no longer exists
## Change
Recovery dispatched its refused write and its committed write under one command id.
The orchestrator replays an existing receipt as success, so the commit became a no-op.
The refused write now carries its own command id (`<recoveryId>:refused`).
The committed write keeps the recovery id, so its timeline notice id stays stable across retries.
## Scope and approval
Fork-only fix to the V2 port's removed-worktree recovery, which gates the first 0.0.46 fork nightly.
Browser turns were unaffected: the client path mints a fresh recovery id per attempt.
## Verification
A new integration test covers a recovery refused while the root is busy, then retried after the root settles.
Without the fix it fails: `worktreePath` stays on the removed path.
| Check | Result |
| --- | --- |
| `vp test run` on the gate integration test | exit 0, 9 passed |
| `vp run typecheck` in `apps/server` | exit 0 |
| `vp run fork:ci` | exit 0 |
The VM rerun of the MCP recovery scenario follows on the rebuilt server.
Claude Opus 5.5 in Claude Code, running inside T3 Code.
## Fork trailers
Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: no
Co-authored-by: donjor <[email protected]>1 parent d68a7a5 commit 180745f
2 files changed
Lines changed: 120 additions & 21 deletions
File tree
- apps/server/src
- git
- orchestration-v2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
110 | 112 | | |
111 | 113 | | |
112 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
265 | 288 | | |
266 | 289 | | |
267 | 290 | | |
| |||
387 | 410 | | |
388 | 411 | | |
389 | 412 | | |
390 | | - | |
391 | 413 | | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
| 414 | + | |
411 | 415 | | |
412 | 416 | | |
413 | 417 | | |
| |||
566 | 570 | | |
567 | 571 | | |
568 | 572 | | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
0 commit comments