Time each late key to the console by hand-off; a keystroke no longer waits in the input pipe for the next one (SES-354) #62

Merged
merge-queue merged 3 commits from att-key-arrival into main 2026-11-29 23:46:39 -08:00
Owner

Typing on nelsonpc is choppy: keys reach tmux in bursts, a median ~70 ms and up to 1.7 s after the press, while the program answers within 1-2 ms of tmux reading the key and tmux's client never waits on its console writes. So the time goes between the press and the tmux client reading the key from at-terminal's console, and nothing timed that stretch. Work package: https://openproject.home.romaine.life/wp/SES-354 (from https://openproject.home.romaine.life/wp/SES-337, https://openproject.home.romaine.life/wp/TMUX-266).

Added: each late key's time, split by hand-off (Windows only). The window's message hook keeps the last press (its time from MSG::time, and how long the window's thread had taken no message); the key handler hands it on with the bytes it queues (teletypewriter::key_trace::sent); the input pipe's worker marks when they were written into the console's pipe. A press whose bytes reach the pipe 25 ms or more after it happened (the typing budget, at-home-tools docs/typing-latency.md) is counted, and once a second at most at-terminal's log says keys reached the console late count= worst_ms= window_ms= idle_ms= handler_ms= pipe_ms=. With tmux's key trace (read), whatever remains is the console host and the client.

Fixed: a keystroke could wait in the input pipe for the next one. The pipe worker checked for bytes outside the lock the writer notifies under, so bytes arriving between its check and its wait never woke it; they sat until the next write. It now checks under that lock, and the writer and Drop notify under it.

Replaced: this branch's earlier keys reached the window late line, which timed only the press to the window: its numbers are window_ms and idle_ms here.

Not changed: how keys are encoded or written, frames, Linux and macOS.

Tests: key_trace's two unit tests; atlog's line tests updated for the new fields; cargo clippy -j 4 on teletypewriter, rio-window and rioterm.

🤖 Generated with Claude Code

Typing on nelsonpc is choppy: keys reach tmux in bursts, a median ~70 ms and up to 1.7 s after the press, while the program answers within 1-2 ms of tmux reading the key and tmux's client never waits on its console writes. So the time goes between the press and the tmux client reading the key from at-terminal's console, and nothing timed that stretch. Work package: https://openproject.home.romaine.life/wp/SES-354 (from https://openproject.home.romaine.life/wp/SES-337, https://openproject.home.romaine.life/wp/TMUX-266). **Added: each late key's time, split by hand-off (Windows only).** The window's message hook keeps the last press (its time from `MSG::time`, and how long the window's thread had taken no message); the key handler hands it on with the bytes it queues (`teletypewriter::key_trace::sent`); the input pipe's worker marks when they were written into the console's pipe. A press whose bytes reach the pipe 25 ms or more after it happened (the typing budget, at-home-tools `docs/typing-latency.md`) is counted, and once a second at most at-terminal's log says `keys reached the console late count= worst_ms= window_ms= idle_ms= handler_ms= pipe_ms=`. With tmux's key trace (`read`), whatever remains is the console host and the client. **Fixed: a keystroke could wait in the input pipe for the next one.** The pipe worker checked for bytes outside the lock the writer notifies under, so bytes arriving between its check and its wait never woke it; they sat until the next write. It now checks under that lock, and the writer and `Drop` notify under it. **Replaced:** this branch's earlier `keys reached the window late` line, which timed only the press to the window: its numbers are `window_ms` and `idle_ms` here. **Not changed:** how keys are encoded or written, frames, Linux and macOS. Tests: `key_trace`'s two unit tests; atlog's line tests updated for the new fields; `cargo clippy -j 4` on teletypewriter, rio-window and rioterm. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Log key presses that reach the window past the typing budget, and whose time it was (TMUX-266)
Some checks failed
Suite default / scope (pull_request) Has been cancelled
Suite default / check-fetches (pull_request) Has been cancelled
Suite default / check-rules (pull_request) Has been cancelled
Suite default / check-logs (pull_request) Has been cancelled
Suite default / reused-checks (pull_request) Has been cancelled
Suite release / scope (pull_request) Has been cancelled
Suite release / module (pull_request) Has been cancelled
Suite release / reserve (pull_request) Has been cancelled
Suite release / finalize (pull_request) Has been cancelled
Suite release / deliver (pull_request) Has been cancelled
Suite release / deliver-prune (pull_request) Has been cancelled
Suite release / publish (pull_request) Has been cancelled
Suite release / check-package (pull_request) Has been cancelled
Suite release / deploy-image (pull_request) Has been cancelled
Suite release / reused-checks (pull_request) Has been cancelled
merge-queue CI failed: Suite default / check-fetches (pull_request), Suite default / check-logs (pull_request), Suite default / check-rules (pull_request), Suite default / reused-checks (pull_request), Suite def…
Suite rust / scope (pull_request) Has been cancelled
Suite rust / check-format (pull_request) Has been cancelled
Suite rust / check-test-linux (pull_request) Has been cancelled
Suite rust / check-test-windows (pull_request) Has been cancelled
Suite rust / check-services (pull_request) Has been cancelled
Suite rust / check-typos (pull_request) Has been cancelled
Suite rust / check-machete (pull_request) Has been cancelled
Suite rust / check-audit (pull_request) Has been cancelled
Suite rust / reused-checks (pull_request) Has been cancelled
8687d55cfa
Time each late key to the console by hand-off; a keystroke no longer waits in the input pipe for the next one (TMUX-266)
Some checks failed
Suite rust / check-services (pull_request) Has been skipped
Suite rust / check-typos (pull_request) Has been skipped
Suite rust / check-machete (pull_request) Has been skipped
Suite default / check-logs (pull_request) Successful in 29s
Suite default / scope (pull_request) Successful in 32s
Suite default / check-rules (pull_request) Has been skipped
Suite release / scope (pull_request) Successful in 36s
Suite release / reserve (pull_request) Has been skipped
Suite release / check-manifest (pull_request) Has been skipped
Suite release / publish (pull_request) Has been skipped
Suite default / check-fetches (pull_request) Has been skipped
Suite rust / check-audit (pull_request) Has been skipped
Suite release / deploy-image (pull_request) Has been skipped
Suite release / finalize (pull_request) Has been skipped
Suite rust / scope (pull_request) Successful in 31s
Suite release / module (pull_request) Has been skipped
Suite release / build (rust, x86_64-pc-windows-msvc) (, rust-x86_64-pc-windows-msvc, x86_64-pc-windows-msvc, false, windows-latest, x86_64-pc-windows-msvc, rust) (pull_request) Has been skipped
Suite release / deliver (pull_request) Has been skipped
Suite release / deliver-prune (pull_request) Has been skipped
Suite rust / check-format (pull_request) Successful in 43s
merge-queue CI failed: Suite rust / check-test-linux (pull_request)
Suite default / reused-checks (pull_request) Successful in 27s
Suite rust / check-test-linux (pull_request) Failing after 2m5s
Suite rust / check-test-windows (pull_request) Has been cancelled
Suite rust / reused-checks (pull_request) Has been cancelled
Suite release / check-package (pull_request) Has been cancelled
Suite release / reused-checks (pull_request) Has been cancelled
Suite release / check-build (rust, x86_64-pc-windows-msvc) (, rust-x86_64-pc-windows-msvc, x86_64-pc-windows-msvc, false, windows-latest, x86_64-pc-windows-msvc, rust) (pull_request) Has been cancelled
612e5b87e6
First-time contributor

merge-queue stopped this at 612e5b8: CI failed: Suite rust / check-test-linux (pull_request). Push a fix. A failure fixed on main lands once the queue label is removed and added again: the queue merges main in and CI runs on the new head.

merge-queue stopped this at 612e5b8: CI failed: Suite rust / check-test-linux (pull_request). Push a fix. A failure fixed on main lands once the `queue` label is removed and added again: the queue merges main in and CI runs on the new head.
The late-key log line is Windows-only; Linux and macOS build without it as dead code (SES-354)
All checks were successful
Suite rust / check-test-linux (pull_request) Successful in 5m36s
Suite release / module (pull_request) Has been skipped
Suite release / build (rust, x86_64-pc-windows-msvc) (, rust-x86_64-pc-windows-msvc, x86_64-pc-windows-msvc, false, windows-latest, x86_64-pc-windows-msvc, rust) (pull_request) Has been skipped
Suite default / check-fetches (pull_request) Has been skipped
Suite release / check-manifest (pull_request) Has been skipped
Suite release / deploy-image (pull_request) Has been skipped
Suite rust / check-services (pull_request) Has been skipped
Suite rust / check-audit (pull_request) Has been skipped
Suite release / scope (pull_request) Successful in 40s
Suite release / finalize (pull_request) Has been skipped
Suite release / deliver (pull_request) Has been skipped
Suite rust / check-typos (pull_request) Has been skipped
Suite default / check-logs (pull_request) Successful in 26s
Suite rust / scope (pull_request) Successful in 39s
Suite release / reserve (pull_request) Has been skipped
Suite release / publish (pull_request) Has been skipped
Suite default / scope (pull_request) Successful in 29s
Suite default / check-rules (pull_request) Has been skipped
Suite rust / check-machete (pull_request) Has been skipped
Suite release / deliver-prune (pull_request) Has been skipped
Suite rust / check-format (pull_request) Successful in 35s
Suite default / reused-checks (pull_request) Successful in 37s
Suite rust / check-test-windows (pull_request) Successful in 8m32s
Suite rust / reused-checks (pull_request) Successful in 32s
Suite release / check-build (rust, x86_64-pc-windows-msvc) (, rust-x86_64-pc-windows-msvc, x86_64-pc-windows-msvc, false, windows-latest, x86_64-pc-windows-msvc, rust) (pull_request) Successful in 15m23s
Suite release / check-package (pull_request) Successful in 23s
Suite release / reused-checks (pull_request) Successful in 8s
merge-queue landed on main
eebb1303af
merge-queue deleted branch att-key-arrival 2026-11-29 23:46:39 -08:00
Sign in to join this conversation.
No reviewers
No labels
queue
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/at-terminal!62
No description provided.