Skip to content

Stdout from an interrupted “Ran command” is visible in the UI but missing from model context #35735

Description

@luckyabsoluter

What issue are you seeing?

When a shell command running through the Codex is interrupted, any output produced before the interruption remains visible in the “Ran command” UI.

However, that output is not included in the tool result returned to the model. The model receives only the elapsed time and interruption status, so it cannot inspect stdout or stderr that is still visible to the user.

In the controlled reproduction below, the user could see the incrementing numbers in the UI, but Codex received only:

Wall time: 9.5 seconds
aborted by user

None of the stdout produced before the interruption was available in the model context.

What steps can reproduce the bug?

  1. Open a Codex conversation
  2. Ask Codex to run the following PowerShell command:
$counter = 1

while ($true) {
    Write-Output $counter
    $counter++
    Start-Sleep -Seconds 1
}
  1. Interrupt the command after several seconds.
  2. Confirm that 1, 2, 3, and subsequent values appear in the “Ran command” output.
  3. Ask Codex whether it can read the numbers printed before the interruption.
  4. Observe that Codex can see only the elapsed time and aborted by user, not the stdout displayed in the UI.

What is the expected behavior?

Stdout and stderr emitted before a command is interrupted should be preserved in the model-visible tool result, followed by the interruption status.

Normal output truncation would be acceptable, but interrupting a command should not discard all output emitted before the interruption.

The user and the model should have access to the same captured command output.

Additional information

Local Codex CLI: codex-cli 0.145.0

This issue occurs regardless of whether Codex is used through the CLI, the VS Code extension, or the app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIappIssues related to the Codex desktop appbugSomething isn't workingextensionIssues related to the VS Code extensiontool-callsIssues related to tool callingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions