Repository navigation
fix(minimald): fix detach-chord detection under zellij #440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Doesrussh::ChannelMsg::Dataguarantee input message boundaries for terminal keystroke streams, or can CSI escape sequences be split/coalesced across messages?💡 Result:
The
russh::ChannelMsg::Datavariant does not guarantee input message boundaries for terminal keystroke streams or any other application-level data [1][2]. SSH channel data is treated as a continuous, unstructured byte stream [3][4]. Because the SSH connection protocol (RFC 4254) multiplexes data over channels without preserving application-layer framing, CSI escape sequences and other terminal control codes can be split, coalesced, or fragmented across multipleChannelMsg::Datamessages [3][4]. Key technical considerations: 1. Stream Orientation: Therusshlibrary exposes SSH channels as stream-oriented abstractions, such asChannelStream, which implementsAsyncReadandAsyncWrite[1][5]. These abstractions behave like standard TCP-like streams where the receiver must handle partial reads and potentially reassemble data fragments [1][5]. 2. Protocol Nature: SSHSSH_MSG_CHANNEL_DATApackets are designed to carry arbitrary byte streams [4][6]. There is no inherent protocol-level requirement for an SSH message to contain a "complete" sequence of terminal data, and implementations (both client and server) are free to segment data based on window sizes, buffer limits, or network packet boundaries [4]. 3. Handling Requirements: Applications consuming these streams must implement their own buffering and parsing logic to reliably identify and process complete CSI sequences (e.g., waiting until a full ESC [ sequence is received) [3]. You cannot rely on individualChannelMsg::Datamessages to contain atomically complete terminal escape codes [3][4].Citations:
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 2838
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 3498
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 715
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 5439
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 302
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 43
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 399
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 1974
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 113
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 43
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 6213
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 941
🏁 Script executed:
Repository: gominimal/minimal
Length of output: 516
Detach detection logic depends on chunk boundaries and can miss Ctrl-W sequences.
At lines 928–930,
is_detachchecks exact equality against incoming bytes chunks. Sincerussh::ChannelMsg::Datadoes not guarantee message boundaries, CSI escape sequences (likeCTRL_W_CSI_U) can be split across multiple messages. If a detach sequence fragments, neither chunk will match and detach will fail to trigger.Implement stream-aware matching using a small rolling bu 7098 ffer or state machine instead of per-chunk equality checks.
🤖 Prompt for AI Agents