Repository navigation
perf(cmux-tui-core): a pane or tab list inside one workspace reads only that workspace (CLI-1) - #32177
Conversation
…ed session with lock and projection split (CLI-1)
…rkspace (CLI-1 fix 2 red)
…ly that workspace (CLI-1) Under the L1 CLI storm (STATUS 6237, fleet run 360f44a0) the largest holder of both global daemon locks was public_session_snapshot: 22 s of registry hold and 22 s of state hold in 60 s, from CLI `tab list`, `pane list` and `terminal list` calls that built the whole session snapshot (every workspace, terminal, notification, agent and projection) and kept one pane's rows. A pane.list or tab.list whose path names a workspace now reads that workspace's stored subtree under the registry lock alone (as workspace.list already reads only workspace rows), with the same pane and tab values in the same order, from one shared builder. A session-wide list keeps the snapshot.
|
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)
web and size checks: green Shipped in:
|
|
Review (subagent, correctness first): SHIP at 6fd44a3 I read the code only: no build and no test run. Scope: I found no Blocker, High or Medium issues. 1. The values are the same as the snapshot's.
2. The order is the same.
3. Consistency.
4. Scope selection.
5. The test.
Low findings
|
|
Found 6 test failures on Blacksmith runners: Failures
|
|
A/B after merge (headless daemon at 40 workspaces / 200 terminals,
Whole-snapshot hold of both global locks ( |
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Summary
Under the L1 CLI storm against a 40-workspace / 200-terminal daemon (fleet run 360f44a009fb64208b8e3ab6, STATUS 6237), the largest holder of BOTH global daemon locks was
public_session_snapshot(resource_api.rs:553): 22.2 s of registry hold and 22.2 s ofMux.statehold in a 60 s storm (37 %), 2,117 calls at about 10.5 ms each. Its callers were CLItab list --pane P,pane list --workspace Wandterminal list --pane P: each built the whole session snapshot (every workspace, screen, pane, tab, terminal, browser, notification, agent and frontend projection) and then kept one pane's rows. Idle,tab listandpane listgrew from 6 ms at 1 workspace to 14 ms at 40; under the L6 app load (STATUS 6075)tab listwas 50 ms p50 and every other daemon call waited behind these holds.Fix: a
pane.listortab.listwhose resolved path names a workspace (a--workspace,--screenor--panescope) reads that workspace's stored subtree (resource_topology_scoped, the read the scoped projection already uses) under the registry lock only, not the state lock, and builds the same pane and tab values in the same order from one shared builder (public_pane_and_tab_values, now also used by the session snapshot), with the same tab decoration. A session-wide list keeps the snapshot.Not in this PR:
terminal.list --pane(a terminal value needs live runtime state; next PR),screen.list.Owner: PL-daemon (cmux-tui daemon,
cmux-tui/crates/cmux-tui-core/).Changelog
none
Testing
Regression test:
scoped_pane_and_tab_lists_read_only_their_workspace(cmux-tui-core,mux/tests/read_paths.rs). In a two-workspace session with a split and extra tabs,pane.list --workspace,tab.list --paneandtab.list --workspacemust equal the session snapshot's rows for that scope, read no full topology, read no terminal host, projection or journal table, and write nothing.pane.list {"workspace":...} read the whole topology(its value check passed on the base, so the expected rows are right).every_test_binary_runs_in_the_hermetic_environmentandusage_stats::the_session_list_and_info_carry_what_the_chats_transcript_says, cmux-tuishare_chat_waits_for_the_owners_answer).Command:
cmux-ci run --class isolated --script scripts/ci/cmux-tui-rust-check.sh --ref SHA --os linux --arg test --arg scoped_pane_and_tab_lists_read_onlyA/B: interleaved before (23de9c2) / after (6fd44a3) runs of
perf-10x-daemon.sh --arg=scenarios=cli-stormare queued on one mini (6c5c4e8f, 6633e96b against b4c6acd1, 1cc4271f); the numbers are added here when they end.Observed / Not run
Observed: the base lock split (fleet run 360f44a0), the red and suite steps above.
Not run: an L6 round in the real app with this change.
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Fixes
pane.listandtab.listcalls scoped to a workspace, screen, or pane building the entire session snapshot and holding both global daemon locks. A scoped list now reads only that workspace's stored subtree under the registry lock alone, producing the same pane and tab values in the same order as before. Session-wide lists still read the snapshot;terminal.listandscreen.listare unchanged.Testing
cli-stormscenario tobench-daemon-latency.pythat runs the L1 CLI mix against an L5-sized session and reports daemon lock and topology projection splits.Written for commit a7c4d74. Summary will update on new commits.