Skip to content

VS Code terminal input freezes when pasting escaped single-line JSON #27405

Description

@xy200303

What issue are you seeing?

When using the Codex VS Code extension terminal/input, pasting a small single-line escaped JSON payload causes the terminal input to freeze or become unresponsive.

The reproducer is only 641 characters, valid JSON, and contains many escaped quotes/backslashes. Local analysis of the payload:

  • 641 chars
  • 84 backslashes
  • 90 quotes
  • single line
  • valid JSON

The issue appears related to paste handling for terminal inputs that arrive either as bracketed paste or as a throttled stream of key events on Windows/VS Code.

Related issue: #25865

What steps can reproduce the bug?

  1. On Windows, open Codex through the VS Code extension terminal/input.
  2. Copy this single-line JSON payload:
{"error":"unsupported image provider \"openai_images\"","ok":false,"result":"{\"message\":\"unsupported image provider \\\"openai_images\\\"\",\"ok\":false,\"state\":{\"assets\":[],\"jobs\":[{\"id\":\"\",\"kind\":\"\",\"status\":\"failed\",\"progress\":100,\"started_at\":\"\",\"completed_at\":\"2026-06-10T14:40:05.065747Z\",\"error\":\"unsupported image provider \\\"openai_images\\\"\"}],\"kind\":\"image\",\"model\":\"\",\"name\":\"leapimage\",\"project_id\":\"image-1781102405061905500\",\"prompt\":\"\",\"provider\":\"leapskill\",\"title\":\"Leap Image\",\"updated_at\":\"2026-06-10T14:40:05.065747Z\"}}","tool":"leapimage_start_task"}
  1. Paste it directly into the Codex terminal input.
  2. Observe that the input freezes or becomes unresponsive.

What is the expected behavior?

The pasted JSON should be accepted without freezing. If rendering/editing the payload directly is expensive, it could be represented using the existing pasted-content placeholder behavior and expanded on submit.

Additional information

Platform:

Microsoft Windows NT 10.0.26200.0 x64

I prepared a focused branch with a possible Rust TUI-side fix:

https://github.com/openai/codex/compare/main...xy200303:fix/vscode-terminal-paste-freeze?expand=1

Commit:

864744904b629ef24c6bbb3b66664d8368a9a079

The proposed direction:

  • Coalesce slower Windows key-event paste streams by widening the Windows paste-burst interval.
  • Use the existing pending_pastes placeholder path for long single-line JSON payloads below the general large-paste threshold.
  • Add regression coverage for explicit structured JSON paste and Windows throttled paste streams.

Local verification:

  • git diff --check passed.
  • just fmt, just fix -p codex-tui, and just test -p codex-tui were attempted but could not run because just is not installed in my local environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingextensionIssues related to the VS Code extensionwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions