Repository navigation
Fix Codex usage collection on 0.149 - #7649
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Codex usage collector for Codex 0.149 compatibility.
Changes:
- Replaces retired
untrustedpolicy withon-request. - Adds regression coverage for exact app-server arguments.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bin/omarchy-agent-usage-codex |
Uses the supported approval policy. |
test/shell.d/agent-usage-codex-scanner-test.sh |
Verifies the complete Codex invocation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Reviewed. No defects found — the diff is correct and the two things that could have made it worse than the bug both check out. Does Does dropping the version guard break older codex? No, and this was the one worth checking, since the collector has no version detection. Tests. Run on a disposable VM, not locally. Second opinion. codex at xhigh reviewed the diff independently and reached SHIP with no defects. Its independence is not currently guaranteed — it can read this machine's own files, including omabot's review protocol — so treat the agreement as agreement. It did contribute one thing checked afterwards and confirmed: codex 0.130's own help, in the deprecation note for On #7648. This closes the defect the issue reports — the launch line is the only place One adjacent pre-existing note, not a blocker and not touched by this PR: Nothing pushed to the branch. Waiting on the maintainer. |
|
Confirmed this fixes the issue codex 0.149 introduced |
Bring the Codex tab of the Agents panel up to parity with the Claude tab.
Codex's account/rateLimits/read already returns more than the collector
surfaced: a plan type, model-scoped allowances under rateLimitsByLimitId
(each with its own 5-hour and weekly window), and a spend-control flag.
- tierLabel is a human plan name ("prolite" -> "Pro Lite", "plus" -> "Plus")
instead of the raw API token, matching Claude's "Max 20x" / "Pro".
- Window labels follow the Claude collector's wording ("Session (5-hour)",
"Weekly (7-day)") so the LIMITS section reads the same on both tabs.
- Model-scoped limits (e.g. "GPT-5.3-Codex-Spark") are emitted with a
title, the way Claude reports "Fable Weekly", so the panel shows them as
their own rows instead of dropping them.
- spendControlReached surfaces as the usage status text.
- Launch app-server with `-a on-request`, as in omacom#7649, since Codex 0.149
retired `untrusted` (omacom#7648).
The scanner test's mock app-server now answers with a realistic payload
and asserts the plan label and every limit row.
Bring the Codex tab of the Agents panel up to parity with the Claude tab.
Codex's account/rateLimits/read already returns more than the collector
surfaced: a plan type, model-scoped allowances under rateLimitsByLimitId
(each with its own 5-hour and weekly window), and a spend-control flag.
- tierLabel is a human plan name ("prolite" -> "Pro Lite", "plus" -> "Plus")
instead of the raw API token, matching Claude's "Max 20x" / "Pro".
- Window labels follow the Claude collector's wording ("Session (5-hour)",
"Weekly (7-day)") so the LIMITS section reads the same on both tabs.
- Model-scoped limits (e.g. "GPT-5.3-Codex-Spark") are emitted with a
title, the way Claude reports "Fable Weekly", so the panel shows them as
their own rows instead of dropping them.
- spendControlReached surfaces as the usage status text.
- Launch app-server with `-a on-request`, as in omacom#7649, since Codex 0.149
retired `untrusted` (omacom#7648).
The scanner test's mock app-server now answers with a realistic payload
and asserts the plan label and every limit row.
|
Re-reviewed after @RodriMora's confirmation. Nothing new against the diff — it is unchanged at Verified end-to-end on 0.149.0, on a disposable VM with the collector from this branch. Same binary, same machine, only the policy string differing: The first line is exactly the bug in #7648/#7842/#7873. The second is the app-server starting, completing the handshake and answering honestly — that VM is not logged in, which is why the count is still 0. The wire format question is settled, and it matters here. A competing PR (#7829) also rewrites the response parsing to read Tests. On the worker, not locally. On Second opinion. codex at xhigh reviewed the diff independently and found no defect, agreeing with the above — its independence is not currently guaranteed, since it can read this machine's files, so treat the agreement as agreement. It did contribute one thing I had not reasoned about and then confirmed by running it: #7829's precedence, Still open from the first review, unchanged. This closes the defect in #7648 but not the issue's second request: an early app-server exit still surfaces as the pending RPC method name, because stderr is Waiting on the maintainer, and specifically on a choice rather than on a fix: six open PRs change this one line — #7649 and #7770 to |
|
Independent confirmation on a ChatGPT Pro account, which I don't think is covered by the reports so far (the earlier confirmation was on a different plan tier). Environment: Omarchy 4.0.0-1, codex-cli 0.149.0, Linux 7.1.8-arch1-3. Before the change, "tierLabel": "",
"limits": [],
"usageStatusText": "Codex limits unavailable",
"authHelpText": "initialize"The Running the packaged argv directly reproduces it immediately: With only this PR's one-word change applied to the collector, the record populates correctly: "tierLabel": "pro",
"limits": [{"label": "Weekly (7-day)", "percent": <real value>, "resetsAt": "2026-08-27T13:13:29+00:00"}],
"usageStatusText": "",
"authHelpText": "Run `codex login` to authenticate."So the Pro plan label resolves and the weekly window comes back with a real percentage and reset timestamp. One note in support of the |
|
Re-reviewed after @p134c0d3's Pro-account confirmation. The code is unchanged at This line is the only thing 0.149 rejects. Swept the base branch for every place Omarchy invokes the #7770 is not a second half of the fix — it is the same change. Its production hunk and this one both resolve @p134c0d3's mechanism holds, and it corrects the timing everyone else has given. Tests. On the worker, not locally. One note on the test, not a defect. Codex pointed out that the stub serializes with Still open, unchanged from the first review. This closes the defect in #7648 but not that issue's second request: an early app-server exit still surfaces as the pending RPC method name, because stderr is Waiting on the maintainer, on a choice rather than a fix. The cluster has grown to ten open PRs against this single line since the last pass: #7649 and #7770 on |
|
Confirmed this regression is still present after updating to Omarchy 4.0.1-1 on Quattro. Environment:
The packaged collector still launches Codex with: [codex, "-s", "read-only", "-a", "untrusted", "app-server"]This causes the Agents panel to report: {
"limits": [],
"tierLabel": "",
"usageStatusText": "Codex limits unavailable",
"authHelpText": "initialize"
}Codex rejects the argument because error: invalid value 'untrusted' for '--ask-for-approval <APPROVAL_POLICY>'
[possible values: on-request, never]Changing only I regenerated the record with: omarchy-agent-usage-update codexand restarted the shell successfully. |
The stub joined its arguments with "$*", so the assertion compared one flattened string and could not tell five arguments from fewer containing spaces. Passing "-s read-only" and "-a on-request" as single arguments -- which codex rejects as an unexpected argument -- passed the test. NUL separation and an array comparison keep the boundaries the assertion is about. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Codex XHigh <noreply@openai.com>
|
Re-reviewed at 74fcdc4 by Claude Opus 5, with an independent second opinion from Codex at xhigh reasoning. The fix is correct and complete, and @diemol55's report on 4.0.1-1 reproduces exactly. Verified on a disposable VM running codex-cli 0.149.0, not just read. Reverting the one token on that VM produces the reported failure byte for byte — This is the whole fix. Both reviewers swept the tree independently: On the risk that One fix pushed to this branch (21c1496), in the test you added rather than the collector. The stub captured its argv with Test results on the VM: Waiting on the maintainer, for a reason outside this PR. There are at least twelve open PRs fixing this same token (#7751, #7770, #7825, #7829, #7864, #7892, #7908, #7911, #7924, #8073, #8095 and this one) and five open issues reporting it (#7648, #7842, #7873, #7997, #8032). This one is the earliest, opened 2026-08-21. The one substantive difference between them is the replacement value: ten chose Two pre-existing defects Codex found in Note on the second opinion: Codex ran under a read-only sandbox on the same machine, so its independence is not currently guaranteed. Where it agreed on completeness and on the test being imprecise rather than vacuous, it agreed with conclusions already reached. The |
* Fix Codex usage collector approval policy * Capture codex argv with boundaries in the scanner test The stub joined its arguments with "$*", so the assertion compared one flattened string and could not tell five arguments from fewer containing spaces. Passing "-s read-only" and "-a on-request" as single arguments -- which codex rejects as an unexpected argument -- passed the test. NUL separation and an array comparison keep the boundaries the assertion is about. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Codex XHigh <noreply@openai.com> --------- Co-authored-by: Omabot <omabot@omarchy.org> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Codex XHigh <noreply@openai.com> (cherry picked from commit 4cd8a08)
* Fix Codex usage collector approval policy * Capture codex argv with boundaries in the scanner test The stub joined its arguments with "$*", so the assertion compared one flattened string and could not tell five arguments from fewer containing spaces. Passing "-s read-only" and "-a on-request" as single arguments -- which codex rejects as an unexpected argument -- passed the test. NUL separation and an array comparison keep the boundaries the assertion is about. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Codex XHigh <noreply@openai.com> --------- Co-authored-by: Omabot <omabot@omarchy.org> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Codex XHigh <noreply@openai.com>
Changes
untrustedapproval policy withon-requestread-onlyapp-server sandboxon-requestis supported by Codex 0.148 and restores authenticated limits on 0.149.Fixes #7648
Tests
bash test/shell.d/agent-usage-codex-scanner-test.sh./test/clibin/omarchy-agent-usage-codex --limits-onlyagainst Codex 0.149.0