#1759·happy

Codex sessions crash on every message with codex-cli >=0.153: approval policy `on-failure` was removed upstream

Author: salacosteCreated Sep 5, 2026Updated Sep 21, 2026

Summary

With codex-cli >= 0.153, every Happy Codex session dies immediately: the app-server rejects the approvalPolicy that Happy sends, the session process exits, and the mobile app shows "Process exited unexpectedly" on each message. The Codex integration is effectively unusable with current codex releases.

Related but distinct: #1330 discusses the semantics of yolo -> on-failure. This report is about a hard breakage: on-failure no longer exists in codex's API at all.

Environment

  • happy-coder CLI: 1.1.9 (latest on npm)
  • codex-cli: 0.153.2 (npm @openai/codex; reproduced range: all 0.153.x)
  • OS: macOS (Darwin 25.5.0), session started remotely from iOS app, permission mode yolo

Error

Session log (~/.happy/logs/…):

[codex] Starting with options: startedBy=daemon
[CodexAppServer] Spawning: codex app-server --listen stdio://
[WARN] Error in codex session: Error: thread/start: Invalid request:
unknown variant `on-failure`, expected one of `untrusted`, `on-request`, `granular`, `never`
(code=-32600)

Mobile app side: message bubbles render, then a centered "Process exited unexpectedly" line. Repeatable on every message.

Root cause

packages/happy-cli/src/codex/codexAppServerTypes.ts says its types are cherry-picked from Codex 0.107.0:

typescript
export type ApprovalPolicy = "untrusted" | "on-failure" | "on-request" | "never";

codex-cli removed the on-failure variant somewhere around 0.153 (current accepted set: untrusted, on-request, granular, never — note the new granular). Happy still sends on-failure for yolo, safe-yolo and the bypassPermissions fallback in executionPolicy.ts, so thread/start is rejected and the session process exits.

Proposed fix

  1. Map the auto-run modes to policies current codex accepts:
    • yolo / bypassPermissions -> never (+ danger-full-access sandbox, as before) — this also matches the behavior requested in #1330
    • safe-yolo -> on-request (or explore the new granular)
  2. Regenerate the app-server types from a current codex release instead of 0.107.0.
  3. Ideally: on unknown variant rejection, retry with a fallback policy (e.g. on-request) instead of crashing the session — would give forward-compat when OpenAI changes the enum again.

Workaround that works for us

Patching the shipped bundle (dist/index-*.mjs, dist/index-*.cjs) replacing the three "on-failure" switch returns with "never", then restarting the daemon. Codex sessions from the mobile app run fine afterwards.

Happy to test any fix build. Thanks for the great project!