omarchy-agent-usage-codex: hardcoded --ask-for-approval value 'untrusted' rejected by current codex-cli
What happened
The Agents bar widget's Codex rate-limit lookup always fails with usageStatusText: "Codex limits unavailable", even with a freshly-authenticated codex CLI.
Running the collector directly reproduces it:
$ omarchy-agent-usage-codex --force
{"schemaVersion":1,"id":"codex", ... ,"limits":[],"tierLabel":"","usageStatusText":"Codex limits unavailable","authHelpText":"initialize"}
Root cause
omarchy-agent-usage-codex spawns the RPC subprocess with a hardcoded approval-policy flag:
[codex, "-s", "read-only", "-a", "untrusted", "app-server"]
Running that exact command manually shows the actual failure — it's a CLI argument-parsing error, not an auth/RPC problem:
$ codex -s read-only -a untrusted app-server
error: invalid value 'untrusted' for '--ask-for-approval <APPROVAL_POLICY>'
[possible values: on-request, never]
For more information, try '--help'.
The installed codex-cli (0.151.0) no longer accepts untrusted as a value for -a/--ask-for-approval — only on-request and never are valid now. The subprocess exits (code 2) before the JSON-RPC initialize handshake is ever sent, which is why the collector's error hint says "authHelpText":"initialize" even though authentication is fine (verified: ~/.codex/auth.json has a last_refresh from minutes before reproducing this).
Expected
The Codex tab in the Agents panel shows real rate-limit data for an authenticated codex CLI.
Actual
Codex never shows usable limits — "limits":[] and "usageStatusText":"Codex limits unavailable" — because the RPC subprocess fails to start.
Steps to reproduce
- Have
codex-cli0.151.0 (or any version where-a untrustedis invalid) onPATHand authenticated (codex login). - Run
omarchy-agent-usage-codex --force. - Observe
"limits":[]and"usageStatusText":"Codex limits unavailable"in the output, despite valid auth. - Confirm directly:
codex -s read-only -a untrusted app-server→error: invalid value 'untrusted' for '--ask-for-approval <APPROVAL_POLICY>'.
System details
- Omarchy version:
4.0.1-1 codex --version:codex-cli 0.151.0- Relevant file:
/usr/share/omarchy/bin/omarchy-agent-usage-codex(thefetch_codex_rpc()function,[codex, "-s", "read-only", "-a", "untrusted", "app-server"])
Suggested fix
Update the hardcoded value to one of the currently-valid options (never looks like the closest intent to a previous "untrusted" policy for a read-only, non-interactive usage probe), or detect the CLI's supported values before choosing one.
Confirmed for Omarchy 4.0.1, and already fixed on quattro and in the 4.0.2 release — your root cause is right for the version you are on, including the point that authHelpText: "initialize" is an argument-parsing failure rather than an auth one.
bin/omarchy-agent-usage-codex:531 went from untrusted to on-request in commit 4cd8a081 ("Fix Codex usage collection on 0.149", PR #7649, merged 25 August, closing #7873), and that change also added an argv assertion at test/shell.d/agent-usage-codex-scanner-test.sh:52 so the removed value cannot come back unnoticed. It was cherry-picked to the release branch as 880605f2 and shipped in v4.0.2. v4.0.1:bin/omarchy-agent-usage-codex:531 still reads -a untrusted, which is what you reproduced; updating past 4.0.1 should bring the limits back.
You asked whether the CLI's supported values should be detected rather than hardcoded. Four Codex CLI builds were checked directly here, reading back what each one says it accepts:
codex-cli 0.100.0 [possible values: untrusted, on-failure, on-request, never]
codex-cli 0.130.0 [possible values: untrusted, on-failure, on-request, never]
codex-cli 0.146.1 [possible values: untrusted, on-request, never]
codex-cli 0.149.0 [possible values: on-request, never]
That makes the detection step unnecessary for this particular flag: on-request is valid on every build in that range, including the older ones that still took untrusted, so hardcoding it does not trade current users for users on an older CLI the way hardcoding a newly-introduced value would. It is also the better of the two survivors on the security axis — never suppresses approval altogether, while on-request leaves it to be asked for — though neither is reached in practice, since the collector only sends initialize, account/read and account/rateLimits/read and never starts a model turn.
The tree has exactly one call site that passes an approval policy to codex, and it is the one you named. The other two invocations, bin/omarchy-agent:86 and default/bash/aliases:49, use --approve-for-me, which 0.149.0 still accepts.
One thing you found that is still live on quattro: stderr=subprocess.DEVNULL at line 534 discards the CLI's own error text, and rpc_request raises TimeoutError(method) on EOF, which is why the useful diagnosis was replaced by the word initialize. It is worse on a machine with no Codex session history: providerHasData at shell/plugins/agents/Main.qml:219 admits a provider only on local usage, limits or a balance, so a fresh install with a failing limits probe loses the Codex chip entirely rather than showing a broken one. Three open pull requests touch this area — #8877 surfaces the CLI's stderr instead of the method name, #8073 turns an early app-server exit into a named error rather than a timeout, and #8977 does both while also changing on-request back to never. Which of them lands is the maintainer's call.
Same defect as #7873 (closed), and as the still-open #8398, #8460, #8656, #8721, #8849, #8868, #8971, #9247 and #9357.
Reviewed twice: by Claude Opus 5 in Claude Code, and independently by Codex at xhigh reasoning effort. Codex reached the same verdict and contributed the widget-disappears mechanism above, plus the observation that the existing regression test pins the spelling of the flag rather than compatibility with a real Codex binary — its stub records the arguments without ever parsing them.
Automated duplication check: this issue looks similar to #8460, which covers the same Codex limits unavailable from stale approval flag. I keep that one open and close this one to keep the discussion in one place.
If you feel this is the wrong decision, please open the issue again with a note on the difference.