Windows Codex Desktop local action executes but closes/resets chat and leaves PowerShell at >> prompt

Open 💬 4 comments Opened Jun 6, 2026 by RaidelRoss
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What happened?

On Windows Codex Desktop, running a configured local environment action executes the command, but the active chat closes/resets as if a new chat was being created.

This happens even when the action command only starts an external terminal wrapper. The external terminal opens and the command runs, but Codex Desktop still closes/resets the active chat.

The integrated terminal is left at a PowerShell continuation prompt (>>) after the action is invoked.

Environment

  • OS: Windows
  • Codex Desktop package: OpenAI.Codex_26.602.4764.0_x64__2p2nqsd0c76g0
  • Workspace type: Windows local filesystem
  • Shell shown by the action terminal: Windows PowerShell
  • Project local environment file: .codex/environments/environment.toml

Reproduction

Configure an action like this:

[[actions]]
name = "Test : External Terminal"
icon = "run"
command = "scripts\\codex-external-test.cmd"

With this wrapper:

@echo off
setlocal

pushd "%~dp0\.." || exit /b 1
start "Codex External Test" powershell -NoExit -NoProfile -Command "Write-Host 'Codex external terminal action test'; npm run test"
popd

Then click the action in Codex Desktop.

Expected behavior

The configured action should run and the current Codex chat/thread should remain open.

Actual behavior

  • The external terminal opens.
  • The command runs successfully.
  • Codex Desktop closes/resets the current chat UI.
  • The integrated terminal shows the action invocation and then gets left at >>:
PS <workspace>> Set-Location -LiteralPath '<workspace>/.'; scripts\codex-external-test.cmd
PS <workspace>>
>>

If the action is changed to append ; exit, the chat still closes/resets, but the terminal disappears quickly and the command is not visible in the integrated terminal.

Local investigation

Manual execution of npm run test from the Codex shell works and does not close the chat. The test command exits successfully.

The failure appears tied to the Codex Desktop local action runner / integrated terminal handling on Windows, not to the npm command, TOML parsing, or the wrapper script.

Inspection of the installed Desktop package shows local environment/action UI assets in app.asar, and the package includes node-pty / ConPTY helpers such as conpty_console_list_agent. This looks related to other Windows terminal/action issues around node-pty and AttachConsole failed.

Related issues

  • #25272
  • #19629
  • #21731
  • #25372

View original on GitHub ↗

4 Comments

github-actions[bot] contributor · 2 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #25372
  • #25325

Powered by Codex Action

RaidelRoss · 2 months ago

Thanks. I reviewed the suggested duplicates.

This issue may be related to #25372 / #25325, but I think it is still useful to keep it open because the behavior changed in a newer Codex Desktop build:

  • In my current version, the old visible AttachConsole error dialog no longer appears.
  • The local action still executes successfully.
  • The active chat still closes/resets.
  • The integrated PowerShell terminal is left at the >> continuation prompt.
  • This reproduces on Codex Desktop package OpenAI.Codex_26.602.4764.0_x64__2p2nqsd0c76g0.

So this may be the same root cause, but the current user-visible failure mode is different.

kbaquri · 1 month ago

I can reproduce this on a newer Windows Codex Desktop build as well.

Environment:

  • OS: Windows
  • Codex Desktop package: OpenAI.Codex_26.623.9142.0_x64__2p2nqsd0c76g0
  • App-server reported version: 0.142.4
  • Workspace type: local Windows project
  • Shell/action command shape: PowerShell action that runs a project script to start a local Next.js dev server, e.g. powershell -NoProfile -ExecutionPolicy Bypass -File <repo>\scripts\start-local-server.ps1 -Port 3000

Observed behavior:

  • Clicking the Environment action play button to run the local server switches/closes the current Codex chat thread and opens a new chat/thread in the same project.
  • The server command itself can run, but the active working context is lost from the UI.
  • Closing the local-server terminal from inside Codex also switches/closes the active thread and opens a new thread.
  • Tried changing the action to a separate launcher/wrapper approach; it did not solve the thread switching, so this appears tied to Codex Desktop action/terminal handling rather than the specific server script.

Expected behavior:

  • The Environment action should run the configured command without replacing or closing the currently active chat thread.
  • Closing the action terminal should return to or preserve the same thread context.

Impact:
This makes Environment actions hard to use for local dev servers because starting/stopping the server interrupts the active coding conversation.

Ali229 · 1 month ago

Extremely annoying that my chat is closed, even though the run is to test the things changed in the current chat.