Repository navigation
Conversation
The Codex collector counted tokens by scanning session files on this machine, so the day rows stayed at zero when the same subscription was used over SSH, on another computer, or in a different client. The app-server's account/usage/read call returns the daily token totals OpenAI records for the whole account, so use those for today, the seven-day rows, and the active-day list whenever the app-server offers them. Per-model usage keeps coming from local sessions, since the endpoint has no model split. An older app-server answers the call with a method-not-found error and the collector falls back to the local scan without touching the limits it already collected. Records built from account totals declare scope "account" so synced snapshots take the widest value instead of summing one copy of the same numbers per machine.
Limits have always described the whole subscription while token counts described the machine the panel runs on, and the two sit in one column with nothing to tell them apart. Reading Codex day totals from the account puts both populations inside a single tab, so every section header now names its source: limits and balances are ACCOUNT, and day and model totals say ACCOUNT, THIS MACHINE, or N MACHINES when synced aggregation merged them. A record's scope drives the label. Collectors that scan local sessions need no change and read THIS MACHINE, Fireworks reads ACCOUNT from the scope it already declares, and a collector whose model split is narrower than its day totals says so with modelUsageScope, which is how the Codex record keeps its locally scanned model breakdown honest.
|
Two sync regressions were reproduced at Keep local model and activity statistics additiveThe new record-wide Synthetic sessions passed through the actual collector and extracted snapshot/aggregation functions:
Impact: With multiple synced machines using the account endpoint, the model section labelled Suggested change: Preserve and consume per-family scopes in snapshots and aggregation. Keep locally scanned model tokens and prompt/session counts additive, while deduplicating account-wide day totals. Preserve account-wide model deduplication for providers such as Fireworks. Resolve account/local precedence independently of snapshot orderThe supported method-not-found fallback produces device-scoped days. Combining that record with an account-scoped record for the same subscription alternates addition and maximum operations according to input order. With a synthetic account total of 1,000 that already includes the fallback machine's 200 tokens: Impact: Mixed CLI versions or an unavailable optional usage endpoint can inflate both today's total and its chart row. The result changes with snapshot traversal order, not usage. Suggested change: Resolve account-versus-local precedence per date before combining totals. Do not add a local subset to an account total covering it; retain addition when only local records are available. Test both orders, separately from the model-scope correction above. Verified: Without sync, account buckets replace day totals while the model split remains local and receives the corresponding source label. Method-not-found preserves local totals and previously fetched limits. Homogeneous account day totals deduplicate correctly. Both changed test files pass, but do not exercise these failing snapshot/aggregation combinations. Review informationTest scope: Pinned baseline/head collectors with synthetic session files and RPC replies, plus actual QML JavaScript snapshot, merge and mapping functions executed outside the UI. No live account queries or rendered-panel validation; account bucket timezone and freshness remain unverified. Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review. Automated AI review: Astra initial source inspection, independent Fable 5.1 High and Astra Xhigh technical reviews, followed by Astra synthesis and verification against saved targeted evidence. |
…al stats Marking the whole Codex record account-scoped once its day totals came from the account made synced aggregation treat every number in it as a replica: locally scanned model tokens and prompt counts from two machines collapsed to the larger one instead of adding up. Mixing a machine on a Codex old enough to lack the usage method with one that has it was worse, since the merge alternated addition and maximum per snapshot, so today's total depended on which snapshot happened to be read first. The Codex record now scopes just its day totals with daysScope and stays device-scoped otherwise. Snapshots carry both family scopes resolved beside the record-wide one older versions read, and the merge keeps the two populations apart per family and per date until the end: account figures collapse to their maximum, device figures add up, and the larger stands. That is order-independent, lets a lagging account figure fall back to the local share, and leaves a fully account-scoped record such as Fireworks deduplicated as before.
|
Thanks, both reproduced and fixed in e7a7a3d: the Codex record now scopes only its day totals, and the merge tallies account and device figures separately per family and per date, with tests for both orders. |
|
Verified: Both findings in the earlier review are resolved at Synthetic comparisons through the actual collector account-override, snapshot-writer and aggregation functions:
Verified: The day-chart rows follow the same order-independent result, while fully account-scoped Fireworks-style replicas still deduplicate. No new actionable issue was established in this follow-up scope. Review informationTest scope: Pinned original/head source inspection and synthetic function-level execution outside the UI. No live account queries, rendered-panel validation or stock-suite rerun. Account timezone/freshness and older readers consuming new snapshots are not covered by the resolution claim. Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review. Automated AI review: Astra initial inspection; independent Opus 5.5 High and GPT 6 Sol Xhigh technical assessments; Astra synthesis and verification against retained targeted evidence. Opus executed the synthetic comparisons; Sol independently reviewed source. |
Why
The Codex collector builds "Tokens by day" and today's total from session files stored on the machine running the panel. Codex usage from another computer, an SSH session, the desktop app, or the web never appears, so a subscription driven mostly from elsewhere shows a week of zeros while the weekly limit meter climbs.
The Codex app-server has an
account/usage/readmethod that returns the daily token totals OpenAI records for the account itself, covering every device it is signed in on:{"summary": {"lifetimeTokens": 1234567890, "peakDailyTokens": 12345678, "...": null}, "dailyUsageBuckets": [{"startDate": "2026-09-19", "tokens": 23456789}, {"startDate": "2026-09-21", "tokens": 3456789}], "threadUsage": null}Adopting it creates a second problem the panel has always had in milder form: limits describe the whole subscription, token counts describe one machine, and the column gives no sign of which is which. With account-wide days beside a locally scanned model split, the two populations now sit in the same tab.
What changed
Codex day totals come from the account.
bin/omarchy-agent-usage-codexasks foraccount/usage/readin the session that already fetchesaccount/rateLimits/read. When the answer carriesdailyUsageBuckets, the record'srecentDays,todayTotalTokens, andactiveDates/activeDayscome from those totals. Per-model usage still comes from local sessions, because the endpoint has no model split. An app-server predating the method answers method-not-found, and the collector keeps the local totals and the limits it already collected, with no change in output.Every section header names its source.
LIMITSandBALANCEare always· ACCOUNT;TOKENS BY DAYandTOKENS BY MODELsay· ACCOUNT,· THIS MACHINE, or· N MACHINESunder synced aggregation. The label follows the record's"scope", so collectors that scan local sessions need no change and readTHIS MACHINE, while Fireworks readsACCOUNTfrom the scope it already declares. A collector may scope one family apart from the rest with"daysScope"or"modelUsageScope"; the Codex record declares"daysScope": "account"and nothing more, so its day totals are account-wide while its model split and prompt counts stay machine-local.Synced aggregation merges per family, in any order. Snapshots carry both family scopes resolved beside the record-wide one older versions read. The merge keeps account and device populations apart per family and per date until the end: account figures collapse to their maximum, device figures add up, and the larger stands. Locally scanned model tokens and prompt counts from several machines therefore still add up under account day totals, identical account totals are never summed once per machine, a machine on a Codex too old for the usage method contributes a local share the account figure already covers without inflating it whichever snapshot is read first, and a lagging account figure falls back to the local share. Fully account-scoped records such as Fireworks deduplicate exactly as before.
shell/plugins/agents/README.mddocuments both.Tests
test/shell.d/agent-usage-codex-scanner-test.sh: the fake app-server now answers unknown methods with an error like the real one. New checks cover the record staying machine-local without account usage, and account totals replacing the day rows while the model split stays local, active days union, and the two scopes are declared. 25 checks pass.test/shell.d/agents-panel-test.sh: new checks evaluate the panel's scope-label helper, the record mapper, the snapshot writer, and the aggregation directly: each label, the unstated-scope default, the one-machine case, limits and balances never inheriting a synced label, per-family scope resolution, local model tokens and prompt counts adding up across machines under account day totals, account-beside-local merges giving the same answer in both orders, a lagging account figure yielding to the local share, and a fully account-scoped record still deduplicating. 45 checks pass../test/clipasses../test/shellpasses except for five files that also fail on a clean checkout here, needing anomarchy-pkgscheckout,omasnap, or a live compositor.TOKENS BY DAY · ACCOUNTwith totals matching the account, including tokens spent on another machine over SSH that the local scan could not see, besideTOKENS BY MODEL · THIS MACHINE; the Claude tab readsLIMITS · ACCOUNToverTOKENS BY DAY · THIS MACHINE.Anthropic's OAuth usage endpoint returns utilization percentages only, with no daily token history, so Claude Code has no equivalent account-wide source to adopt. Its day and model rows stay local and now say so.