Skip to content

MCP reload triggers a false OSC 7501 completion in Codex #62977

Open

Description

@hikionori

What version of Codex CLI is running?

Stock Codex CLI 0.171.0.

What subscription do you have?

The reproduction uses local fixtures and does not require a subscription.

Which model were you using?

A local Responses API fixture. The reload itself makes no model request.

What platform is your computer?

macOS 27.2.1, Apple Silicon (Darwin 27.2.0 arm64 arm).

What terminal emulator and version are you using?

I reproduced the visible symptom in Herdr Desktop and captured Codex's raw OSC 7501 output independently in a script-driven PTY.

What issue are you seeing?

A successful MCP configuration reload changes Codex's OSC 7501 state even when no new turn starts.

State before reload Observed OSC 7501 states during and after reload
Idle idle → working → idle
Previous result still unseen done → working → done

Neither reload made a model request. Herdr Desktop can display an unread completion after these transitions. In the idle case, Herdr's completion counter can advance even though the last raw state is idle. See herdrdev/herdr-app#641 and the Herdr investigation and test results.

What steps can reproduce the bug?

  1. Use a temporary CODEX_HOME with one local stdio MCP server. Start codex app-server --listen unix:///tmp/codex-repro.sock.
  2. Attach the TUI with codex --remote unix:///tmp/codex-repro.sock in a PTY that captures OSC 7501. Wait for MCP startup to settle.
  3. From a second initialized app-server connection, send {"id":2,"method":"config/mcpServer/reload"}. Watch the MCP startup notifications and OSC status.
  4. Complete one turn. Repeat step 3 before sending any input to acknowledge the result in the TUI.

What is the expected behavior?

An MCP-only reload should preserve idle or an already reported done. A genuine turn should still report working and then done.

Additional information

update_task_running_state() uses the bottom pane's busy flag for both user work and MCP startup. desired_program_status() then uses that same flag to report Working to the terminal. When startup finishes, it reports the prior state again. This also occurs when the reload settles successfully. See the busy flag and the terminal status calculation.

A local fix removes the unconditional bottom_pane.is_task_running() check from desired_program_status(). The existing is_user_turn_pending_or_running() check already excludes MCP-only startup and tracks pending and active foreground work. The bottom pane still displays startup progress. See the existing turn activity check.

On 1145028 with this change, all 60 targeted TUI tests passed locally. The regression checks cover Idle and Done across MCP startup and Working during an active turn, a pending shell command, and pending compaction. The PTY trace above is from the stock CLI.

cargo nextest run --locked -p codex-tui --lib --no-fail-fast -E 'test(mcp_startup) | test(program_status)'

Related Codex issue #59937 covers a startup round that never settles after reconnect. This report reproduces a false completion after the reload finishes.

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal display
    mcpIssues related to the use of model context protocol (MCP) servers
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLITUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't workingmcpIssues related to the use of model context protocol (MCP) servers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions