[Desktop terminal] Multiline paste into child TUI is emitted as Enter-separated input despite DECSET 2004

Open 💬 0 comments Opened Jul 17, 2026 by MumuTW

Summary

The Codex desktop embedded terminal appears to deliver some multiline Cmd+V pastes to a child TUI without bracketed-paste markers, even though the child enables DEC private mode 2004. The embedded program then receives line endings as ordinary Enter/CR key events.

This was observed while running omp inside the Codex desktop terminal: one pasted block became many independent one-line prompt submissions. The downstream omp report, including its defensive-hardening options, is:

Environment

  • Codex desktop: 26.715.21425 (com.openai.codex, build 5488)
  • macOS: 26.5.2 (25F84)
  • Child TUI: omp/17.0.2
  • TERM=xterm-256color
  • Direct embedded PTY; no tmux/zellij

Steps to reproduce

  1. Open the Codex desktop embedded terminal.
  2. Launch omp.
  3. Start an agent turn so the TUI remains active.
  4. Copy a multiline text block containing many physical lines.
  5. Paste with Cmd+V and press Enter once.
  6. Observe that the block may be submitted one physical line at a time rather than appearing as one multiline draft.

A /btw side-channel panel was used before the first observed occurrence, but it is not yet proven to trigger the problem. A useful isolation test is a fresh-process before/after comparison around /btw.

Actual behavior and evidence

Without exposing the prompt contents, omp's persistent history metadata recorded:

  • 23 distinct single-line prompt rows in one second.
  • A later occurrence with 11 distinct single-line prompt rows in one second, in the same omp process.

The first line started a request and the remaining lines landed as independent steering messages. The omp log simultaneously recorded multiple scheduled-continue AgentBusyError warnings, consistent with a burst of separate submit events.

This proves the split occurred at or before TUI input handling, not during model processing or message rendering.

Expected behavior

After the child program enables bracketed paste with CSI ? 2004 h, a terminal paste should reach the PTY as one payload wrapped in:

ESC [ 200 ~
<pasted multiline text>
ESC [ 201 ~

Embedded CR/LF characters must remain paste content, not ordinary Enter keypresses.

Boundary analysis

omp v17.0.2 enables DECSET 2004 on terminal startup:

https://github.com/can1357/oh-my-pi/blob/v17.0.2/packages/tui/src/terminal.ts#L609-L610

Its normal bracketed-paste path preserves the block. The observed one-submit-per-line behavior is consistent with the desktop terminal sending the text as raw printable characters plus CRs, or losing mode 2004 before Cmd+V.

omp can add a fallback heuristic, but the terminal host should still preserve DECSET 2004 state and wrap its native Cmd+V paste action correctly.

Suggested diagnostics

  • Log the terminal emulator's current mode-2004 state immediately before Cmd+V.
  • Inspect the bytes sent into the child PTY and verify whether ESC[200~ / ESC[201~ are present.
  • Compare a fresh terminal before and after opening/dismissing a side-channel/live panel in the child TUI.
  • Verify that a child repeatedly writing CSI ? 2004 h cannot have the mode silently reset by an embedded-terminal repaint, focus, or session lifecycle event.

Related

View original on GitHub ↗