Codex Desktop Profile token usage does not increase despite local token growth and analytics diagnostics

Open 💬 2 comments Opened Jul 3, 2026 by jackiemingnew
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex are you using?

  • Codex Desktop: 26.623.101652 (CFBundleVersion 4674)
  • Bundled/linked CLI: codex-cli 0.142.5
  • Platform: macOS 26.5.1 (25F80), Apple Silicon arm64
  • Subscription: Pro

What issue are you seeing?

The Codex Desktop Profile page token activity / daily usage bucket does not reliably increase even though local Codex token totals are increasing.

This appears similar to #25479, where local ~/.codex/state_*.sqlite token totals diverge from the Profile API / UI buckets. I am opening a separate issue because I collected a short-window diagnostic that compares:

  1. local token growth,
  2. analytics upload signals,
  3. remote Profile bucket growth,
  4. queue-drop signals,
  5. network probe signals.

Observed behavior

During a 30-minute observation window:

  • Observation window: 2026-07-03 16:54:31 to 2026-07-03 17:24:31 local time
  • Local token total increased from 351,318,464 to 357,178,221
  • Local delta: 5,859,757 tokens
  • Remote Profile todays bucket stayed at 940,450
  • Remote Profile delta: 0 tokens
  • Gap: 5,859,757 tokens
  • Analytics POST 200 observed in that exact 30-minute window: 0
  • Analytics error count observed in that exact 30-minute window: 0
  • Analytics queue drops observed: 0
  • Profile fetch errors observed: 2
  • Network probe status: LOCAL_NETWORK_SUSPECT
  • Network probes: 16 / 24 failed at DNS/TCP/TLS/HTTP reachability checks

A later short local check did observe an analytics POST 200 and still showed no queue drops, so the upload path is not completely dead. However, Profile daily usage still appears to lag or miss local token growth.

Expected behavior

If Codex records local token usage for completed turns, the Profile token activity / daily usage bucket should eventually reflect that usage, or the UI/API should document the accounting differences clearly.

In particular, it should be clear whether the Profile page:

  • excludes some local sessions,
  • excludes archived sessions,
  • excludes subagent/main-agent usage differently,
  • samples or delays usage,
  • depends on analytics upload events,
  • can miss token fields when turn events are emitted before token usage facts arrive.

Diagnostic notes

From the open-source Codex code path, the analytics flow appears to be turn-based:

  • Core records TurnTokenUsageFact for a turn.
  • The analytics reducer combines turn facts and emits codex_turn_event.
  • The analytics client queues events and POSTs them to /codex/analytics-events/events.
  • The queue size appears bounded, and queue is full would be logged if events were dropped.

One important detail: token fields in the codex_turn_event appear optional. If a turn event is emitted before token_usage is attached, it may be possible for a turn event to be uploaded without total_tokens. I have not confirmed this is happening, but it is a plausible area to inspect given the local-vs-remote gap.

Related public reports

  • #25479: Profile usage stats stale/incomplete compared with local state_*.sqlite
  • #23686: Codex Analytics personal usage chart shows no data
  • #25762: Profile token activity date/timezone mismatch
  • #25354: Profile/Usage UI can become unavailable despite backend data being available
  • #17880: Cloudflare/WAF/network issues involving /backend-api/codex/analytics-events/events

Privacy / safety

No auth token, cookie, Authorization header, full account ID, or raw POST body is included here. The numbers above are aggregated local/remote token totals and status-level diagnostics only.

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 1 month ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #30310
  • #30974

Powered by Codex Action

theodoreye001 · 1 month ago

I am seeing a very similar mismatch on Windows.

Codex Profile daily token activity shows:

  • 2026-07-26: 0 tokens

But local Codex state shows real usage for that date.

Local evidence, read-only inspection:

  • Platform: Windows
  • Local timezone: Asia/Shanghai
  • Local session files:
  • ~/.codex/sessions/2026/07/26/*.jsonl
  • ~/.codex/archived_sessions/rollout-2026-07-26*.jsonl
  • Number of 2026-07-26 rollout files found: 13
  • state_5.sqlite threads.tokens_used sum for those 13 threads: 109,974,446
  • Summing the final payload.info.total_token_usage.total_tokens from the matching JSONL files gives the same total: 109,974,446

Observed local time range:

  • First thread created: 2026-07-26 21:44:07 Asia/Shanghai
  • Latest update: 2026-07-27 00:17:51 Asia/Shanghai

Thread sources in the affected records:

  • user: 5 threads
  • subagent: 7 threads
  • automation: 1 thread

One suspicious detail: in state_5.sqlite, all affected rows have has_user_event = 0, even for rows where thread_source = user. If Profile usage aggregation filters on has_user_event, that might explain why real local usage is omitted.

Expected behavior:

If local Codex records completed-turn token usage and threads.tokens_used is non-zero, Profile token activity should either reflect it eventually, or document clearly which local usage classes are excluded.