Skip to content

Windows: app-server daemon start fails with Job Object error on a Modern Standby system #44503

Closed

Description

@gologames

What version of Codex CLI is running?

codex-cli 0.154.0 (standalone installation)

What subscription do you have?

ChatGPT Pro (20x)

Which model were you using?

N/A — failure occurs during daemon startup, before model interaction.

What platform is your computer?

Windows 11 Professional, build 10.0.26200, x64. Modern Standby supported; DAM is running.

What terminal emulator and version are you using (if applicable)?

Windows Console Host (conhost.exe) 10.0.26100.8875; Windows PowerShell (powershell.exe file version 10.0.26100.8875); also reproduced with -NoProfile; no multiplexer.

Codex doctor report

{
  "schemaVersion": 1,
  "generatedAt": "1789037897s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.154.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "C:\\Users\\<USER>\\.codex\\app-server-control\\app-server-control.sock",
        "daemon state dir": "C:\\Users\\<USER>\\.codex\\app-server-daemon",
        "mode": "ephemeral",
        "pid file": "C:\\Users\\<USER>\\.codex\\app-server-daemon\\app-server.pid (missing)",
        "settings": "C:\\Users\\<USER>\\.codex\\app-server-daemon\\settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "C:\\Users\\<USER>\\.codex\\app-server-daemon\\app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "C:\\Users\\<USER>\\.codex\\auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "C:\\Users\\<USER>\\.codex",
        "active thread overrides": "not inspected",
        "config.toml": "C:\\Users\\<USER>\\.codex\\config.toml",
        "config.toml parse": "ok",
        "configuration load ms": "5",
        "configuration scope": "invocation config, including cloud-managed policy",
        "cwd": "C:\\Users\\<USER>",
        "enabled feature flags": "<redacted>",
        "feature flag overrides": "prevent_idle_sleep=true",
        "feature flags enabled": "50",
        "log dir": "C:\\Users\\<USER>\\.codex\\log",
        "mcp servers": "5",
        "model": "gpt-6-astra",
        "model provider": "openai",
        "sqlite home": "C:\\Users\\<USER>\\.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "desktop.app.version": {
      "id": "desktop.app.version",
      "category": "desktop",
      "status": "ok",
      "summary": "the desktop application is installed",
      "details": {
        "log directory": "$HOME\\AppData\\Local\\Codex/Logs",
        "running": "false",
        "version": "26.901.6511.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "desktop.app_server.handshake": {
      "id": "desktop.app_server.handshake",
      "category": "desktop",
      "status": "ok",
      "summary": "the desktop application is not running",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "desktop.security.enforcement": {
      "id": "desktop.security.enforcement",
      "category": "desktop",
      "status": "ok",
      "summary": "no locally visible recent Codex security enforcement was found",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git executable found; execution not verified",
      "details": {
        "PATH git #1": "C:\\Program Files\\Git\\cmd\\git.exe",
        "PATH git entries": "1",
        "git execution": "not inspected (PATH helpers are not executed)",
        "repo detected": "false",
        "selected git": "C:\\Program Files\\Git\\cmd\\git.exe"
      },
      "remediation": null,
      "durationMs": 8
    },
    "git.worktree.dev_drive": {
      "id": "git.worktree.dev_drive",
      "category": "git",
      "status": "ok",
      "summary": "no Git worktree is active",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "C:\\Users\\<USER>\\AppData\\Local\\Programs\\OpenAI\\Codex\\bin\\codex.exe",
        "current executable": "C:\\Users\\<USER>\\AppData\\Local\\Programs\\OpenAI\\Codex\\bin\\codex.exe",
        "install context": "standalone (windows, package C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases\\0.154.0-x86_64-pc-windows-msvc, bin C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases\\0.154.0-x86_64-pc-windows-msvc\\bin, resources C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases\\0.154.0-x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases\\0.154.0-x86_64-pc-windows-msvc\\codex-path)",
        "managed by Vite+": "false",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed by pnpm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 6
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "5",
        "disabled servers": "2",
        "stdio servers": "3",
        "streamable_http servers": "2"
      },
      "remediation": null,
      "durationMs": 338
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "managed proxy": "not configured",
        "proxy env vars": "none",
        "respect system proxy": "disabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT inference URL": "https://chatgpt.com/backend-api/<redacted> reachable (HTTP 405)",
        "desktop assets CDN": "https://persistent.oaistatic.com/codex-app-prod/<redacted> reachable (HTTP 200)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 327
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv6",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 784
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running standalone on windows-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "C:\\Users\\<USER>\\AppData\\Local\\Programs\\OpenAI\\Codex\\bin\\codex.exe",
        "install method": "standalone (windows, package C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases\\0.154.0-x86_64-pc-windows-msvc, bin C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases\\0.154.0-x86_64-pc-windows-msvc\\bin, resources C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases\\0.154.0-x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases\\0.154.0-x86_64-pc-windows-msvc\\codex-path)",
        "platform": "windows-x86_64",
        "version": "0.154.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search command found (bundled); execution not verified",
      "details": {
        "search command": "C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases\\0.154.0-x86_64-pc-windows-msvc\\codex-path\\rg.exe",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "denied-read glob rules": "0",
        "denied-read restrictions": "false",
        "denied-read rules": "0",
        "execve wrapper helper": "none",
        "filesystem sandbox": "restricted",
        "glob scan max depth": "unbounded",
        "managed filesystem source": "none",
        "network sandbox": "restricted",
        "sandbox backend": "elevated",
        "sandbox provisioning": "complete"
      },
      "remediation": null,
      "durationMs": 1
    },
    "security.endpoint": {
      "id": "security.endpoint",
      "category": "security",
      "status": "warning",
      "summary": "endpoint protection detected; Codex exclusions are unverified",
      "details": {
        "Codex exclusions": "not verified",
        "endpoint products": "Microsoft Defender",
        "exclusion targets": "signed Codex app; codex.exe; codex-windows-sandbox-setup.exe; codex-command-runner.exe; codex-code-mode-host.exe"
      },
      "issues": [
        {
          "severity": "warning",
          "cause": "Microsoft Defender can interfere with Codex. Verify Codex exclusions.",
          "measured": "not verified",
          "expected": "Codex application and helper exclusions",
          "remedy": "Microsoft Defender: Add a certificate or executable-path exclusion for Codex and its helpers. If Attack Surface Reduction blocks Codex, add a rule exclusion. If Controlled Folder Access blocks Codex, allow the app.",
          "fields": [
            "Codex exclusions"
          ]
        }
      ],
      "remediation": "ask your security administrator to verify Codex exclusions and required helper allowances",
      "durationMs": 24
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "C:\\Users\\<USER>\\.codex (dir)",
        "active rollout files": "394 files, 6921941893 total bytes, 17568380 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "C:\\Users\\<USER>\\.codex\\goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "C:\\Users\\<USER>\\.codex\\logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "C:\\Users\\<USER>\\.codex\\log (dir)",
        "memories DB": "C:\\Users\\<USER>\\.codex\\memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "queue DB": "C:\\Users\\<USER>\\.codex\\queue_1.sqlite (file)",
        "queue DB integrity": "ok",
        "sqlite home": "C:\\Users\\<USER>\\.codex (dir)",
        "standalone release cache": "1 entries in C:\\Users\\<USER>\\.codex\\packages\\standalone\\releases",
        "state DB": "C:\\Users\\<USER>\\.codex\\state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "C:\\Users\\<USER>\\.codex\\thread_history_1.sqlite (file)",
        "thread history DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 1252
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "ok",
      "summary": "rollout files and state DB thread inventory agree",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "394",
        "rollout DB active rows": "394",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "0",
        "rollout DB archived rows": "0",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=394",
        "rollout DB rows": "394",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "cli=206, subagent:other=181, vscode=4, exec=2, subagent:thread_spawn=1",
        "rollout DB stale rows": "0"
      },
      "remediation": null,
      "durationMs": 160
    },
    "system.disk": {
      "id": "system.disk",
      "category": "disk",
      "status": "ok",
      "summary": "sufficient free disk space (1064.2 GiB)",
      "details": {
        "CODEX_HOME available": "1064.2 GiB",
        "failure threshold": "1.0 GiB",
        "warning threshold": "5.0 GiB",
        "worktree available": "1064.2 GiB"
      },
      "remediation": null,
      "durationMs": 0
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language en-US",
      "details": {
        "EDITOR": "not set",
        "VISUAL": "not set",
        "os": "Windows 10.0.26200 (Windows 11 Professional) [64-bit]",
        "os language": "en-US",
        "os type": "Windows",
        "os version": "10.0.26200"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "WT_SESSION": "present",
        "color output": "disabled (stdout is not a terminal)",
        "console input code page": "850",
        "console output code page": "65001",
        "stderr console mode": "0x00000007 (VT processing: true)",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout console mode": "unavailable",
        "stdout is terminal": "false",
        "terminal": "Windows Terminal",
        "terminal size": "148x43"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title configured",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "cwd",
        "terminal title project value": "<USER>",
        "terminal title source": "configured"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.154.0",
        "check for update on startup": "true",
        "desktop application": "OpenAI.Codex",
        "desktop latest build": "26.903.9818.0",
        "desktop update status": "available",
        "dismissed version": "0.136.0",
        "last checked at": "2026-09-10T09:48:09.822567800Z",
        "latest version": "0.154.0",
        "latest version status": "current version is not older",
        "update action": "standalone installer",
        "version cache": "C:\\Users\\<USER>\\.codex\\version.json"
      },
      "remediation": null,
      "durationMs": 454
    }
  }
}

What issue are you seeing?

Codex CLI 0.154.0 (standalone) cannot start the background server on Windows 11. It reports:

Error: host Job Object prevents daemon detachment; start from a host that allows breakaway

What steps can reproduce the bug?

  1. Open PowerShell as a regular user.

  2. Run:

    codex app-server daemon start
  3. The command fails with the Job Object error.

Also reproduced with PowerShell -NoProfile.

What is the expected behavior?

The background server starts successfully and continues running after the terminal is closed.

Additional information

The error is returned when in_job != 0 in windows.rs.

A separate native probe using CREATE_SUSPENDED | DETACHED_PROCESS | CREATE_BREAKAWAY_FROM_JOB successfully creates and runs a child process. The child remains in a Job Object. Its immediate job has flags 0x1800:

  • BREAKAWAY_OK: enabled
  • SILENT_BREAKAWAY_OK: enabled
  • KILL_ON_JOB_CLOSE: disabled

The machine supports Modern Standby, and Desktop Activity Moderator (DAM) is running. DAM may explain why the process remains in a job, but this has not been confirmed.

Activity

  1. added
    CLIIssues related to the Codex CLI
    windows-osIssues related to Codex on Windows systems
    app-serverIssues involving app server protocol or interfaces
    on Sep 10, 2026
  2. 84dnnvbdvp-debug commented on Sep 10, 2026

    @84dnnvbdvp-debug

    One distinction seems important before treating IsProcessInJob(...)=TRUE as proof that this host cannot support a daemon.

    Current ensure_detached_launch() already launches the probe with CREATE_BREAKAWAY_FROM_JOB, then rejects it solely because the child is still in some job. Windows' nested-job rules explicitly allow a breakaway child to leave the immediate job and successive parents only until it reaches a parent that does not permit breakaway: https://learn.microsoft.com/en-us/windows/win32/procthread/nested-jobs. So residual membership after a successful CREATE_BREAKAWAY_FROM_JOB is a valid nested-job outcome, not by itself evidence that the child's lifetime is still coupled to the launcher.

    The useful next discriminator may be lifecycle rather than membership: with the same native probe, let the launcher exit and verify from a separate observer whether the child actually survives. Pair that with a control where the residual job has JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, which Microsoft documents as terminating associated processes when the last job handle closes: https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects. If the Modern Standby/DAM case remains in_job != 0 but survives launcher/terminal exit, the current guard is rejecting a benign residual association. If it dies, the existing refusal is doing real work and the remaining job/ancestor limits are the place to inspect.

    That regression would also avoid assuming KILL_ON_JOB_CLOSE is the only relevant limit; jobs can impose other constraints. The narrower claim is just that IsProcessInJob(NULL) answers membership, while the daemon requirement is really about whether the residual job chain makes independent lifetime unsafe.

  3. etraut-openai commented on Sep 10, 2026

    @etraut-openai
    Contributor

    (response written by codex)

    Thanks for the detailed report. The current code rejects a child that remains in any Job Object, both during the launch probe and after the actual daemon starts. Windows permits residual job membership after breakaway, so that check alone doesn’t establish that the daemon cannot survive terminal closure.

    Could you share the native probe source and check whether its child survives both launcher exit and closing the terminal, using a separate observer? The reported 0x1800 flags describe the immediate job; they don’t rule out restrictions in ancestor jobs.

    That would help confirm whether we’re rejecting a harmless system-managed job and provide a regression case. DAM is a plausible explanation, but its involvement is still unconfirmed.

  4. hdegani17 commented on Sep 17, 2026

    @hdegani17

    I am also affected by this on Windows x64 with the official standalone Codex CLI 0.154.0 (tested on 2026-09-16).

    Running codex agents fails with:

    Error: host Job Object prevents daemon detachment; start from a host that allows breakaway
    

    The error also occurs in an independent PowerShell window opened from the Windows Start menu. Command resolution was checked: the standalone codex.exe takes precedence over the older npm installation, and codex --version reports codex-cli 0.154.0. codex doctor found the standalone installation consistent.

    Additional diagnostic observations:

    • Modern Standby (S0 Low Power Idle) is supported and the DAM service is running. This does not establish that DAM causes the failure.
    • A read-only native Windows API probe reported immediate job flags 0x1800: BREAKAWAY_OK and SILENT_BREAKAWAY_OK enabled, KILL_ON_JOB_CLOSE disabled.
    • Diagnostic child processes created with CREATE_SUSPENDED | DETACHED_PROCESS | CREATE_BREAKAWAY_FROM_JOB were created successfully but still reported Job Object membership. The suspended diagnostic children were then terminated; this was not a lifecycle/survival test.
    • I have not established the restrictions of all ancestor jobs or whether a child survives both launcher exit and terminal closure. These results therefore do not prove that the residual job association is harmless.

    Starting a foreground server with codex app-server --listen ws://127.0.0.1:48763 and connecting with codex agents --remote ws://127.0.0.1:48763 works on this machine. This is only a workaround; native daemon startup remains blocked.

    Adding this as another reproduction of the issue. Is there a planned fix or a supported diagnostic procedure to distinguish a benign residual Job Object association from a lifetime restriction, without weakening Windows security settings?

  5. moe-cyborg commented on Sep 17, 2026

    @moe-cyborg

    Additional reproduction

    I can reproduce the same failure on another Windows 11 system.

    Environment

    • Windows: Windows 11 Core, build 22631, 64-bit
    • PowerShell: 7.6.5 (Core)
    • Host: ConsoleHost
    • ChatGPT Desktop: 26.911.7940.0
    • Desktop-bundled Codex CLI: 0.155.0-alpha.2.6
    • Official managed standalone Codex CLI: 0.154.0
    • Modern Standby: supported (S0 Low Power Idle)
    • Shell: ordinary non-administrator PowerShell

    The managed standalone installation is present at:

    C:\Users\<USER>\.codex\packages\standalone\current\bin\codex.exe
    

    and Test-Path returns True.

    Observed behavior

    ChatGPT Desktop has:

    Settings → Connections → Control this PC → Allow connections

    enabled.

    On mobile, Remote pairing fails both by:

    • QR code
    • manual pairing code

    Normal ChatGPT conversation sync works in the same Personal workspace.

    Both Remote daemon entry points fail with the same error.

    Standalone 0.154.0:

    codex app-server daemon bootstrap --remote-control

    Desktop-bundled 0.155.0-alpha.2.6:

    codex remote-control start --json

    Both return:

    Error: host Job Object prevents daemon detachment; start from a host that allows breakaway
    

    This adds a reproduction on Windows 11 build 22631, and confirms that the same Job Object failure occurs with both the official standalone 0.154.0 CLI and the Desktop-bundled 0.155.0-alpha.2.6 CLI.

    In this environment, the daemon startup failure also coincides with the user-visible Remote pairing failure described above.

    I do not have evidence that Modern Standby/DAM is the root cause.

  6. nobodynose1 commented on Sep 24, 2026

    @nobodynose1

    Third independent reproduction — with a session-0 data point that may rule out the DAM hypothesis

    I can reproduce this on another machine and can add a data point that I think argues against the
    Desktop Activity Moderator being the cause.

    Environment

    • Windows 11, build 10.0.26100, x64, OS language zh-CN
    • Modern Standby supported: powercfg /a → Standby (S0 Low Power Idle) - Network connected
    • dam driver present and running (Status = Running, StartType = System)
    • Codex CLI tested: 0.155.0-alpha.16.3 (desktop-bundled) and 0.156.1 (managed daemon package)
    • All runs as a non-elevated user

    Entry points that fail identically

    codex app-server daemon start
    codex app-server daemon bootstrap --remote-control
    codex remote-control start
    

    All three return Error: host Job Object prevents daemon detachment; start from a host that allows breakaway.

    Hosts tried — identical immediate-job flags in every case

    # Launch host Session inJob LimitFlags
    1 Shell inside an agent/IDE job chain 1 True 0x1800
    2 cmd.exe launched by explorer.exe (Start-Process explorer.exe <file>.cmd) 1 True 0x1800
    3 Plain interactive PowerShell 1 True 0x1800
    4 S4U scheduled task, spawned from services.exe 0 True 0x1800

    In all four: BREAKAWAY_OK = true, SILENT_BREAKAWAY_OK = true, KILL_ON_JOB_CLOSE = false.

    Host #4 is the interesting one. It ran in session 0, in the chain
    powershell.exe → powershell.exe → svchost.exe → services.exe → wininit.exe.
    There is no desktop in session 0, so a Desktop Activity Moderator job cannot explain the
    association there — and the flags come out byte-identical to the interactive session.

    Native probe

    Using CREATE_SUSPENDED | DETACHED_PROCESS | CREATE_BREAKAWAY_FROM_JOB (the same combination
    ensure_detached_launch uses), the spawn always succeeds — no ERROR_ACCESS_DENIED — but
    IsProcessInJob(child, NULL, &in_job) returns true in every case. I also tried adding
    CREATE_NEW_PROCESS_GROUP and CREATE_NO_WINDOW; same result. This matches the original report.

    Note the parent's immediate job is 0x1800, i.e. SILENT_BREAKAWAY_OK is already set, yet the child
    is still associated with a job. Combined with the absence of ERROR_ACCESS_DENIED, that reads as
    an unnamed, system-wide job that every process inherits, rather than a session/desktop-scoped one.

    Two other things that may be useful

    1. A clean, empty CODEX_HOME (no config.toml, no auth.json) produces the identical Job
      Object error, confirming the guard is evaluated before any config or provider is loaded.
    2. On the desktop-bundled CLI I first hit a separate
      Error: this CLI has no complete local package; install a packaged Codex CLI or use the standalone installer.
      Installing the daemon package via the installer's CODEX_INSTALL_DAEMON_ONLY=1 path resolved that
      one, but the Job Object error is unaffected. Worth separating if others report both.

    On the proposed survival test

    I'm happy to run a launcher-exit / terminal-close survival test with a separate observer if you can
    describe the observer you'd like. One caveat: the guard appears twice —
    ensure_detached_launch (the suspended probe) and Process::ensure_detached after the real spawn,
    the latter calling self.terminate() before bailing. A survival result would characterise the
    residual job's lifetime, but the launch would still be refused before any daemon survives to be
    observed, unless one of the two guards is relaxed.

  7. SilverKnight95 commented on Sep 25, 2026

    @SilverKnight95

    I can reproduce this issue on Codex CLI 0.157.0 using the npm installation on Windows 11 Pro.

    Environment:

    • Codex CLI: 0.157.0
    • Install method: npm install -g @openai/codex@latest
    • Node.js: 24.19.0
    • npm: 11.17.0
    • Terminal: Windows Terminal / Windows PowerShell

    Reproduction steps:

    1. Launch Codex from an elevated terminal.

      codex.cmd

      Codex correctly refuses to start the daemon:

      Error: start the Windows daemon from a non-elevated terminal; shared clients must not inherit administrator privileges

    2. Open a new non-elevated Windows PowerShell terminal.

    3. Verify that the terminal is not elevated. The administrator-role check returns:

      False

    4. Run:

      codex.cmd

    5. Codex begins installing the daemon:

      Installing daemon from CLI version 0.157.0 into C:\Users<USER>.codex\packages\app-server-daemon...

    6. It then fails with:

      Error: host Job Object prevents daemon detachment; start from a host that allows breakaway

    7. Run the suggested workaround:

      codex.cmd --no-daemon

    Result:

    Codex successfully launches and reaches the Folder Access / "Trust this folder?" screen when using --no-daemon.

    This confirms the Job Object daemon-detachment issue is still reproducible in Codex CLI 0.157.0 with the npm distribution, while the CLI itself works when the background daemon is bypassed.

  8. nobodynose1 commented on Sep 25, 2026

    @nobodynose1

    Relaxing both guards: the daemon does start and register

    Following up on the 0x1800 data point with a direct test of what the guard is actually protecting against.

    Method. I temporarily made both IsProcessInJob checks no-ops with a 2-byte import-table (ILT) edit, redirecting the IsProcessInJob import to GetCurrentProcess — same DLL, takes no arguments, no side effects, returns HANDLE(-1):

    • IsProcessInJob(...) == 0 is never true, so the first check never returns Err
    • the output parameter is never written, so it keeps its initialised 0 and if in_job != 0 { bail! } is never taken

    No code bytes are modified. IsProcessInJob has exactly two call sites in the binary (ensure_detached_launch and Process::ensure_detached), so the spawn / kill() / wait() / terminate() paths are left intact.

    Result. With both guards inert, the daemon starts and registers with the relay. That is the first time any of codex app-server daemon start / codex remote-control start produced a running daemon on this machine — the residual job membership did not tear it down.

    To be precise about what this does and does not show: it is not the observer-based survival test you asked for. I did not separately instrument "launcher exits → terminal closes → is the child still alive". What it does show is that residual job membership is not by itself fatal to the daemon, which is the narrower question of whether that check rejects a benign association.

    Cleanup. This was diagnostic only. The installation has been restored to the unmodified codex.exe, and the patch is version-specific, so I would not suggest it as a workaround.

    A second blocker, probably unrelated. With the daemon up, remote-control still fails to connect:

    wss://chatgpt.com/backend-api/wham/remote/control/server
    IO error: ... (os error 10060)
    
    • Capturing the daemon's TCP endpoints shows SYNs only to chatgpt.com's resolved addresses — none to the configured local proxy (127.0.0.1:7897).
    • HTTPS_PROXY (pointed at a dead port, as a differential) and features.respect_system_proxy=true (both via -c and as a direct process argument) change nothing.
    • In the source these are two separate paths: http-client/src/outbound_proxy.rs carries proxy handling for the main HTTP client, while the remote-control WS builds its own socket in app-server-transport/.../remote_control/websocket.rs.

    On this machine chatgpt.com also resolves into Meta address space (31.13.64.0/18, 2a03:2880::/32), so I cannot currently separate "the WS transport ignores the proxy" from "that path was never exercised because DNS is poisoned". If it reproduces for anyone else, it may deserve its own issue.

  9. daniel-lightfury commented on Sep 25, 2026

    @daniel-lightfury

    Reproduced on Codex 0.157.0, Windows 11 build 26200.

    Occurs in non-elevated PowerShell and WezTerm, including after a full restart.

    Native Windows diagnostics:

    • In Job Object: True
    • Job limit flags: 0x1800
    • Explicit breakaway: True
    • Silent breakaway: True
    • CreateProcess with DETACHED_PROCESS and CREATE_BREAKAWAY_FROM_JOB: succeeds
    • Child remains in Job Object: True
    • WaitForSingleObject: 0

    Codex still reports:
    "host Job Object prevents daemon detachment; start from a host that allows breakaway"

  10. p-poppe commented on Sep 25, 2026

    @p-poppe

    Answering the survival question from @etraut-openai with a native probe (Codex 0.157.0 npm, Windows 11 Pro 26200 x64, Modern Standby, PowerShell 7 — same result from wmux and other hosts).

    Context: the residual 0x1800 job (BREAKAWAY_OK | SILENT_BREAKAWAY_OK, no KILL_ON_JOB_CLOSE) isn't created by the terminal. On this machine explorer.exe, Outlook, Edge, Windows Terminal and sihost.exe are all in it, so every process started from the desktop inherits it.

    Probe: it simulates a terminal that kills its tree on close. The process creates its own job with KILL_ON_JOB_CLOSE | BREAKAWAY_OK (nested under the desktop job), assigns itself to that job, spawns two ping -n 20 children and exits:

    child flags IsProcessInJob right after spawn 3 s after the parent job closes
    DETACHED_PROCESS | CREATE_NO_WINDOW (control) true dead (killed by the job)
    DETACHED_PROCESS | CREATE_NO_WINDOW | CREATE_BREAKAWAY_FROM_JOB true alive

    So breakaway really does escape the terminal's job; the child is only still in the desktop's 0x1800 job, which never kills anything. IsProcessInJob == true after breakaway doesn't mean the daemon will die with the terminal. On Windows 11 26200 it is always true for desktop-launched processes, which makes the current check reject every host.

    Suggestion: instead of rejecting any residual membership, check whether the child's remaining job would kill it (JOBOBJECT_EXTENDED_LIMIT_INFORMATION.LimitFlags & JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, queried via QueryInformationJobObject(NULL, …) from inside the child). Alternatively, fall back to --no-daemon with a warning instead of exiting.

    Probe source (PowerShell + inline C#)
    Add-Type @"
    using System; using System.Runtime.InteropServices;
    public static class Q {
     [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] public struct SI { public int cb; public IntPtr r,d,t; public int x,y,xs,ys,xc,yc,fa,fl; public short sw,cb2; public IntPtr r2,i,o,e; }
     [StructLayout(LayoutKind.Sequential)] public struct PI { public IntPtr hp,ht; public int pid,tid; }
     [DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Unicode)] public static extern bool CreateProcessW(string a, System.Text.StringBuilder c, IntPtr pa, IntPtr ta, bool inh, uint f, IntPtr env, string cwd, ref SI si, out PI pi);
     [DllImport("kernel32.dll")] public static extern bool IsProcessInJob(IntPtr p, IntPtr j, out bool r);
     [DllImport("kernel32.dll", CharSet=CharSet.Unicode)] public static extern IntPtr CreateJobObject(IntPtr a, string n);
     [DllImport("kernel32.dll")] public static extern bool SetInformationJobObject(IntPtr j, int c, IntPtr i, uint l);
     [DllImport("kernel32.dll")] public static extern bool AssignProcessToJobObject(IntPtr j, IntPtr p);
     [DllImport("kernel32.dll")] public static extern IntPtr GetCurrentProcess();
     public static IntPtr Job(){ var j=CreateJobObject(IntPtr.Zero,null); int len=144; var b=Marshal.AllocHGlobal(len);
      for(int k=0;k<len;k++) Marshal.WriteByte(b,k,0); Marshal.WriteInt32(b,16,0x2000|0x800); // KILL_ON_JOB_CLOSE | BREAKAWAY_OK
      if(!SetInformationJobObject(j,9,b,(uint)len)) throw new Exception("set"); if(!AssignProcessToJobObject(j,GetCurrentProcess())) throw new Exception("assign"); return j; }
     public static string Run(uint f){ var si=new SI(); si.cb=Marshal.SizeOf(si); PI pi;
      var c=new System.Text.StringBuilder(@"C:\Windows\System32\PING.EXE -n 20 127.0.0.1");
      if(!CreateProcessW(null,c,IntPtr.Zero,IntPtr.Zero,false,f,IntPtr.Zero,null,ref si,out pi)) return "FAILED err="+Marshal.GetLastWin32Error();
      bool inj; IsProcessInJob(pi.hp,IntPtr.Zero,out inj); return pi.pid+" inJob="+inj; }
    }
    "@
    $null=[Q]::Job()   # terminal-like job; closes when this process exits
    "control "+[Q]::Run(0x08000008)     # DETACHED_PROCESS | CREATE_NO_WINDOW
    "breakaway "+[Q]::Run(0x09000008)   # + CREATE_BREAKAWAY_FROM_JOB
    # after this script exits: tasklist /FI "PID eq <pid>" for both
  11. aalsanie commented on Sep 25, 2026

    @aalsanie

    I went through the current Windows daemon path and the documented nested job semantics. I think the reason this started affecting ordinary launches is #47179, which made daemon_auto_start stable and enabled by default exposing the existing windows daemon-launch failure during new/resume/fork.

    There are two checks.

    codex-rs/app-server-daemon/src/backend/windows.rs::ensure_detached_launch() launches a suspended probe using:

    CREATE_SUSPENDED | DETACHED_PROCESS | CREATE_BREAKAWAY_FROM_JOB
    

    It then calls:

    IsProcessInJob(child, NULL, &in_job)
    

    and rejects the launch whenever in_job != 0.

    The real daemon is then launched in backend/pid_start.rs with:

    DETACHED_PROCESS | CREATE_BREAKAWAY_FROM_JOB
    

    and Process::ensure_detached() performs the same check after spawn, terminating the daemon if it still belongs to any Job Object; the important thing is that IsProcessInJob(process, NULL) doesn't means this procss still associated with the job object whose lifetime is tied to this terminal.

    The survival probe posted here already gives:

    • launcher is placed in an inner job with KILL_ON_JOB_CLOSE | BREAKAWAY_OK;
    • a control child without CREATE_BREAKAWAY_FROM_JOB dies when that job closes;
    • a child launched with CREATE_BREAKAWAY_FROM_JOB survives;
    • that surviving child still returns true from IsProcessInJob.

    so for that case:

    in_job == true
    

    won't guarantee child is still lifetime coupled to the launcher. The failure is not described as “the host does not allow daemon detachment”; the relevant breakaway succeeded, but codex rejects the child because some job object association remains. I do not think simply deleting the two IsProcessInJob checks is a correct general fix, windows nested-job semantics say that when a process has a chain of jobs, breakaway proceeds upward only until it reaches a job that does not allow further breakaway and the child can succssfully be created and still remain associated with that job and its ancestors.

    For example:

    outer job: killOnJobClose, no breakaway
        -- inner job: breakOk
                -- launcher
    

    A daemon created with CREATE_BREAKAWAY_FROM_JOB can leave the inner job but remain in the outer job.

    In that case:

    CreateProcess succeeds
    IsProcessInJob(child, NULL) == true
    

    both of these predictes are wrong:

    in_job == true  => daemon is unsafe
    

    and:

    CreateProcess(CREATE_BREAKAWAY_FROM_JOB) succeeded => daemon is safe
    

    Checking only JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE on QueryInformationJobObject(NULL, ...) is not a complete gurantee either. For nested jobs, NULL queries the process's immediate job; it does not enumerate the complete ancestor job chain.

    I would avoid a patch that removes ensure_detached() or changes in_job != 0 into a limit-flag check; before changing the launcher. More like:

    1. Immediate job does not permit breakaway.
    2. Launcher is inside an inner KILL_ON_JOB_CLOSE | BREAKAWAY_OK job and there is a benign outer association then breakaway child survives closing the inner job even though IsProcessInJob(..., NULL) remains true.
    3. Inner job permits breakaway, outer job does not and is lifetime coupled so the child must not be treated as safely detached.

    The documented job object APIs do not give the caller a way to enumerate and prove the safety of the full ancestor job chain, I suspect the windows solution will need to establish same user, nonelevated launch context rather than attempt to infer safety from the remaining job membership. I would also avoid attributing this specifically to modern standby/DAM. The additional session-0 reproduction in this issue shows the same 0x1800 association outside an interactive desktop session.

  12. adityarya24 commented on Sep 25, 2026

    @adityarya24

    Same here after updating to codex-cli 0.157.0. Windows 11 (build 26200), Dell laptop with Modern Standby (S0 low power idle, no S3). Plain codex from PowerShell fails with "host Job Object prevents daemon detachment; start from a host that allows breakaway". --no-daemon works as a workaround. It started right after the update; the same terminal worked on the previous version.

  13. gologames commented on Sep 25, 2026

    @gologames
    Author

    @etraut-openai I ran the survival test you requested: launched ping.exe with CREATE_BREAKAWAY_FROM_JOB, let the launcher exit, then closed the launching terminal. A separate observer verified the child's PID and creation time and confirmed that the same process remained alive and continued writing to its log, despite still belonging to a Job Object. In a separate control, closing the last handle to a Job with KILL_ON_JOB_CLOSE terminated its child.

    Source for this survival test and control (remove .txt from both filenames and keep them together):

    I also tested whether checking only the immediate Job's KILL_ON_JOB_CLOSE flag would be sufficient. This nested-job experiment showed that it would not:

    Outer Job: KILL_ON_JOB_CLOSE, no breakaway
    └─ Middle Job: no KILL_ON_JOB_CLOSE, no breakaway
       └─ Inner Job: permits breakaway
          └─ Launcher
    

    The child escaped the inner Job but remained in the middle and outer Jobs. Closing the outer Job terminated it, even though its immediate Job had no KILL_ON_JOB_CLOSE.

    Based on these results, I implemented a fallback using a temporary WMI-created parent and the original caller's token: gologames#1

    The patched daemon survived terminal closure and supported restart, a CLI conversation, and shutdown. Clippy and all 53 tests passed for the affected packages. The PR includes the investigation and implementation details.

  14. SantosJMM commented on Sep 25, 2026

    @SantosJMM

    Hello, I'm having the same problem with Windows 11 25H2. I’d like to add that when I run the command codex --sandbox workspace-write --ask-for-approval on-request --model gpt-6-luna --config ‘model_reasoning_effort=“high”’ --cd . codex opens without needing to enable the --no-daemon flag, but if I simply run codex, it throws the error and suggests the flag.

    codex-cli 0.157.0
    

    Note: This was translated; I apologize if it doesn’t make much sense because of that. I just hope you understand the behavior I’m trying to report.

    Image
  15. aalsanie commented on Sep 25, 2026

    @aalsanie

    'model_reasoning_effort="high"' makes Codex use the embedded app-server instead of the shared daemon, so it never hits the windows job object detachment failure.

    @gologames your PR is close to a fix; it implements most of the points I mentioned earlier. What is still missing is automated regression coverage for the three job object cases discussed above and avoiding the initial real daemon spawn before the fallback decision.

    With those covered, this looks much closer to a complete fix.

  16. gologames commented on Sep 25, 2026

    @gologames
    Author

    @aalsanie Your suggestions sound reasonable. At the same time, I tried to keep the changes in this PR as small and focused as possible.

    I’m happy to make further changes if @etraut-openai or other OpenAI maintainers request them.

  17. aalsanie commented on Sep 25, 2026

    @aalsanie

    Since #47179 enabled daemon auto-start by default, this is no longer limited to an explicit app server daemon start. It affects normal startup paths including new sessions, resume, and fork.

    I don’t think the impact on Windows users is fully obvious yet: anyone hitting this Job Object behavior is forced to run with --no-daemon just to use Codex normally. I think this needs a quick maintainer fix and release, but that’s just my two cents.

  18. etraut-openai commented on Sep 25, 2026

    @etraut-openai
    Contributor

    We have a fix in place for this. It will be included in the next release.

  19. goodman-oai commented on Nov 16, 2026

    @goodman-oai
    Contributor

    Fixed in Codex CLI 0.157.1 by #48157. Windows could start a daemon that escaped the inner Job Object, but Codex rejected it because it still belonged to the outer job. The released regression test verifies that the daemon reaches readiness in that configuration. Hotfix confirmation

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 CLIapp-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