Repository navigation
fix(cmux-tui-core): a regression test for the poisoned arm of the creating-input check; it loads the routes before its poison check (#34174 review follow-ups) - #35127
Conversation
…fore its poison check, as Mux::surface does; the comments state the leaf rule and the insert race (#34174 review follow-ups) - live_surface_for_terminal loads the published routes before the poison check (poison never clears), so the routes it answers with come from a change that finished before any panic; its old read still recovers the poison. - The creating-input lock is a leaf only while the state is not poisoned: on a poisoned state its holders take the session lock under it, so no code may take it under the session lock (doc and DESIGN S1.4). - begin_creating_input: on both arms the live read ends before the insert; an entry made for a terminal that just went live is written to it in order, by the creation's finish or by the next input on another path. Test: mux::tests::signaled_mutex::a_poisoned_session_state_answers_the_creating_input_checks_from_the_state.
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
|
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 3a5484f to compare; do not merge until green; see lane-rules Shipped in:
|
|
Found 2 test failures on Blacksmith runners: Failures
|
|
Review (claude-reviewer-rds-s14): FIX at 71f21cd One defect must be fixed before the merge. The product change and the test are correct. I traced both in the head checkout. I did not build or run anything locally. Defect
Answers to the hand-off questionsDoes the test prove what it claims? Yes.
Can the new load order give a different answer? It cannot give an answer that the old path cannot give.
Can the drop of the poisoned test mux hang or panic? No.
Are the comments exact? Almost. Three small wording points (non-blocking):
Evidence at the head
|
… mux scope (clippy unused_qualifications); comment wording (#35127 review 1) - mux/tests/signaled_mutex.rs: TerminalHostIdentity, TerminalId, Surface and SurfaceOptions are in scope through use super::*; the crate:: prefixes failed clippy -D warnings (clippy (changed cmux-tui packages), lint (linux)). - creating_input.rs: a queue can also be given back; the leaf rule is stated for the lane; the routes lack a panicked create's terminal only until a later change that recovers the poison publishes them.
|
Review (claude-reviewer-rds-s14): SHIP at 4e5eb5f No defect blocks the merge. 4e5eb5f fixes the defect from my FIX at 71f21cd. It changes only the test and comments. I did not build or run anything locally. The defect is fixed
The rest of the commit
Evidence at the head
|
|
At 4e5eb5f: receipt #35127 (comment) (SHIP at this head). Focused run https://github.com/manaflow-ai/cmux/actions/runs/41801819083 at this head ( |
…d state, so a session with a poisoned state still shuts down (#35127 review note) Mux::drop -> finalize_terminal_journal -> the output store's last write (snapshot::final_pass, and its memory budget) looks each dirty terminal up here. The plain unwrap() panicked inside the drop on a poisoned state lock, so the rest of the shutdown (the journal writer's stop, the browser runtime's shutdown) never ran. finalize_terminal_journal itself already recovers the poison; this lookup now does the same. Test: mux::tests::agent_roster_poison::a_persistent_session_with_a_poisoned_state_still_shuts_down (red at 7ef8ee6: panicked at output_store/memory_budget.rs:143).
…(terminal_resource_surface recovers the poisoned guard) (#35279) * test(cmux-tui-core): a persistent session with a poisoned state still shuts down (red) Mux::drop -> finalize_terminal_journal -> output_store.shutdown -> snapshot::final_pass looks each dirty terminal up with Mux::terminal_resource_surface, whose plain unwrap() panics on a poisoned state lock; the rest of the drop then never runs (#35127 review note). * fix(cmux-tui-core): Mux::terminal_resource_surface recovers a poisoned state, so a session with a poisoned state still shuts down (#35127 review note) Mux::drop -> finalize_terminal_journal -> the output store's last write (snapshot::final_pass, and its memory budget) looks each dirty terminal up here. The plain unwrap() panicked inside the drop on a poisoned state lock, so the rest of the shutdown (the journal writer's stop, the browser runtime's shutdown) never ran. finalize_terminal_journal itself already recovers the poison; this lookup now does the same. Test: mux::tests::agent_roster_poison::a_persistent_session_with_a_poisoned_state_still_shuts_down (red at 7ef8ee6: panicked at output_store/memory_budget.rs:143). * test(cmux-tui-core): a terminal launch credential is refused on a poisoned session state (#35279 review, red) With terminal_resource_surface recovering a poisoned state, check_launch_credential (an authorization decision) verifies a terminal from a catalog a panicked change may have left half made; before #35279 it panicked. The other auth checks fail closed on a poisoned lock (origin_gate peer_or_local). * fix(cmux-tui-core): a terminal launch credential fails closed on a poisoned session state; the drop test drops the last handle itself (#35279 review) - Should-do 1: check_launch_credential refuses a terminal credential (credential_closed) while the session state is poisoned: the daemon cannot show the terminal is still open, and the catalog lookup now recovers the poison instead of panicking. The same rule as the other auth checks (origin_gate peer_or_local). credential_closed is an existing wire word, so the resource catalog does not change. - Should-do 2: the output store's writer holds a mux handle during its pass, so drop(mux) could run the drop on the writer thread, outside catch_unwind. The test now takes the last handle (Arc::try_unwrap, at most 5 s) and drops the Mux inside catch_unwind. Test: a_terminal_credential_is_refused_on_a_poisoned_state (red at 70f614b). * test(cmux-tui-core): the poison tests name Instant, Duration and CredentialCheck through the module scope (clippy unused_qualifications)
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Summary
Follow-ups from the last review of #34174 (R-DAEMON-STATE S1.4, merged as eaa00d9; review comment "Review (claude-reviewer-rds-s14): SHIP at 5aa3ec4", non-blocking notes 1-4). Behind the input lane switch
CMUX_TUI_RDS_INPUT(default off on feat-cmux-next).mux::tests::signaled_mutex::a_poisoned_session_state_answers_the_creating_input_checks_from_the_state: with the lane on, a create's commit puts its terminal in the state and then panics. The cut-short guard publishes no routes, soknows_terminal_input_targetmust answer from the state.live_surface_for_terminalnow loads the published routes before its poison check, asMux::surfacedoes (poison never clears, so routes it uses come from a change that finished before any panic). Its old read still recovers the poison. The reviewer found no wrong answer with the old order; this makes the two readers follow one rule, and the comment says why the old read differs.live_surface_for_terminal, and DESIGN S1.4).begin_creating_input: on both arms the live read ends before the insert, so a commit can make the id live in between; that entry is then written to the live terminal in order.Testing
Focused command:
./scripts/verify-cmux-tui-hosted.sh --filter a_poisoned_session_state_answers_the_creating_input_checks_from_the_state(Linuxtest (linux)).test/rds-s14-poison-red-never-merge(248abb0) removes the poison check: run https://github.com/manaflow-ai/cmux/actions/runs/41797164005 FAILED ("a poisoned state answered from the published routes, which lack the terminal its state holds").--filter creating_inputat 71f21cd, run https://github.com/manaflow-ai/cmux/actions/runs/41797179957: 13 passed, 0 failed (theprocess_support::creating_inputintegration tests, the new test, andrds_input_lane::a_key_waits_for_no_creating_input_lock).Compile: fleet job 97d92dbabbb6c17adeb0633a at 71f21cd: CmuxNext, app and cmux-tui passed.
Observed / Not run
Changelog
none
Proof
No capture: daemon-only change behind a default-off switch, no UI.