Repository navigation
fix: submit typed messages with a separate Enter - #384
Merged
Merged
Conversation
brtkwr
enabled auto-merge
November 23, 2026 04:05
Since ccs types message-box text into a session's terminal first, a message of 63 characters or more sat in Claude Code's prompt unsent. iTerm's write text sends the text and its \r in one write, and Claude Code reads a burst of 64 bytes or more as a paste, whose Enter is a newline. Measured on a throwaway session: 62 characters + \r submits, 63 + \r stays in the prompt, and a lone \r afterwards submits it. SendKeys now types the text, waits SubmitDelay (300ms), then presses Enter on its own, in tmux and iTerm alike. A failed Enter after the text went in is ErrEnterNotSent, never ErrNoTerminal, so the message is never also sent over the socket. ccs now tracks a typed message until the transcript shows it (a user line, or the queue-operation enqueue a busy session logs at once, now recorded for typed text too as Conversation.Queued), and says plainly when it hasn't arrived after 5s, so it can't silently sit in a prompt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brtkwr
force-pushed
the
fix/typed-message-submit
branch
from
November 23, 2026 04:06
2347a76 to
1e8e5dd
Compare
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.
Opus 5.5 ✨
Messages sent from ccs's message box often didn't send: the text landed in the session's prompt with the cursor on a new empty line, and nothing was submitted. This started with #381 (v0.187.0), which types messages into the session's terminal first.
Cause
Claude Code reads a burst of 64 bytes or more as a paste, and an Enter inside a paste is a newline, not submit. iTerm's
write text "…" newline truesends the text and its\rin one write, so any message of 63 characters or more became a pasted line plus a newline, left in the prompt.Evidence, from throwaway Claude Code 2.1.330 sessions (made-up names, closed afterwards):
write text "hello world one line" newline true, read raw from the tty:b'hello world one line\r', one write, no bracketed paste.\rsent afterwards submitted the message that was waiting.tmux already sent Enter as a second
send-keyscall. That worked in testing, but nothing kept the two from reaching Claude Code in one read.Fix
sessions.SendKeystypes the text with no Enter, waitsSubmitDelay(300ms), then presses Enter on its own (iTerm:write text "" newline true, which sends\ralone; tmux:send-keys Enter). This covers Claude Code, Codex, agy and typed slash commands.ErrEnterNotSent, neverErrNoTerminal, sodeliverMessagedoesn't also send the message over the socket. A message is never delivered twice.queue-operationenqueue a busy session logs at once. Typed text is plain text, soConversation.PeerQueuedbecameQueuedand records every enqueue. If neither appears within 5s, the status line says in red✗ not arrived … it may be sitting unsent in its prompt, press Enter in its tab. ccs doesn't press Enter again by itself, because by then you may be typing in that tab. Once the message arrives, the note says✓ Delivered to <name> (typed, as you)./or!. Multi-line text keeps going over the message socket, as one message.Testing
TestSendKeysPressesEnterApart(tmux and iTerm: the text call, then a separate Enter at leastSubmitDelaylater; a menu digit stays one call),TestSendKeysEnterFailureIsNotNoTerminal,TestTypedMessageDelivery(tracking, thenot arrivedwarning, enqueue and user line as arrival) and an extendedTestMidTurnAndPrefixedPeerMessagesParsed.sessions.TypeKeysand the socket pathdeliverMessageuses, against throwaway sessions in iTerm and in a private tmux server. Every case arrived exactly once, in both terminals:🤖 Generated with Claude Code