Repository navigation
cmux-tui: a daemon start adopts its terminal hosts in parallel (perf100, cx-p00l3.1) - #23180
lawrencecchen wants to merge 3 commits into
Conversation
…erf100, cx-p00l3.1) 16 cat terminals, the daemon SIGKILLed and restarted with every host handshake slowed to 400 ms by a debug seam (CMUX_TUI_TEST_ADOPT_HANDSHAKE_DELAY_MS). The new daemon must answer within 3 s (serial: 6.4 s), every terminal must be running on its old host with its screen, and input after the handoff must land after the old screen. Red on the base: the startup pass adopts one host after another. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…00, cx-p00l3.1) After an update the new daemon adopted every terminal host one after another before it answered: 113 terminals kept every terminal blank for 8 to 20 s on Lawrence's laptop (mac26: 8.4 s to start, first frame at 14.7 s). The startup pass now makes every registry decision in record order as before, collects the live hosts, runs their handshakes (connect, snapshot replay into the mirror) at once on up to 16 scoped threads, then commits the results in record order with the same success and failure paths, so topology and lifecycle decisions are unchanged and no output is reordered (each host replays its own snapshot; later output follows on its stream). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…h (review) A reservation not yet committed cannot be shrunk, so side-by-side reservations that changed the budget bucket each waited out the 500 ms reservation wait and adopted with Kitty graphics disabled. The batch now sets an owner floor (existing owners + handshakes) for the capacity while it runs, so every reservation gets its final share at once; a drop guard ends the floor after the commits, also on an early error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Correctness review (review subagent, read-only) and resolution
The reviewer traced these and found them clean: template claim, legacy import, orphan recovery (each creates its workspace inside the serial loop), |
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
|
|
Found 29 test failures on Blacksmith runners: Failures
...and 19 more test failures. View all on Blacksmith: run 39566126416, run 39566126375, run 39566126252
|
|
|
GUI handoff measurement (
|
| Metric | Base 3c73ce6 (job 1021-010217-e93b27) | This PR (job 1021-010218-6f1429) | Change |
|---|---|---|---|
First live terminal frame (interactive_ms) |
8292 ms (FAIL, bound 8000) | 6948 ms (pass) | -1344 ms, 1.19x |
| First window frame | 904 ms | 892 ms | same |
| Longest main-thread stall | 354 ms | 321 ms | same |
The parallel adoption saves about 1.3 s here. About 6.9 s still passes before the first terminal frame. Most of that time is outside the adoption pass. The next step is to answer at once and attach visible terminals first, which needs the app side. It is a separate item.
|
Closed by the landing captain (coordinator decision, 2026-10-22): #23561 (merged 17:23Z) already makes a daemon start adopt its terminal hosts in parallel. This branch conflicts with it in mux/terminal_adoption.rs and tests/terminal_host_recovery.rs. The branch stays on the remote for reference. |
perf100 tui lane, bead cx-p00l3.1 (P1): after an update, the new daemon adopts every terminal host one at a time before it answers. On Lawrence's laptop, 113 terminals stayed blank for 8 to 20 s. On mac26 with 112 terminals, the daemon took 8.4 s to start, and the first terminal frame came at 14.7 s.
Change (
mux/terminal_adoption.rs)CMUX_TUI_TEST_ADOPT_HANDSHAKE_DELAY_MS, slows each handshake for the test.Evidence
tests/terminal_host_recovery/parallel_handoff.rsruns on rbx. It uses 16catterminals, SIGKILLs the daemon, and restarts it with every handshake slowed to 400 ms.answered in 6.57 s (serial: 6.4 s).answered in 0.63 s.Real handoff with no seam, on rbx (Linux, release build). The script is
handoff_bench.py. Setup: 100 terminals with 20,000 lines of scrollback each. The old daemon is SIGKILLed, and the new binary starts on the same state.The GUI measurement with
scripts/cmux-next/quit-launch-bound.py --handoff(#22919) runs on cmux-lawrence-2, before and after. The results will follow as a comment.Not in this PR (named, decision for the coordinator)
adoptingstate at launch, which the async retry path already publishes (PendingTerminal::Adopting). It also needs an order of visible terminals first.quit-launch-bound.pylives in cmux NEXT: a keep quit ends within 4 s whatever any step does; Restart to Update never leaves cmux invisible #22919, which is still open. I will add the case there, or in a follow-up once it lands.Observed / Not run
agent_reports.rs:458,event_shape_tests.rs:148), none from this change.terminal_host_recovery: 204 pass, 4 fail. The same 4 fail on base 3c73ce6 (sized_attachx3,a_respawned_terminal_resumes_its_agent_session).Changelog
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
After an update, the new daemon adopted each terminal host one at a time before answering, leaving 113 terminals blank for 8-20s. It now runs the host handshakes (connect plus snapshot replay) in parallel on up to 16 threads while keeping every registry and lifecycle decision serial and in record order, so the daemon answers in about a third of the time with no change to output order.
CMUX_TUI_TEST_ADOPT_HANDSHAKE_DELAY_MS) and a test that SIGKILLs the daemon and restarts it with 16 slowed handshakes, down from 6.4s to 0.63s.Changelog: Fixed: after an update, terminals show again in about a third of the time.
Written for commit dbeaf2d. Summary will update on new commits.