perf(cmux-tui-core): the input port's writer runs at user-interactive QoS once it carries a person's key (R-DAEMON-STATE S1.6d)
Summary
R-DAEMON-STATE stage S1 step 6d (handoff/rewrites/R-DAEMON-STATE/DESIGN.md, section 2.6.1), from the review of the S1.7 default flip (#35413). Behind the stage switch CMUX_TUI_RDS_INPUT (only the input lane uses the port).
The defect. The person's keys cross their connection's three threads at user-interactive QoS (server/input_qos.rs, TYPING FIX 2 F7), then the terminal's input port writer, which was spawned at the default QoS and never raised itself. Under full CPU it waited for a CPU between the key's acceptance (daemon.send.written) and its write to the host. DESIGN 2.6.1 asks for the writer at user-interactive while it carries the person's input; it was listed after the #34544 review and not built. In the build 3b A/B (STATUS 11804), the lane-on keys over 4 ms waited in that hop (1.21-3.90 ms from daemon.send.written to the host's PTY write), and the lane-on tail was about 1 ms longer than the old path's.
The fix. The writer raises itself (input_qos::raise_this_thread, once per thread) when it takes a frame with no waiter that is not a viewer size: InputPort::enqueue, which only the person's keys use (InputReply::Accepted). Automation's writes (InputPort::write, a waiter) and viewer sizes do not raise it, so a port only automation writes to keeps the default QoS, as automation's connections do. A writer that exits idle starts again at the default. Off macOS this sets nothing.
Testing
Focused test (macOS only; QoS is a no-op elsewhere): the_input_ports_writer_runs_at_user_interactive_qos_once_it_carries_a_persons_key (surface/tests/hosted.rs). It checks that automation's write leaves the writer at the default QoS and that after a person's key the writer runs at user-interactive.
- Red at b0786647b9e (
test/rds-s16d-red-never-merge), fleet step b084ffa94c68fa603d5fd666 on aws-m4pro-3 (scripts/ci/cmux-tui-rust-check.sh --os macos test <name>): FAILED, "the writer that carried the person's key does not run at user-interactive QoS". - Green at 3690c395049, fleet step e95015db0fbec39e23d51602 on aws-m4pro-7: passed.
- Linux
--filter hostedat 3690c395049: run https://github.com/manaflow-ai/cmux/actions/runs/41839435510:test (linux)passed;lint (linux)was red on my test seam (writer_qos_for_testunused on Linux, where its macOS-only test does not exist). - 0c77eb0ac59 makes the seam
cfg(all(test, target_os = "macos"))(test builds only). At this head, run https://github.com/manaflow-ai/cmux/actions/runs/41843138251:test (linux)passed;lint (linux)is red only on the base findingacpmux: clippy::indexing_slicing 687 > baseline 686(a crate this PR does not touch; cmux-tui-core's counts went down).
Compile: fleet job 4ae6ea4a97f3bd342dc4ac5e at the head 0c77eb0ac59: CmuxNext, app and cmux-tui passed (also bf8dbfe438eb0d68c30f6d19 at 3690c395049).
Observed / Not run
- Observed: the fleet steps and the compile above.
- Not run: a typing A/B of this change alone. It runs in the S1.7 set (#35413), whose build contains it (build 9d7979ebda5282c4a6b0f152 at d62017f9c28).
Changelog
none
Proof
No capture: a daemon thread priority, no UI.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the terminal input port's writer running at default QoS while carrying a person's keystrokes, so on macOS under full CPU a key no longer waits for a CPU between its acceptance and the write to the host.
- The writer raises itself to user-interactive QoS (once per thread) when it takes a frame with no waiter that isn't a viewer size — the path only the person's keys use.
- Automation's writes and viewer sizes don't raise it, so a port only automation writes to keeps the default QoS.
- Off macOS this sets nothing, and a writer that exits idle starts again at the default.