Repository navigation
Commit b4451af
fix(server): tear down zmux sessions on thread settle and delete (#1688)
## Problem
Settling or deleting a worktree thread could leave its zmux session and background commands running.
## Change
Settle and delete now remove the entire managed session, including running commands and other viewers, using its exact native identity.
Cleanup reads retained project ownership after project removal; the sidebar guide now distinguishes plain shells from managed sessions.
```diff
- projects.getShell(thread.projectId)
+ projects.get(thread.projectId, { includeDeleted: true })
```
- **Unsettle/pin:** no automatic restoration
- **Terminal open:** creates a fresh session
- **Root/main:** remains protected
## Scope and approval
The maintainer requested permanent teardown of sessions, dev servers, and tabs, and authorized this fix and PR in T3 Code.
## Verification
### Evidence
**Before settlement:** shell and dev tabs.

**After settlement and unsettle:** no managed session; retained scrollback and a plain shell.

**Delete, retaining checkout:** cancel worktree removal.

**Project removal:** session and HTTP process gone; main and checkout survived.


### Behavior checks
- [x] **Chrome:** isolated state on VMON-1
- [x] **Settle:** session, tabs, server removed
- [x] **Delete:** session gone, checkout retained
- [x] **Unsettle:** no session restoration
- [x] **Main:** survived both transitions
- [x] **Native:** processes and bindings gone
### Project removal
- [x] **Project removal:** cleanup completes
- [x] **Race:** deleted during preparation
### Validation
Server typecheck and bundle commands ran from `apps/server`.
The latest ownership fix passed the bundle build and isolated Chrome project-removal flow; settle/unsettle media covers the earlier teardown implementation.
**Rebased head:** `aad41d2`; all three feature patches unchanged.
- [x] **Focused server tests:** 53 passed
- [x] **`vp run typecheck`:** exit 0
- [x] **`vp run build:bundle`:** exit 0
- [x] **`vp run fork:ci`:** exit 0
- [x] **Targeted code lint:** exit 0
- [x] **Cleanup:** browser, sessions, dev stopped
### Limits
- [ ] **Desktop/mobile/remote:** not exercised
- **Markdown:** existing lint findings remain
GPT-6.1-Sol, Codex harness in T3 Code.
## Fork trailers
Squashes:
- 9f74547 fix(server): tear down zmux sessions on thread settle and delete (#1688) (#1688)
- 156efb2 fixup! fix(server): tear down zmux sessions on thread settle and delete (#1688) (#1688)
Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: no
Co-authored-by: donjor <[email protected]>1 parent c40227a commit b4451af
8 files changed
Lines changed: 126 additions & 178 deletions
File tree
- apps/server/src
- project
- terminal
- zmux
- docs
- fork
- internals
- user
- user
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
| |||
125 | 123 | | |
126 | 124 | | |
127 | 125 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 126 | + | |
132 | 127 | | |
133 | 128 | | |
134 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
0 commit comments