Skip to content

fix(cmux-tui-core): a tab order change validates its pane, not every tab of it - #36235

Merged
cmux-bot[bot] merged 2 commits into
feat-cmux-nextfrom
fix/tab-order-touches-only-its-pane
Nov 5, 2026
Merged

cmux-bot[bot] merged 2 commits into
feat-cmux-nextfrom
fix/tab-order-touches-only-its-pane

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Second cause of the base red cmux-tui-core state::group_update_latency_tests::a_persons_requests_answer_while_busy_sessions_saturate_the_registry (a person's chat tab over its 200 ms p95 while busy sessions write; red in 9 of 31 full runs I have logs of). The first cause (the public fold never pruned restated chat tabs) is #36212.

Cause (product): every tab create, move or close sends its pane's new order (SetTabOrder), and validate_touched_resource_invariants (workspace_registry/resource_store.rs) put every tab of that order into the validation set: validate_touched_tab ran once per tab of the pane, about 5 queries each, inside the writer transaction under the registry lock a person's next click waits on. A tab order change writes only positions: set_resource_tab_order requires the exact live set, and the contiguous-position check below covers the order, so no tab's own rows change. SetWorkspaceOrder was already exempted for the same reason ("validating every workspace per create cost O(n)").

Fix: SetTabOrder adds only its pane to the validation set. Tabs the patch changes are still validated through their own changes (UpsertTab, TombstoneTab, their content).

Commits: (1) red test state::group_update_latency_tests::a_chat_tab_create_validates_only_the_tabs_it_changed with a test-only counter on validate_touched_tab (a create in a 31-tab pane validated 31 tabs on the base); (2) the fix.

Testing

  • Deterministic red, test commit 2753606: Linux (job 42a31ec88055136f1de61666) and macOS (job 1b0a8d844d2f77a79e413e2a): "one chat tab create in a 31-tab pane validated 31 tabs".
  • Green at 39fb532: Linux all filter resource (job 90677b103a2f7c679c2b003d): 339 of 339, fmt pass, clippy pass; macOS filter tab (job 87511a2fde88bde618fdf1fa): 779 of 779; panic ratchet (job 1de28e5641b7f95052901e0a) pass; full Linux (job 1276a059d6d618160a09ffcf): 17258 of 17258 pass, the latency test included.
  • python3 scripts/cmux-next/prepush-gate.py: no new violations.

Observed / Not run

  • Observed: the results above.
  • Not changed, for the owner (PL-daemon): SetTabOrder also makes every tab of the pane a journal subject (session_journal.rs collect_patch_subjects: one journal_subject_index row per tab per create). SetWorkspaceOrder dropped the same; changing it changes what a subject reader returns, so it is the owner's call.

Changelog

none


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

A tab order change (SetTabOrder) now validates only the pane it changed, not every tab in it. Previously each tab of the pane ran about 5 validation queries inside the writer transaction under the registry lock a person's next click waits on — a second cause of the red group_update_latency_tests latency test. An order change writes only positions, covered by the exact-live-set and contiguous-position checks, so no tab's own rows change; the same rationale already exempted SetWorkspaceOrder.

Adds a regression test with a test-only counter on validate_touched_tab, asserting one create in a 31-tab pane validates only the changed tabs. SetTabOrder still makes every tab of the pane a journal subject; changing that is left to the owner of session_journal.rs.

Written for commit 39fb532. Summary will update on new commits.

View guided diff Turn on auto-fix

…nged (red: it validates every tab of its pane)
…tab of it

SetTabOrder writes only positions: set_resource_tab_order requires the exact live set and the
contiguous-position check covers the order, so no tab's own rows change, as for
SetWorkspaceOrder (validated the same way since the workspace-order fix). A chat tab create in
a pane of N tabs ran validate_touched_tab N times, about 5 queries each, under the registry
lock.
@lawrencecchen lawrencecchen added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 39fb532: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr36235 -f ref=fix/tab-order-touches-only-its-pane -f platform=macos -f backend_mode=local

Shipped in:

@blacksmith-sh

blacksmith-sh Bot commented Nov 5, 2026

Copy link
Copy Markdown

Found 3 test failures on Blacksmith runners:

Failures

Test View Logs
nightly cmux-tui resolve/nightly cmux-tui resolve View Logs
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)/
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)
View Logs
the six-hour schedule must allow 90 minutes for a cold cache build and use the matching
runner, Xcode, and visible timing output/
the six-hour schedule must allow 90 minutes for a cold cache build and use the matching
runner, Xcode, and visible timing output
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Review (independent review subagent, Claude): SHIP at 39fb532

A SetTabOrder writes only positions (set_resource_tab_order requires the exact live set and updates only position), so it cannot break what validate_touched_tab checks (row, identity, pane live, content live). Every write that can (move, close, content change) comes as its own UpsertTab/TombstoneTab/content change, which still puts the tab in the set; moves in structural_move.rs, tab_workspace_move.rs and pane_tab_moves.rs all send the moved tab's upsert. The pane stays validated (live, screen live, active tab owner), and the exact-set and contiguous-position checks cover the order. Stricter than the SetWorkspaceOrder precedent. No other check reads the tab set. The test counter is process-wide (one test per process under nextest; a plain multi-threaded cargo test could over-count). No new non-test panic site. Read only; no build or test by the reviewer.

@lawrencecchen lawrencecchen added the ready-to-land Reviewed at this head; next-autoland merges it into feat-cmux-next when its only reds are base reds label Nov 5, 2026
@cmux-bot
cmux-bot Bot merged commit cb7b65d into feat-cmux-next Nov 5, 2026
242 of 253 checks passed
@cmux-bot
cmux-bot Bot deleted the fix/tab-order-touches-only-its-pane branch November 5, 2026 06:46

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 39fb5325 Deployed Nov 5, 2026 by lawrencecchen via cmux-tui tree preflight #114684
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-land Reviewed at this head; next-autoland merges it into feat-cmux-next when its only reds are base reds risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant