Skip to content

[Bug]: Orca process (and spawned Codex/agent children) keeps running after window close, blocking clean relaunch #3191

Closed

Description

@mubeda

Operating system

Windows 11

Orca version

1.4.33.0

Details

Summary

On Windows, closing the Orca window does not fully terminate the app. The main
process and/or spawned child processes (the codex CLI, Node helpers, terminal/PTY
processes) keep running in the background. Relaunching while a stale instance is
alive leads to overlapping state writes (see the primary issue) and, in some cases,
a new window that doesn't behave as a clean start.

Steps to reproduce

Run a Codex agent / start a task in Orca on Windows.
Close the Orca window with the X.
Open Task Manager (or Get-CimInstance Win32_Process -Filter "Name LIKE '%orca%' OR Name='codex.exe'").

Actual behavior
One or more Orca / codex / Node / PTY processes remain running after the window
is closed. They are not cleaned up and must be killed manually (taskkill /T) to get
a fully clean relaunch.
Expected behavior

Closing/quitting Orca should terminate the full process tree it owns (main +
spawned agent/terminal children), or
If background runs are intentionally kept alive, provide a clear "Quit Orca" action
and an indicator that background agent processes are still running, plus a reliable
way to stop them all.

Notes

This is consistent with a documented Codex-on-Windows lifecycle problem: the UI window
closes but background processes remain, blocking relaunch, recoverable only by killing
the leftover processes in Task Manager.

Because Orca manages the Codex runtime (codex-runtime-home), this lifecycle bug is
likely the trigger for the duplicate-[hooks.state] corruption in the primary issue.
Issue #3190

Activity

  1. added
    bug
    on May 29, 2026
  2. nwparker commented on May 29, 2026

    @nwparker
    Contributor

    I checked the shutdown path while fixing #3190. Current code intentionally does not kill the terminal daemon and its sessions during normal app quit: will-quit calls disconnectDaemon(), whose comment says the daemon survives app quit so sessions can warm-reattach on next launch. It does still call killAllPty() for the legacy/local provider, and Windows window-all-closed should call app.quit() after the last window closes.

    So there are two different cases to separate:

    • Expected/current behavior: codex.exe, node-pty children, or daemon-owned terminal sessions remain after closing the window because Orca detached from the daemon instead of terminating sessions. This needs a product change such as a visible background-session indicator plus a “Quit and stop all sessions” command.
    • Bug: the Electron main Orca process itself remains after window-all-closed / quit. That should not happen, and we need process evidence to identify what will-quit is waiting on.

    #3196 fixes the deterministic config corruption path from #3190 by making the managed Codex trust writer self-heal duplicate [hooks.state."..."] blocks. For this lifecycle issue, could you add a Task Manager / PowerShell capture with command lines after closing the window, e.g. the output of:

    Get-CimInstance Win32_Process | Where-Object { $_.Name -like "*orca*" -or $_.Name -eq "codex.exe" -or $_.CommandLine -like "*codex-runtime-home*" } | Select-Object ProcessId,ParentProcessId,Name,CommandLine

    The key detail is whether the surviving process is the Orca Electron main process, the daemon process, or daemon-owned agent/PTY children.

  3. added
    size/m
    on Jun 9, 2026
  4. OrcaWin commented on Jul 10, 2026

    @OrcaWin
    Collaborator

    Reproduced the process split on Windows against current main at 506f6ffbb (Orca 1.4.133) with a real isolated Electron/ConPTY session.

    Observed process evidence:

    {"ptyId":"c5142737-d9a4-4fd9-9649-d71c5210ee28::C:/Users/neil/AppData/Local/Temp/orca-e2e-repo-4gWSC1@@65b5fd01","terminalPid":9632,"foreground":"pwsh.exe","daemonTerminalSurvived":true}

    Sequence:

    1. Opened a real terminal and captured its daemon management session/PID.
    2. Clicked Orca's title-bar Close button.
    3. Verified the isolated Electron main process exited.
    4. Waited one second and verified terminal PID 9632 was still alive.
    5. The E2E fixture then explicitly terminated the isolated daemon/session during cleanup.

    So current behavior separates cleanly:

    • Not reproduced: the Orca Electron main process remaining after window close.
    • Reproduced: daemon-owned terminal/agent children remain after the app exits. Current code and the E2E cleanup helper explicitly describe this as intentional warm-reattach behavior.

    This needs a product decision rather than a process-kill bug fix in the existing quit path. Reasonable options/trade-offs:

    • Keep warm reattach: fastest relaunch/session continuity, but Task Manager still shows Orca-owned background processes and users need a clear indicator/stop action.
    • Make window close stop all sessions: simplest process model, but closing the UI destroys running agents/terminals.
    • Preserve current X behavior and add a prominent Quit and stop all sessions command: keeps background work possible while giving users deterministic full shutdown.

    Can the reporter confirm whether a current Orca Electron main process still survives on 1.4.133+, or whether the remaining entries are only daemon/terminal/agent processes? If it is only the latter, I recommend tracking the explicit quit/indicator UX as the resolution and treating the original main-process leak as not currently reproduced.

  5. OrcaWin commented on Jul 10, 2026

    @OrcaWin
    Collaborator

    I think is intentional @Jinwoo-H ?
    But we should give users a way to completely exit... maybe via a tray icon?

  6. OrcaWin commented on Jul 10, 2026

    @OrcaWin
    Collaborator

    Closing as current intended behavior rather than a process leak: Orca's Electron main process exits, while daemon-owned terminal sessions survive briefly so they can be warmly reattached on relaunch. The reproduced process tree matches that design.

    If the desired behavior is to terminate every session on exit, please open a feature request referencing #3191 for either a stop-on-close preference or an explicit Quit and stop all sessions action, including the user-facing trade-off you prefer.

  7. added theissue type on Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugos:Windowssize/m

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions