Repository navigation
[AI-30] Submit hosted-agent input as a bracketed paste - #237
Merged
alexeyzimarev merged 1 commit intoJul 2, 2026
Merged
alexeyzimarev merged 1 commit into
alexeyzimarev merged 1 commit into
Conversation
Follow-up input to a hosted agent was written as raw bytes followed by a 50ms-delayed carriage return. For a large multi-line paste the CR races the still-ingesting paste and is folded into it as a literal newline instead of a submit, so the message sits in the composer until a later, isolated keystroke finishes it. Codex never submits at all; Claude only ~50% of the time (the original AI-30 report, which predates Codex support). Wrap the message in bracketed-paste markers (ESC[200~ … ESC[201~) so the TUI treats it as one pasted block and the trailing CR is an unambiguous submit keypress. Both hosted CLIs enable bracketed-paste mode, so the markers are consumed as delimiters (not echoed). Keep the text/Enter split so the CR lands as a distinct PTY read. Verified against real codex 0.142.5 and claude 2.1.198 with the 17KB paste that hung a spec-review flow round: raw+CR fails to submit, bracketed+CR submits on the first Enter on both harnesses. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PR Summary by QodoAI-30 Submit hosted-agent input as bracketed paste
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
alexeyzimarev
deleted the
alexeyzimarev/ai-30-chat-pasted-text-doesnt-finish-the-input
branch
July 2, 2026 16:46
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.

Problem (AI-30)
Follow-up input to a hosted agent (
SendInput→AgentOrchestrator.HandleSendInput) was written to the PTY as raw bytes followed by a fixed 50 ms-delayed carriage return. For a large multi-line paste the CR races the still-ingesting paste and is folded into it as a literal newline instead of a submit, so the message sits in the composer until a later, isolated keystroke finishes it.This is also what caused a spec-review flow's round 2 to hang for 11 minutes: the ~17 KB re-submitted spec landed in the reviewer's composer but was never submitted until a manual keystroke flushed it. (Smaller rounds/messages settle within 50 ms, so their CR submits — which is why round 3 and typed messages worked.)
Fix
Deliver the message wrapped in bracketed-paste markers (
ESC[200~ … ESC[201~) so the TUI treats it as one pasted block and the trailing CR is an unambiguous submit keypress. Both hosted CLIs enable bracketed-paste mode, so the markers are consumed as delimiters (not echoed). The text/Enter split is kept so the CR lands as a distinct PTY read. As a bonus, bracketed paste also stops message content from being interpreted as slash-commands.Validation
Reproduced and fixed against the real CLIs (
codex 0.142.5,claude 2.1.198) driving each in a PTY with the exact 17 KB paste that hung the flow round:AgentOrchestratorBracketedPasteTestsasserts the bracketed wire shape + separate Enter.Notes
SendInputover a connection blip): this hang was reproduced locally with no connection involved. AI-1142's no-delivery-ack weakness is real but separate/lower priority.HandleStopAgent's/exitsplit is left unchanged (a 5-char command, unaffected by the paste race).🤖 Generated with Claude Code