fix(codex): trust zero-credit usage response#481
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
PowerUserZ
added a commit
to PowerUserZ/OpenTokenUsage
that referenced
this pull request
May 22, 2026
Sync the Windows fork to upstream v0.6.24, preserving fork identity (crate opentokenusage, productName OpenTokenUsage, com.sunstory.openusage, winreg dep, createUpdaterArtifacts=false) and all Windows security hardening. Conflict resolutions: - host_api.rs: keep the fork's is_valid_date_param command-injection guard AND adopt upstream's append_ccusage_common_args(provider, flavor) multi-provider refactor (non-overlapping, both retained). - settings.ts / app-preferences-store / hooks: keep the fork's tray provider/metric/percent-color settings and MenubarIconStyle vocabulary (icon/percent/bars), add upstream's 12h/24h/auto time-format setting. - version files set to 0.6.24 (package.json, Cargo.toml, Cargo.lock, tauri.conf.json). Post-merge semantic fix: - Adapt upstream's new codex zero-credit test to this fork's text credit display; still verifies robinebers#481 (body's zero balance beats the stale x-codex-credits-balance header). New upstream work adopted: Grok usage plugin, claude keychain-first credentials (integrates with the fork's hashed service names), ccusage nvm bin-path resolution + release-age cost fallback, perplexity missing-group fix, dependency bumps (tauri 2.11.1, sha2 0.11, tauri-plugin-store 2.4.3, libc 0.2.186). Verify gate green: bun build (0 type errors), 1104 frontend tests, 95 Rust lib tests (incl. 18 redaction). Windows hardening verified intact; no vulnerabilities or redaction gaps introduced. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
barramee27
pushed a commit
to barramee27/crossusage
that referenced
this pull request
May 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
credits.balancefrom the usage response body when credits data is present.has_credits: falseandbalance: "0".Fixes #465
Test plan
bunx vitest run plugins/codex/plugin.test.jsMade with Cursor
Note
Low Risk
Low risk: small, localized change to how the Codex plugin derives remaining credits, plus a regression test to lock in behavior for zero-credit accounts.
Overview
Fixes Codex credit reporting to trust
creditsin the usage response body when present (including correctly treatinghas_credits: false/balance: "0"as zero), while keeping thex-codex-credits-balanceheader as a fallback when body credits are missing.Adds a regression test covering the no-credits account case where the header reports a non-zero balance but the response body indicates zero credits.
Reviewed by Cursor Bugbot for commit efa6f36. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes Codex credit parsing to trust the usage response body when present, so zero-credit accounts show correct usage. Keeps the header as a fallback to avoid regressions.
credits.balancefrom the body when available; ifhas_credits: false, treat as 0.x-codex-credits-balanceheader when body credits are missing.has_credits: falsewithbalance: "0".Written for commit efa6f36. Summary will update on new commits. Review in cubic