Repository navigation
cmux-tui: read the registry identity without the registry lock - #27780
Conversation
…ock (red) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
registry_identity() locked the workspace registry to read its id and generation, two values fixed when the registry opens. About twenty request paths read them: every mutation's reply (mutation_result), list-workspaces, identify, attach checks. On a loaded Mac the registry lock waited p90 5.2 s, p99 16.8 s (server-stats after 3.7 h: 67,948 stalls, 155,310 acquisitions), so the app's 2 s requests (put-frontend-projection, close-workspace, list-workspaces) timed out partly behind a lock taken for two constants. The pair is now read once at construction, like session_public_id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Correctness review (subagent): SHIP at 8227e9e
Primary agent's own check: I read the diff. The field is set from the same Review (claude-subagent): SHIP at 8227e9e |
|
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)
red: cmux-next checks (god files, concurrency, crash safety, l10n); no finished base run on c4a9ee3 to compare; do not merge until green; see lane-rules Shipped in:
|
|
Found 8 test failures on Blacksmith runners: Failures
|
|
Overlap note from the lock work for the 10-29 report (#27698): branch It touches the same workspace registry lock as this PR:
|
|
Correction: my branch does not change registry_identity; the only shared file is mux/resource_effects.rs. |
|
Review (codex gpt-6-astra high fast, drain lane): SHIP at 8227e9e No blocking findings. |
…t (clippy) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Sweep fix: (1) |
|
Independent review for awareness (codex gpt-6-astra, high, fast; read-only, no builds), at head No verified defects found. The cached identity preserves behavior and the regression test covers lock independence. No builds/tests were run, per instruction. VERDICT: SHIP at 0789b33 — no concrete correctness, lifecycle, or concurrency defects found. |
|
Review (codex gpt-6-astra high, next-review): SHIP at 0789b33 SHIP at 0789b33 Visual verdict: no images; Leo tries the build No correctness findings. Both identity fields remain immutable after registry construction, and all Tests were not rerun: this box lacks Cargo and Zig. Follow-ups: none |
|
Review (next-review patch-id; carried): SHIP at 706c849 The independent SHIP at 0789b33 carries to this head: the PR's own change ( |
|
Review (next-review patch-id; carried): SHIP at 19cc5b4 The independent SHIP at 0789b33 carries to this head: the PR's own change ( |
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Summary
Part of the cmux NEXT lag audit (#27698 has the connection-limit side).
On a loaded nightly-next Mac,
server-statsover 3.7 hours showed the workspace registry lock as the daemon's bottleneck:The app's 2 s requests timed out behind it:
put-frontend-projection(629 times),close-workspace(537),list-workspacesresyncs (181, with a 10 s budget),identify(281).Mux::registry_identity()took that lock only to read the registry's id and generation, two values fixed when the registry opens. Generation changes only on a reopen, which builds a newMux. About twenty request paths read them, including:resource_router::mutation_result);list-workspaces;identify(cmd_server);cmd_attach);cmd_terminals).So each of those requests queued behind a durable commit a second time, just for two constants. The pair is now read once in
Muxconstruction, the same waysession_public_idis, and returned without the lock.Testing
Regression test:
registry_identity_does_not_wait_on_the_registry_lockincmux-tui-core/src/mux/tests/workspaces.rs. It holds the registry lock on one thread and reads the identity from another, with a 5 s bound../scripts/verify-cmux-tui-hosted.sh --filter registry_identity_does_not_wait_on_the_registry_lockat af7d305 (test only): RESULT_REDObserved / Not run
personal_snapshot) still contend, and are listed in the audit as follow-ups.Performance
No perf numbers: this removes one registry-lock acquisition per identity read; no before/after harness was run on a loaded daemon. The server-stats lock wait and hold numbers in the Summary are the observed baseline that motivated it.
Changelog
Fixed: cmux NEXT requests that only read the session's identity no longer wait behind saves on a busy Mac.
🤖 Generated with Claude Code