Skip to content

Windows desktop: bundled codex.exe app-server repeatedly killed with 0xC000013A (STATUS_CONTROL_C_EXIT) mid-turn; app broadcasts fatal_error_broadcasted and restarts #36778

Open

Description

@Mitsukiyukiii

Summary

On Windows, the Codex desktop app repeatedly loses its bundled codex.exe app-server: the backend process is killed with exit code 3221225786 (0xC000013A, STATUS_CONTROL_C_EXIT) in the middle of an active turn, the app logs [AppServerConnection] Codex CLI process exited classifiedAsExpected=false followed by fatal_error_broadcasted, shows the crash/restart experience, and spawns a new backend. This repeated several times within minutes during normal interactive use.

The exit code indicates the backend received a console control event (Ctrl-C / console close / taskkill without /F) rather than faulting on its own — i.e. something in the desktop app's process management appears to be killing its own app-server. Electron breadcrumbs show the main process spawning taskkill.exe (exit 128) and git.exe (exit 1) in a repeating ~20–30 s cleanup cycle around the deaths.

Environment

  • Codex desktop (MSIX): OpenAI.Codex_26.727.6591.0_x64 — latest available at time of report
  • App-managed CLI/backend: codex-cli 0.146.0-alpha.9.2; app release tag codex@26.727.51351
  • Bundled Chromium: 150.0.7871.182
  • Windows 11 Pro 10.0.26200

Timeline (2026-08-03, from ~/.codex/logs_2.sqlite logs table, local time)

Backend (app-server) process generations, each spawned by the desktop app:

generation first log last log how it ended
gen 1 17:37:27 17:39:20 abrupt — last rows are routine account/read handling; no shutdown sequence
gen 2 17:39:28 17:41:07 abrupt — died while actively streaming item/commandExecution/outputDelta events (1/s); killed at 17:41:09 with 0xC000013A
gen 3 17:41:13 — respawned by the app

There is no shutdown logging, no Windows Error Reporting event, and the Crashpad database is empty for these deaths — consistent with external termination via console control rather than a native fault.

Sentry scope breadcrumbs (.../LocalCache/Roaming/Codex/web/Codex/sentry/scope_v3.json) around the gen-2 death:

17:40:26 warning child_process  Child process exited with code '128'  spawnfile=C:\WINDOWS\System32\taskkill.exe
17:40:27 warning child_process  Child process exited with code '1'    spawnfile=C:\Program Files\Git\cmd\git.exe
17:40:27 warning child_process  Child process exited with code '128'  spawnfile=C:\WINDOWS\System32\taskkill.exe
17:41:09 warning child_process  Child process exited with code '3221225786'  spawnfile=...\app\resources\codex.exe
17:41:09 error   console        [AppServerConnection] Codex CLI process exited classifiedAsExpected=false code=3221225786 connectionId=4 signal=null transport=stdio
17:41:09 error   console        [AppServerConnection] fatal_error_broadcasted errorMessage="  (code=3221225786, signal=null). ..."

The git.exe + taskkill.exe (exit 128 = no matching process) pair from the main process repeats at 17:46:58, 17:47:17, 17:47:46, 17:47:56.

Earlier the same morning the UI itself hung: Windows Event Log ID 1002 The program ChatGPT.exe version 150.0.7871.182 stopped interacting with Windows and was closed plus two MoAppHang WER events (17:01 UTC).

Troubleshooting already ruled out

Expected behavior

  • The desktop app's cleanup/cancel path should never deliver a console control event (or taskkill) to its own app-server process.
  • If the backend does die, the exit should be classified and recovered gracefully (resume the thread) instead of broadcasting a fatal error to the UI.

Related issues

#16271, #21761, #31353, #32334, #33762, #27741, #29237

Activity

  1. added
    bugSomething isn't working
    appIssues related to the Codex desktop app
    windows-osIssues related to Codex on Windows systems
    app-serverIssues involving app server protocol or interfaces
    on Aug 3, 2026
  2. github-actions commented on Aug 3, 2026

    @github-actions
    Contributor

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

    Powered by Codex Action

  3. Mitsukiyukiii commented on Aug 3, 2026

    @Mitsukiyukiii
    Author

    Reviewed #35782 for the duplicate flag - not a duplicate, though likely a sibling in the same app-server lifecycle area. #35782 reports the app-server disconnecting under concurrent load (EPIPE, IAB window-lifecycle errors) followed by termination of the entire desktop window after a recovery attempt, with no exit code identified. This issue documents a different mechanism: the bundled app-server being killed with 0xC000013A (STATUS_CONTROL_C_EXIT) mid-turn - implicating the desktop app's own cleanup/taskkill cycle - while the app itself survives and respawns the backend, broadcasting fatal_error_broadcasted each time. Keeping this open so the exit-code evidence stays actionable; happy to consolidate if maintainers determine a shared root cause.

  4. truemanandy168-cmyk commented on Aug 21, 2026

    @truemanandy168-cmyk

    Independent reproduction on a newer Windows Desktop build, with a deterministic trigger and a verified local mitigation.

    Environment

    • Windows 11 x64
    • Codex Desktop MSIX: 26.818.3698.0
    • Bundled app-server: 0.149.0-alpha.4
    • Native PowerShell
    • Desktop host remained alive; only bundled codex.exe app-server exited and was respawned.

    Observed behavior

    On 2026-08-21 the app-server exited repeatedly with:

    code=3221225786
    0xC000013A / STATUS_CONTROL_C_EXIT
    classifiedAsExpected=false
    fatal_error_broadcasted
    

    At least 12 matching exits were recorded during one workday. There were no corresponding Windows Error Reporting, Defender, or resource-exhaustion events.

    The latest affected generation started at 17:34:40 local time and exited at 17:36:47. The surfaced “Most recent error” was:

    Custom tool call output is missing for call id: <redacted>
    

    The desktop then spawned another app-server generation.

    Deterministic local trigger

    A Python test launched from a Codex tool call used this POSIX liveness idiom:

    os.kill(pid, 0)

    On Windows this can route through GenerateConsoleCtrlEvent / CTRL_C_EVENT. In the Desktop Code Mode console domain it can terminate both the tool process and the shared app-server, yielding exactly 0xC000013A. This matches the corrected reproduction already documented in #32653.

    The first kill also left an unmatched custom tool call. Resuming the affected task then hit the “Custom tool call output is missing” path, creating a secondary restart loop.

    Verified mitigation

    The Windows liveness probe was replaced with a non-signaling Win32 query:

    • OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION)
    • GetExitCodeProcess
    • compare with STILL_ACTIVE
    • CloseHandle

    The same complete local self-test then finished successfully:

    positive: 6/6
    negative: 48/48
    exit code: 0
    

    No app-server restart occurred during the corrected run.

    Additional Desktop override evidence

    Adding this to config.toml:

    [features]
    unified_exec = false

    correctly disables the feature in a standalone CLI query, but Desktop re-enables it after startup. Desktop logs show:

    Features enabled enabledFeatures="unified_exec, ..."
    source=statsig-layer
    experimentalFeature/enablement/set
    

    and app-server turn diagnostics still contain UnifiedExec.

    Requested fixes

    1. Isolate the app-server from child process console control events on Windows.
    2. Never allow a child CTRL_C_EVENT to kill the shared app-server.
    3. Persist an explicit aborted/error tool output atomically when a tool process is interrupted.
    4. Recover or quarantine a task containing an unmatched tool call instead of killing the shared app-server.
    5. Respect a local unified_exec = false safety override in Desktop, or provide a supported Windows fallback switch.

    This comment omits account details, local paths, prompts, auth data, and call IDs.

  5. Imagineer99 commented on Aug 30, 2026

    @Imagineer99

    I’m seeing the same Windows Codex Desktop failure when enabling a local stdio MCP server.

    The MCP server authenticates and initializes successfully, but Codex then repeatedly restarts its backend with exit code 3221225786 (0xC000013A), classifiedAsExpected=false, followed by fatal_error_broadcasted.

    Disabling that MCP server and relaunching Codex stops the restarts. Re-enabling it reproduces the problem.

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

    appIssues related to the Codex desktop appapp-serverIssues involving app server protocol or interfacesbugSomething isn't workingwindows-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