omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

AI Agents panel: Codex tab stuck showing "initialize" (invalid --ask-for-approval value 'untrusted')

Open eddownes opened this issue 3 months ago • 5 comments

What happened

The "AI Agents" bar plugin's Codex tab shows a persistent error card reading "initialize" instead of Codex's usage/rate-limit data, in place of the plan line.

Root cause

bin/omarchy-agent-usage-codex spawns:

codex -s read-only -a untrusted app-server

Current Codex CLI (codex-cli 0.149.1) rejects untrusted as a value for -a/--ask-for-approval:

error: invalid value 'untrusted' for '--ask-for-approval <APPROVAL_POLICY>'
  [possible values: on-request, never]

So the app-server process exits immediately (exit code 2) before it ever speaks JSON-RPC. rpc_request() in the collector then times out waiting for a response to its "initialize" call and raises TimeoutError("initialize"), whose message ("initialize") is what ends up in authHelpText and gets rendered in the panel.

This is not an auth/login issue — codex doctor and codex login status both report healthy (logged in via ChatGPT, Plus plan, websocket connectivity OK).

Verified fix

Changing the approval-policy value from untrusted to never (a currently-valid value) makes the RPC handshake succeed and returns real account/rate-limit data:

codex -s read-only -a never app-server

Reproduced by hand:

$ codex -s read-only -a untrusted app-server
error: invalid value 'untrusted' for '--ask-for-approval <APPROVAL_POLICY>' [possible values: on-request, never]

$ codex -s read-only -a never app-server
# ... RPC handshake succeeds, initialize/account/read/rateLimits/read all return valid results

Steps to reproduce

  1. Install/update Codex CLI to a version where --ask-for-approval no longer accepts untrusted (0.149.1 confirmed).
  2. Open the AI Agents bar panel, select the Codex tab.
  3. Observe the plan/status line is replaced by "Codex limits unavailable" and the help card shows "initialize".

System details

  • Omarchy version: 4.0.0-1
  • OS: Omarchy (Arch Linux), 7.1.8-arch1-3 x86_64
  • Codex CLI: codex-cli 0.149.1 (installed via mise)
  • omarchy debug command does not exist in this Omarchy version (omarchy commands --all has no debug entry), so no diagnostic log/URL is attached.

Suggested fix

In bin/omarchy-agent-usage-codex, change the app-server invocation's approval-policy flag from untrusted to never (or otherwise make it resilient to future renames of accepted values, e.g. try never and fall back to omitting -a on failure).

eddownes avatar Aug 24 '26 11:08 eddownes

Confirmed on another system:

  • Omarchy: 4.0.0-1
  • codex-cli: 0.149.1
  • codex login status: Logged in using ChatGPT
  • omarchy-agent-usage-codex --force | jq '{limits, usageStatusText, authHelpText}' returns:
{
  "limits": [],
  "usageStatusText": "Codex limits unavailable",
  "authHelpText": "initialize"
}

The local script still contains -a untrusted, while this Codex version accepts only on-request or never. Running codex -s read-only -a untrusted app-server exits with status 2 and reports that untrusted is invalid. Changing it to -a never allows the app-server handshake and rate-limit query to proceed.

guiestrela avatar Aug 24 '26 16:08 guiestrela

Confirmed on Codex CLI 0.149.0. PR #8073 fixes the unsupported approval policy while preserving the read-only sandbox, detects app-server termination across both requests and notifications, and adds behavioral regression coverage. The base commit reproduces the initialize error; the target returns the Plus plan and current limits.

dcalliari avatar Aug 24 '26 17:08 dcalliari

Fixed by #7649 (merged as 4cd8a08). The collector now launches the app-server with -a on-request, which Codex 0.149 accepts, so the panel gets the plan and limit windows again instead of initialize.

Thanks for the report and the root-cause work — it matched exactly. Update and the Codex tab should populate; please reopen if it doesn't.

omarchybot avatar Aug 25 '26 14:08 omarchybot

Confirmed on Omarchy 4.0.1-1 with codex-cli 0.149.1; this is still reproducible after upgrading from the versions in the original report.

The Agents panel record contains:

{
  "limits": [],
  "tierLabel": "",
  "usageStatusText": "Codex limits unavailable",
  "authHelpText": "initialize"
}

The packaged collector still launches codex -s read-only -a untrusted app-server. Codex 0.149.1 rejects that command with:

error: invalid value 'untrusted' for '--ask-for-approval <APPROVAL_POLICY>'
  [possible values: on-request, never]

System: Omarchy 4.0.1-1; Linux 7.1.9-arch1-2; AMD Ryzen 7 7735U / Radeon 680M; Quickshell 0.3.1; Codex installed through mise.

I could not produce the requested full debug log because omarchy debug --no-sudo --print returns Unknown Omarchy command on this release. I have attached a sanitized, targeted diagnostic report instead.

spaceXrace avatar Aug 26 '26 12:08 spaceXrace

Still present in the packaged omarchy 4.0.1-1, which is currently the newest available (pacman -Si omarchy reports 4.0.1-1; checkupdates shows nothing pending). The installed collector still carries the old value:

$ sed -n '531p' /usr/share/omarchy/bin/omarchy-agent-usage-codex
      [codex, "-s", "read-only", "-a", "untrusted", "app-server"],

So #7649 is merged but hasn't reached a release yet, and anyone installing today still lands on this. Confirming both branches on codex-cli 0.149.1 by driving the same handshake the collector performs:

-a untrusted    -> TimeoutError: initialize
-a on-request   -> OK
   planType: plus | windows: ['primary', 'secondary']

Worth noting the reason the card is so opaque, which is separable from the approval-policy bug: rpc_request() raises TimeoutError(method) (omarchy-agent-usage-codex:495) and the handler assigns authHelpText = str(exc) (:561), so the panel renders the bare JSON-RPC method name. Whatever causes the handshake to fail, the user is shown an internal identifier rather than a remedy — initialize reads as a broken string, not as advice. The Fireworks collector has the same authHelpText=str(error) shape at :501, and a related renderer problem is filed as #8445.

Happy to reopen-comment elsewhere if a fresh issue is preferred for the unreleased-fix part.

davo42002 avatar Aug 26 '26 18:08 davo42002