[GH-ISSUE #203] bug: Codex agent invocation fails with on-failure approval_policy rejected by current Codex CLI (unknown variant, expected untrusted/on-request/granular/never) #122

Closed
opened 2026-10-18 14:03:09 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @pauloabeck on GitHub (Jul 30, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/203

Environment:

cptr image: ghcr.io/open-webui/computer:latest (pulled ~2026-07-30)
Codex CLI: 0.146.0 (also reproduced on 0.130.0)
Codex CLI installed via npm install -g @openai/codex, running inside a custom Docker image built on top of ghcr.io/open-webui/computer:latest
Codex configured via ~/.codex/config.toml with a custom OpenAI-compatible provider pointing at a local Ollama instance
Platform: Linux container (Debian bookworm base), Docker Desktop on Windows/WSL2

Description:

Selecting a Codex agent model (either the profile configured under Settings → Agents, or one of the auto-discovered agent:codex/gpt-5.x model IDs) and sending a chat message fails immediately with:

Error: {'code': -32600, 'message': 'Invalid request: unknown variant on-failure, expected one of untrusted, on-request, granular, never'}

This reproduces both when chatting directly in cptr's UI and when routing through Open WebUI via the API Gateway connection (/v1/chat/completions) — same underlying invocation, same failure.

Running codex directly (both codex --version and an interactive codex session) inside the same container works correctly and picks up the same config.toml, confirming Codex CLI itself and its config are fine — the failure is specific to how cptr invokes Codex's app-server.

Steps to reproduce:

Build a ghcr.io/open-webui/computer image with Codex CLI installed (npm install -g @openai/codex@latest) and a valid ~/.codex/config.toml.
Add a Codex agent profile under Settings → Agents (Command: codex, Type: Codex), or let auto-discovery populate agent:codex/* entries.
Start a new chat in the relevant workspace, select the Codex agent/model.
Send any message.

Expected: Codex responds normally, as it does when invoked directly via the terminal.

Actual: Immediate JSON-RPC -32600 Invalid request error citing on-failure as an unrecognized approval_policy variant.

Suspected cause: cptr's Codex app-server invocation appears to hardcode approval_policy = "on-failure" when starting a session. This value was valid in earlier Codex CLI releases but has since been replaced by granular (per current Codex CLI's own accepted enum: untrusted | on-request | granular | never). Downgrading Codex CLI to a version old enough to accept on-failure (tested down to 0.29.0) causes a different failure — the agent no longer registers as an available model at all, presumably because that version predates app-server support. This suggests there may be no Codex CLI version compatible with cptr's current integration as-is.

Suggested fix: Update cptr's Codex integration to send granular (or make the approval policy value configurable/detected based on the installed Codex CLI's supported variants) instead of the hardcoded on-failure.

Originally created by @pauloabeck on GitHub (Jul 30, 2026). Original GitHub issue: https://github.com/open-webui/computer/issues/203 Environment: cptr image: ghcr.io/open-webui/computer:latest (pulled ~2026-07-30) Codex CLI: 0.146.0 (also reproduced on 0.130.0) Codex CLI installed via npm install -g @openai/codex, running inside a custom Docker image built on top of ghcr.io/open-webui/computer:latest Codex configured via ~/.codex/config.toml with a custom OpenAI-compatible provider pointing at a local Ollama instance Platform: Linux container (Debian bookworm base), Docker Desktop on Windows/WSL2 Description: Selecting a Codex agent model (either the profile configured under Settings → Agents, or one of the auto-discovered agent:codex/gpt-5.x model IDs) and sending a chat message fails immediately with: Error: {'code': -32600, 'message': 'Invalid request: unknown variant `on-failure`, expected one of `untrusted`, `on-request`, `granular`, `never`'} This reproduces both when chatting directly in cptr's UI and when routing through Open WebUI via the API Gateway connection (/v1/chat/completions) — same underlying invocation, same failure. Running codex directly (both codex --version and an interactive codex session) inside the same container works correctly and picks up the same config.toml, confirming Codex CLI itself and its config are fine — the failure is specific to how cptr invokes Codex's app-server. Steps to reproduce: Build a ghcr.io/open-webui/computer image with Codex CLI installed (npm install -g @openai/codex@latest) and a valid ~/.codex/config.toml. Add a Codex agent profile under Settings → Agents (Command: codex, Type: Codex), or let auto-discovery populate agent:codex/* entries. Start a new chat in the relevant workspace, select the Codex agent/model. Send any message. Expected: Codex responds normally, as it does when invoked directly via the terminal. Actual: Immediate JSON-RPC -32600 Invalid request error citing on-failure as an unrecognized approval_policy variant. Suspected cause: cptr's Codex app-server invocation appears to hardcode approval_policy = "on-failure" when starting a session. This value was valid in earlier Codex CLI releases but has since been replaced by granular (per current Codex CLI's own accepted enum: untrusted | on-request | granular | never). Downgrading Codex CLI to a version old enough to accept on-failure (tested down to 0.29.0) causes a different failure — the agent no longer registers as an available model at all, presumably because that version predates app-server support. This suggests there may be no Codex CLI version compatible with cptr's current integration as-is. Suggested fix: Update cptr's Codex integration to send granular (or make the approval policy value configurable/detected based on the installed Codex CLI's supported variants) instead of the hardcoded on-failure.
Author
Owner

@owui-terminator[bot] commented on GitHub (Jul 30, 2026):

⚠️ Missing Issue Title Prefix

@pauloabeck, your issue title is missing a categorising prefix (e.g. bug:, feat:, docs:).

Please update the title to lead with one of:

  • bug: bug report or error
  • feat: feature request or enhancement
  • docs: documentation issue
  • question: usage question
  • help: support request

Example: bug: Login fails when the password contains special characters

<!-- gh-comment-id:5129368272 --> @owui-terminator[bot] commented on GitHub (Jul 30, 2026): # ⚠️ Missing Issue Title Prefix @pauloabeck, your issue title is missing a categorising prefix (e.g. `bug:`, `feat:`, `docs:`). Please update the title to lead with one of: - **bug**: bug report or error - **feat**: feature request or enhancement - **docs**: documentation issue - **question**: usage question - **help**: support request Example: `bug: Login fails when the password contains special characters`
Author
Owner

@owui-terminator[bot] commented on GitHub (Jul 30, 2026):

🔍 Related Issues Found

I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:

  1. 🟢 #169 bug: Codex Auto approval mode fails because on-failure is no longer supported
    This is the same underlying failure: the Codex integration passes the deprecated on-failure approval policy, which current Codex CLI versions reject with the exact unknown variant error described in the new issue.
    by AmarBego

  2. 🟢 #181 feat: make auto approve actually auto approve
    This discusses Codex/auto-approve behavior in the same area of the codebase, but it's broader and not the specific compatibility bug; it may be adjacent if the auto-approval path is involved in the Codex approval policy mapping.
    by Classic298


💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.

This comment was generated automatically. React with 👍 if helpful, 👎 if not.

<!-- gh-comment-id:5129370117 --> @owui-terminator[bot] commented on GitHub (Jul 30, 2026): <!-- terminator-bot:related-issues-reply --> 🔍 **Related Issues Found** I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions: 1. 🟢 [#169](https://github.com/open-webui/computer/issues/169) **bug: Codex Auto approval mode fails because `on-failure` is no longer supported** *This is the same underlying failure: the Codex integration passes the deprecated `on-failure` approval policy, which current Codex CLI versions reject with the exact `unknown variant` error described in the new issue.* *by AmarBego* 2. 🟢 [#181](https://github.com/open-webui/computer/issues/181) **feat: make auto approve actually auto approve** *This discusses Codex/auto-approve behavior in the same area of the codebase, but it's broader and not the specific compatibility bug; it may be adjacent if the auto-approval path is involved in the Codex approval policy mapping.* *by Classic298* --- 💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead. *This comment was generated automatically.* React with 👍 if helpful, 👎 if not.
Author
Owner

@tjbck commented on GitHub (Jul 31, 2026):

Should be addressed!

<!-- gh-comment-id:5148060256 --> @tjbck commented on GitHub (Jul 31, 2026): Should be addressed!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/computer#122
No description provided.