Skip to content

Show Codex usage percentages as reported#905

Merged
robinebers merged 2 commits into
mainfrom
codex/show-codex-usage-as-reported
Jul 8, 2026
Merged

Show Codex usage percentages as reported#905
robinebers merged 2 commits into
mainfrom
codex/show-codex-usage-as-reported

Conversation

@robinebers

@robinebers robinebers commented Jul 8, 2026

Copy link
Copy Markdown
Owner

TL;DR

Show Codex Session, Weekly, and Spark percentages exactly as the usage API reports them. A fresh Session reported as 1% used now remains 1% used / 99% left instead of being rewritten to 0% / Not started.

What was happening

  • Codex can report used_percent: 1 for a window that appears fresh.
  • OpenUsage used reset timing to reinterpret that value as zero and opted the Codex Session row into a special Not started presentation.
  • As reported in Codex Session/Weekly meters flap between real usage and "100% left / Not started" #903, the upstream endpoint can also return inconsistent fresh-looking windows, so the client-side inference could make an unreliable response look authoritative.

What this changes

  • Preserve Codex used_percent values verbatim across Session, Weekly, Spark, and Spark Weekly.
  • Remove Codex from the special Not started session presentation; Codex rows always use their normal reset label.
  • Keep near-empty pacing calm so a reported 1% cannot produce a false red run-out alarm.
  • Remove the now-unused fresh-window timing helper and its tests.
  • Document that upstream inconsistencies remain visible by design rather than being hidden by client-side caching or correction.

Heads-up

Tests

  • swift test — 953 passed, 3 skipped, 0 failures.
  • Release build, signing, launch, and process verification passed via script/build_and_run.sh verify.

Screenshots

Post-change Codex card showing the API-reported 1% used as 99% left with the normal reset label:

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5fbc22b. Configure here.

Comment thread Sources/OpenUsage/Models/WidgetData.swift
@robinebers robinebers added the gate-passed Passed the automated PR gatekeeper checks (gatekeeper skips it on later runs) label Jul 8, 2026 — with Cursor
@robinebers robinebers merged commit 071493c into main Jul 8, 2026
3 checks passed
@robinebers robinebers deleted the codex/show-codex-usage-as-reported branch July 8, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs gate-passed Passed the automated PR gatekeeper checks (gatekeeper skips it on later runs) provider tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant