Skip to content

codex: diagnose intermittent Windows startup failures in CI #57

Closed

Description

@xxchan

Windows Codex startup failures have recurred during runtime maintenance, but the current errors discard the details needed to distinguish a timeout, spawn failure, or native process failure. Record this separately from the Pi 1.0 dependency upgrade; similar failures predate it.

Observed on main commit 678a7643f0d4a10e4c9ef7a019d9db830d691424:

  • Attempt 1, Windows Codex job: the behavior suite passed; the vendor contextUsage() test failed with app-server exited. The retained vendor trace has no opened session for that test. Nine other applicable vendor tests passed. No native stderr or exit reason accompanies the error.
  • Attempt 2, Windows Codex job: codex.CMD app-server --help failed during installation discovery, before the behavior suite started. The logged interval was about five seconds. Artifact upload then failed because no trace directory existed.
  • The identical source tree passed all 12 jobs in PR CI. The other 11 main jobs passed. Attempt 3, with runner debug logging, passed the behavior and vendor suites on the same commit. All 12 main CI jobs now pass. No source changes or assertion changes were made between attempts; the startup failures remain unexplained and this issue stays open for diagnosis.

Earlier observations with these same error shapes exist in run 36582049976 (vendor app-server exit, September 29) and run 36696837269 (installation readiness failure, September 30). Those runs passed on retry. This is evidence of intermittency, not proof of a specific upstream or runner cause.

Diagnostic gaps in the current source:

  • runExecutable defaults to 5000 ms and returns stdout/stderr, but executableInstallation throws only Failed to run ... when the exit code is null. Timeout, signal and spawn error details are not retained in that result.
  • Long-running child stderr is ignored unless OAR_CHILD_STDERR=inherit; the CI behavior jobs do not enable it. A generic app-server exited error therefore cannot explain why session opening failed.
  • A failure before trace initialization leaves no artifact, despite the workflow's unconditional artifact upload.

Next investigation should preserve the native startup diagnostics and timing in Windows CI, then reproduce with the same binary and process environment. Do not infer that increasing a timeout or changing an adapter fixes either failure until those details identify the cause. Keep existing assertions intact.

Activity

  1. xxchan commented on Oct 2, 2026

    @xxchan
    MemberAuthor

    The diagnostics patch under development captured a Linux startup failure with a native cause on October 2. This is additional evidence, not a confirmed explanation for the Windows failures above.

    With Codex 0.160.0, the first local all-backend run reported exit code 1; signal none and retained this stderr:

    WARNING: proceeding, even though we could not create PATH aliases: Refusing to create helper binaries under temporary dir "/tmp" (codex_home: AbsolutePathBuf("/tmp/oar-codex-aimock-lWfmbs"))
    Error: failed to initialize sqlite state runtime under /tmp/oar-codex-aimock-lWfmbs: failed to initialize state runtime at /tmp/oar-codex-aimock-lWfmbs
    

    The shared-home concurrency hypothesis has concrete supporting context:

    • startCodexAimock creates one temporary CODEX_HOME for the behavior backend. runSuite starts the cases concurrently with Promise.all; their session starts receive the same environment.
    • The retained trace shows the session cases starting within about 1.2 seconds. Nine native startup errors name that same home and SQLite initialization failure. A tenth case failed its existing effort-rejection assertion after startup failed. The suite result was 8/18 clean.
    • Different aimock environments use mkdtemp, so the concurrently running vendor suite gets separate homes. The shared home is within the behavior suite; there is no evidence that a user's real Codex home was involved.
    • There is also a version mismatch to eliminate in a controlled reproduction: the existing warmup resolves codex from PATH (0.158.0 here), while the actual sessions honor OAR_CODEX_BIN (0.160.0). No warmup or timeout changes are included in this diagnostics patch.

    No OS-level PID/start timeline or SQLite lock error was captured, so concurrent access is a hypothesis, not a demonstrated lock conflict. A run against the unchanged 0.13.1 tree passed 18/18, and the patched all-backend rerun then passed all four backends without assertion or timeout changes. Codex vendor tests also passed 10/10 applicable cases.

    Local evidence is retained under oar-process-diagnostics/oar-trial-run/run-2026-10-02T10-46-21.596Z/codex-aimock/ (output.log, trace.jsonl). The diagnostic patch will make the native failure visible in future CI runs; the Windows root cause remains open.

  2. xxchan commented on Oct 2, 2026

    @xxchan
    MemberAuthor

    The new diagnostics captured the same SQLite-initialization error on Windows in the documentation-only PR #64. Both original and retried Codex jobs passed all 18 behavior cases, then failed one vendor test during session startup:

    • Attempt 1, job 110814684476: codex correlates native steer echo without a duplicate input failed. The native process exited with code 1 and no signal; stderr named C:\Users\runneradmin\AppData\Local\Temp\oar-codex-aimock-tKvNOU and failed to initialize sqlite state runtime. Nine other applicable vendor tests passed.
    • Attempt 2, job 110817508482: an invalid request fails the turn fast with the API error failed with exit code 1, no signal and the same SQLite-initialization error, under a different temporary home, oar-codex-aimock-gaBMCN. Nine other applicable vendor tests passed.

    This confirms the native failure category on Windows. It does not yet prove that different vendor cases were racing on one home: those tests call startCodexAimock separately and each call uses mkdtemp. The behavior suite does share one home across concurrent cases, but it passed in both Windows jobs. The warmup process and actual app-server reuse each individual test's home; their startup/exit lifecycle is a remaining hypothesis to check, especially around Windows command wrappers and descendant processes. A native concurrent-startup probe in temporary homes will also help separate an upstream restriction from harness behavior.

    There was a separate Windows Claude failure in attempt 1: readExecutableVersion threw only Failed to run C:\npm\prefix\claude.CMD --version from version.ts:25, before traces existed. That path still drops the diagnostics retained by runExecutable; a follow-up patch will preserve them. Claude attempt 2 passed. The first failure's roughly five-second interval is not sufficient evidence to classify its cause, so the existing deadline remains unchanged.

    Artifacts: Codex attempt 1, Codex attempt 2. Original logs are also retained locally as /tmp/otter-pr64-windows-{codex-original,codex-retry,claude-original}.log.

  3. xxchan commented on Oct 2, 2026

    @xxchan
    MemberAuthor

    The native concurrency probe is now retained in #67 and reported upstream as openai/codex#50290.

    On Linux x64 with the native Codex 0.160.0 executable, three rounds of eight simultaneous app-server starts on a fresh shared home produced 21/24 exits with code 1 and the SQLite initialization error. Three controls each initialized 24/24: independent fresh homes, a shared home after one completed initialization and exit, and serial initialization while earlier processes remain alive. A second completed run had the same counts. No model request, authentication or npm launcher is involved. The exact SQLite operation remains unidentified.

    Reproducer and observations.

    The two Windows vendor cases in the preceding comment do not invoke account usage, inventory or model listing alongside session startup. Both share their private test home with a preceding warmup process. That warmup ignored the initialize response and selected PATH's Codex even when the session used OAR_CODEX_BIN. #67 uses the same installation probe as sessions, requires successful initialization and awaits exit. It also fills the version-probe diagnostic gap from the Windows Claude failure.

    A trial converting the former 2.5-second sleep into a handshake deadline caused premature termination in concurrent local suites, with exit 0 and no SQLite error. The submitted patch awaits actual initialization and exit under the existing test deadlines. Local full checks (485 unit tests), all four behavior backends, and Codex vendor tests pass.

    These findings do not prove the cause of the original Windows jobs, whose logs lack a native-process overlap timeline. Keep this issue open pending subsequent Windows evidence. A separate product PR will coordinate first app-server initialization per home within one OAR process; coordination across host processes remains upstream's responsibility.

  4. xxchan commented on Oct 3, 2026

    @xxchan
    MemberAuthor

    Recurred on PR #95 (observe-only change, unrelated): behavior (windows-latest, codex-aimock), run 37116497447, job 111184230853. The failure is earlier than before: the sea-trial warm-up's installation probe C:\npm\prefix\codex.CMD app-server --help was killed at its 5000 ms readiness timeout (exit code unavailable; signal SIGTERM, empty stderr), from warmCodexHome (sea-trial/harness/codex-home.ts:7). So on a slow Windows runner even --help through the npm shim can exceed 5 s. Rerunning the job; if it recurs, the probe's readiness timeout on Windows is the next thing to measure.

    🤖 Generated with Claude Code

  5. xxchan commented on Oct 3, 2026

    @xxchan
    MemberAuthor

    Recurred again on PR #108 (unrelated change), this time for claude: behavior (windows-latest, claude-aimock), run 37131214606, job 111226537559. sea-trial/main.ts's installation probe ran C:\npm\prefix\claude.CMD --version and it was killed at the 5000 ms timeout (signal SIGTERM, empty stderr). Together with the earlier codex app-server --help case this points at the npm .CMD shims on Windows runners sometimes taking over 5 s to start any command, not at codex. If it keeps recurring, the Windows probe timeout is the thing to raise.

    🤖 Generated with Claude Code

  6. xxchan commented on Oct 6, 2026

    @xxchan
    MemberAuthor

    The readiness failure recurred on October 6 in the experiment-only PR #153, commit 4a32e822aff20d0f0207652ea10067b878024681.

    • Run 37445334003, original Windows Codex job 112208651140: before any behavior case, warmCodexHome called installation discovery and C:\npm\prefix\codex.CMD app-server --help failed with exit code unavailable; signal SIGTERM; timeout after 5000 ms. The recorded cause is { exitCode: null, signal: 'SIGTERM', stderr: '', timeoutMs: 5000 }. The error was logged at 09:48:04.809 UTC on Node 24.21.0. Vendor tests did not run.
    • Debug rerun, job 112211145173, on the same commit and without changing code, deadlines or assertions: behavior 19/19 clean and all 11 applicable vendor tests passed. The run now has all 13 jobs passing.

    I inspected both the rerun's step output and its nested runner-diagnostic-logs archive (Runner_20261006-095342-utc.log, Worker_20261006-095344-utc.log). They do not separate the time spent in the npm .CMD launcher from the native Codex process. The worker records starting the behavior step's pwsh.EXE (PID 4624) at 09:54:44 UTC; the behavior summary appears at 09:55:11.776 and the whole step ends at 09:55:34.180. These are outer-step timings, including the test suite and cleanup, not timings for app-server --help. There is no corresponding launcher/native child-process entry timeline for the failed attempt, and the successful retry does not reproduce the delay.

    This adds another confirmed readiness timeout with empty stderr, but it does not establish whether the delay was in the wrapper or native initialization. The earlier analogous Claude failure still makes this broader than Codex session behavior. Distinguishing the two requires timestamps below the outer PowerShell step, ideally comparing the .CMD path and direct native executable on the same Windows runner. No timeout change is included here; the issue remains open for that decision and evidence.

  7. xxchan commented on Oct 6, 2026

    @xxchan
    MemberAuthor

    The maintainer has decided to raise the library's shared runExecutable default from 5,000 to 15,000 ms on every platform in #155. Explicit caller timeouts are unchanged. This will ship with 0.26.0, without a separate release.

    The recurring short-probe failures now include Codex app-server --help on #95 and #153 and Claude --version on #108, all with empty stderr and successful retries. Hosts use the same executable-discovery path as CI, so the allowance belongs in the library. Other installation probes already use 15 or 30 seconds; a single 15-second default also matches OAR's other bounded reads. The tradeoff is that a stuck command takes up to 15 seconds instead of five to fail.

    This is a timeout-policy decision, not confirmation of which Windows launcher or native startup phase caused the delay. It does not establish a fix for the separate native SQLite initialization issue tracked at openai/codex#50290.

    Local validation passed: full checks, all four behavior backends, and actual child processes that completed after six seconds, timed out after the new 15-second default, and retained an explicit 100 ms deadline. Cross-platform PR CI is running.

    Per the maintainer's decision, #155 will close this issue when merged. Reopen it with the preserved native diagnostics if a probe hits the new 15-second deadline.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions