fix(cmux-tui): skip mutation ledgers in the registry open check
cmux NEXT nightly 1.0.0-nightly.3911762409401 took about 40 s after launch before terminals attached. Its cmux-tui daemon was spawned at 05:23:41, but it opened its control socket only at 05:24:21. Until then the app logged create workspace failed: not connected to cmux-tui and attach … failed. The previous nightly's launch on the same machine had the same gap at about 20 s.
The time goes to the registry open check. check_registry_integrity runs PRAGMA quick_check('<table>') on every table except journal history. The mutation idempotency ledgers (mutations, projection_mutations, terminal_mutations) store each committed mutation's result so a retry of the same (origin, mutation_id) can return it. They grow with every write and are read only by that key. On this install, projection_mutations held 17,191 rows and about 1 GB, mostly cmux-history results, in a 1.37 GB registry. Read-only quick_check timings against that registry on the Mac:
| table | time |
|---|---|
workspaces | 0.2 s |
resource_mutations (11 MB) | 1.4 s |
projection_mutations (1 GB) | 100.9 s, cold, with the daemon also running |
The check now skips those three ledgers the way it skips journal history (#15153). For each one it reads the newest row and the newest (origin, mutation_id) key, so a corrupt tail page in the table or its key index still fails the open. Everything else is checked as before. That includes resource_mutations, which is pruned on every open and whose terminal-defaults rows are restored at mux construction, and bookmark_mutations, which is keyed by seq.
This bounds open time. It does not stop the ledgers from growing; they still need retention.
Changelog
Fixed: cmux NEXT no longer waits on a large mutation history before terminals attach at launch.
Verification
The regression test open_integrity_check_skips_mutation_ledgers records the tables the check runs quick_check on through a SQLite authorizer. Hosted runs of cmux-tui.yml in focused mode with that filter:
- RED on the test without the fix (fe64c2f, current feat-cmux-next merged in):
mutations was quick_checked on open, https://github.com/manaflow-ai/cmux/actions/runs/39138988641 - GREEN on the PR head 0772bcb: the test passes in
test (linux)and inmacOS lint and tests, which includescargo clippy --workspace --all-targets -D warnings. https://github.com/manaflow-ai/cmux/actions/runs/39140454934
Both runs also fail lint (linux) at the Rust god-file check. That failure is base-red: workspace_registry.rs has 231 functions on feat-cmux-next (691f3c0) against a baseline of 226, and this PR adds none. The roll-up focused hosted verification job fails because of it. Linux clippy is skipped after that step; macOS clippy ran and passed.
Not measured in an app build: the 40 s figure is from the installed nightly's unified log and the daemon's workspace-registry.owner-shutdown window. The new open time has not been measured on that registry.
🤖 Generated with Claude Code