What happens
omarchy-agent-usage-codex spawns codex app-server and makes two JSON-RPC
calls to it — account/read then account/rateLimits/read — each bounded by
a 4-second timeout (rpc_request(..., timeout=4)).
A successful run typically completes in ~2s, but response time varies enough
that the call intermittently exceeds 4s. When it does, the script's exception
handler overwrites the entire result for that refresh:
except Exception as exc:
result["usageStatusText"] = "Codex limits unavailable"
result["authHelpText"] = str(exc) # e.g. "account/read"
result["limits"] stays [] (its initial default), so any usage record
consumer reading the cached JSON — the bar widget and any app that reads
~/.local/state/omarchy/agents/usage/codex.json — loses the rate-limit
display for that whole refresh cycle, even though the previous cycle had
valid data.
Reproduction
Ran the collector 8 times back-to-back on an idle-ish machine:
for i in $(seq 8); do
/usr/bin/omarchy-agent-usage-codex --force
done
3 of 8 runs failed with the exact signature above (usageStatusText: "Codex limits unavailable", authHelpText: "account/read"), each taking ~5s
end-to-end vs ~2s for a success — consistent with hitting the 4s timeout on
account/read and returning shortly after.
Fix
The 4s timeout margin against codex app-server's actual response time is
too tight. Bumping both RPC timeouts (account/read,
account/rateLimits/read) from 4s to something like 10s resolves it in local
testing (0 failures in 6 subsequent runs). Patch is a one-line-per-call
change in fetch_codex_rpc().
Environment
- omarchy package: 4.0.4-1
- codex-cli: 0.157.1
What happens
omarchy-agent-usage-codexspawnscodex app-serverand makes two JSON-RPCcalls to it —
account/readthenaccount/rateLimits/read— each bounded bya 4-second timeout (
rpc_request(..., timeout=4)).A successful run typically completes in ~2s, but response time varies enough
that the call intermittently exceeds 4s. When it does, the script's exception
handler overwrites the entire result for that refresh:
result["limits"]stays[](its initial default), so any usage recordconsumer reading the cached JSON — the bar widget and any app that reads
~/.local/state/omarchy/agents/usage/codex.json— loses the rate-limitdisplay for that whole refresh cycle, even though the previous cycle had
valid data.
Reproduction
Ran the collector 8 times back-to-back on an idle-ish machine:
3 of 8 runs failed with the exact signature above (
usageStatusText: "Codex limits unavailable",authHelpText: "account/read"), each taking ~5send-to-end vs ~2s for a success — consistent with hitting the 4s timeout on
account/readand returning shortly after.Fix
The 4s timeout margin against
codex app-server's actual response time istoo tight. Bumping both RPC timeouts (
account/read,account/rateLimits/read) from 4s to something like 10s resolves it in localtesting (0 failures in 6 subsequent runs). Patch is a one-line-per-call
change in
fetch_codex_rpc().Environment