draft: diagnosis for #9418 (typing order on slow systems)#10737
Draft
lonexreb wants to merge 1 commit into
Draft
draft: diagnosis for #9418 (typing order on slow systems)#10737lonexreb wants to merge 1 commit into
lonexreb wants to merge 1 commit into
Conversation
…ev#9418) Issue warpdotdev#9418 reports printable characters appearing out of order while typing on a resource-constrained Linux Mint machine. After tracing the full input pipeline (winit KeyboardInput -> convert_keyboard_input_event -> handle_converted_warpui_event -> dispatch_event KeyDown -> dispatch_event TypedCharacters -> typed_characters_on_terminal -> system_insert or write_user_bytes_to_pty -> ctx.emit(WriteBytesToPty) -> pty_controller subscription -> event_loop_tx.send(Message::Input) -> mio channel -> event_loop State::write_list VecDeque -> PTY write), no actual reorder or race was found: the pipeline is single-threaded on the UI thread and uses FIFO queues end-to-end (pending_effects, write_list, mio channel). This commit doesn't fix the reported bug because the root cause cannot be pinpointed from the current report (no Warp version, channel, screen recording, or logs - as already requested by the triage workflow). Instead, it codifies the ordering invariant of the printable-character hot path so future contributors investigating similar reports have a reference point and a guard against accidental reorder-introducing changes (background- thread hops, coalescing, batching) in this exact spot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a draft diagnosis PR, not a fix. Issue #9418 reports printable characters appearing out of order while typing on a resource-constrained Linux Mint 21.3 XFCE machine. I traced the full input pipeline and could not find an actual race or reorder; opening a draft so a maintainer can weigh in before any speculative code change lands.
Closes: nothing yet — needs more info from reporter to make this actionable.
What this PR changes
A single comment in
crates/warpui/src/windowing/winit/event_loop/mod.rsin theConvertedEvent::KeyDownWithTypedCharactersarm, documenting the ordering invariant of the printable-character hot path. Zero behavior change.Investigation trace
End-to-end pipeline for a printable keypress on Linux:
Event::WindowEvent { WindowEvent::KeyboardInput }arrives on the winit event loop (single-threaded).event_loop/mod.rs:1270convert_keyboard_input_event(sync, pure).event_loop/key_events.rs:60handle_converted_warpui_eventdispatchesKeyDown, thenTypedCharactersif unhandled.event_loop/mod.rs:1081-1100dispatch_eventis fully synchronous; any side effects emitted viactx.emitgo onto thepending_effects: VecDeque<Effect>and are drainedpop_frontin FIFO order.core/app.rs:3136TerminalView::typed_characters_on_terminal->system_insert(editor) orwrite_user_bytes_to_pty->ctx.emit(Event::WriteBytesToPty).terminal/view.rs:7979-8009PtyController::write_bytes->send_message_to_event_loop(Message::Input).writeable_pty/pty_controller.rs:636-735EventLoop::drain_recv_channel->state.write_list.push_back(input)(aVecDeque<Cow<[u8]>>).local_tty/event_loop.rs:164-176write_listfront-to-back to the PTY fd.Every hop is FIFO; the entire flow runs on the UI thread; there is no background-thread hop for printable characters;
pending_flushes/flushing_effectsguards incore/app.rsprevent re-entrant flush reorder. No coalescing, no batching, no debounce in this path.Why I am not shipping a code fix
The reporter's symptom — letters arriving in a different order than typed on a Linux Mint machine with 8GB RAM — is the kind of bug where a speculative fix is more likely to regress good behavior than to fix the real cause. Probable real causes that the current report cannot disambiguate:
Ime::Preeditinterleaving withKeyboardInput. On Linux with IME enabled, winit emits both keyboard events andIme::Preedit/Ime::Commit. These are processed in arrival order, but if the user is typing fast and the IME is committing pre-edits asynchronously at the OS level, characters can land non-monotonically. This is OS/IME behavior, not Warp.oz-for-ossalready requested both.Required follow-up before a fix can be designed
oz-for-oss already requested 1 and 2 on the issue; this PR documents the diagnostic ground truth so a maintainer doesn't have to redo the trace.
Test plan
🤖 Generated with Claude Code