Skip to content

[CLI/TUI] Local file link clicks insert aN;NaNm into the composer; similar fragments appear on shutdown #51316

Todo

Description

@Alek2077

What version of Codex CLI is running?

codex-cli 0.160.0 (verified while preparing these reports).

What subscription do you have?

ChatGPT Plus.

Which model were you using?

Not confirmed for every occurrence.

What platform is your computer?

Linux 6.18.40.1-microsoft-standard-WSL2 x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

VS Code integrated terminal, version 1.139.1 as reported by Codex doctor earlier in this conversation. Ubuntu 22.04 under WSL2. Codex Fullscreen TUI mode.

Codex doctor report

Not attached. Earlier diagnostics were collected inside an execution sandbox and included sandbox-related network failures and unrelated private local state.

What issue are you seeing?

Clicking a local file link in a Codex session consistently inserts the literal text aN;NaNm into the message composer. My intended action is to open the file, not enter any text.

This happens with local paths shown in command output and with a local Markdown file link supplied by Codex. I reproduced it again during preparation of this report: Codex supplied a local file link, I clicked it, and the next message contained exactly aN;NaNm.

Closing Codex with Ctrl+C also produces repeated fragments of this kind. Sometimes I see 2–4 repetitions in sequence, and other times many appear. I do not know what determines when this happens or how many repetitions appear. This shutdown symptom has not been isolated, and I have not established whether it has the same cause as the consistently reproducible link-click behavior.

Exact examples of text appearing after closing sessions:

After closing one session:

51;47;10M51;43;6M51;40;4M51;39;3M51;38;3M35;38;3M

After closing a different session:

51;40;24M

What steps can reproduce the bug?

  1. Run Codex CLI in Fullscreen TUI mode in the VS Code integrated terminal under WSL2.
  2. Ask Codex to display a clickable link to an existing local file, for example [Open example](/absolute/path/to/example.md).
  3. Activate that local file link using the terminal's link-opening gesture.
  4. Observe aN;NaNm inserted into the Codex message composer without typing those characters.

I reproduced this multiple times while preparing the report. The exact raw terminal input bytes have not been captured.

What is the expected behavior?

Opening a local file link should not insert terminal-control fragments or other unintended text into the message composer.

Exiting Codex should also restore terminal input state so subsequent mouse activity does not produce control-sequence fragments at the shell prompt.

Additional information

The visible fragment is consistent with leaked mouse-reporting input, but the root cause is unconfirmed. Please investigate the interaction between VS Code terminal link activation, Codex input parsing, and terminal cleanup on exit.

Related reports:

Private local paths and full session logs are omitted. The reproduction only needs a link to an existing local file.

Activity

  1. added
    bug
    CLI
    windows-os
    TUI
    on Oct 6, 2026
  2. etraut-openai commented on Oct 10, 2026

    @etraut-openai
    Contributor

    (response from codex)

    Investigation note

    High confidence in a Crossterm parser defect; the original VS Code trigger is still unconfirmed.

    Codex 0.160.0 enables SGR mouse reporting in fullscreen. In its pinned Crossterm fork, the Unix readers feed input to the parser byte by byte. For the hypothetical malformed report:

    ESC [ < 0 ; NaN ; NaN m
    

    parse_csi_sgr_mouse waits for M or m, but the reader treats the first N as a completed CSI sequence and clears its buffer. The remaining bytes become ordinary key events: exactly aN;NaNm. This occurs in both the mio and use-dev-tty readers. Relevant public sources:

    A local regression test feeding that sequence reproduced the unexpected Char('a'). A small, bounded exception for the N, Na, and NaN prefixes inside SGR coordinates let the existing parser discard the entire malformed report at M/m, preserving the next real key. Both Unix backend suites passed with that experimental change. Nothing has been shipped for this issue.

    The missing piece is the actual terminal input for the reporter's Ctrl+click. A VS Code 1.139.1 / Codex 0.160.0 / WSL2 test on Ubuntu 26.04 produced only valid numeric reports on ordinary clicks. Opening the file through “Terminal: Open Detected Link” and exiting with Ctrl+C were also clean. That test could not exercise Ctrl+click and did not match the reporter's Ubuntu 22.04, so it does not rule out the report.

    Next step: capture raw terminal input for the exact link-opening gesture using a disposable local file. No account logs or private project paths are needed. If it contains ESC[<...;NaN;NaNm, address it in the Crossterm fork and then update Codex's pin. Do not filter the literal text in the composer. Keep shutdown leakage separate unless a capture establishes the same cause; the tested exit path disabled mouse modes correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CLITUIbugwindows-os

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions