Skip to content

fix(codex): scope profile quota reads and explain Pro (More) usage - #144

Merged
prakersh merged 4 commits into
mainfrom
fix/142-codex-pro-more-usage
Oct 2, 2026
Merged

prakersh merged 4 commits into
mainfrom
fix/142-codex-pro-more-usage

Conversation

@prakersh

@prakersh prakersh commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex Pro (More) can report 87% weekly usage through wham/usage while a CLI stream reports 43-44% for the same reset. onWatch now scopes named-profile usage requests with ChatGPT-Account-Id, uses Codex's plan labels, and shows a source disclosure in both the Codex and All Providers views. API percentages are preserved because no supported conversion rule is established.

Restores tablet card placement when the disclosure precedes quota cards, and switches the quota-starter default to gpt-6-luna. The CODEX_STARTER_MODEL override remains available; the setup guide no longer recommends retired models.

Validation:

  • ./app.sh --test --smoke passed: full race suite, vet, macOS production build check, and short tests.
  • Eight browser regressions passed using the existing E2E dependencies and pytest --confcutdir=tests/e2e/tests --browser-channel=chrome tests/e2e/tests/test_codex_usage.py. This excludes the parent daemon fixtures for local validation.
  • Real HTTP regression covers independent work/personal profile headers and tokens.
  • JavaScript syntax, gofmt, whitespace checks, tablet visual comparison, and follow-up code review passed.

The reporter's live account discrepancy and actual window anchoring with Luna were not reproduced. This addresses the issue's request for clear disclosure when the usage API and CLI differ.

Fixes #142

Use Codex's account header for usage requests, identify the Pro (More) plan accurately, and disclose that the dashboard keeps the usage API percentage unchanged when it differs from CLI /status. No upstream conversion rule is available, so the raw value remains authoritative for tracking.

Constraint: Codex v0.159.0 displays the API-reported percentage directly and scopes usage reads with ChatGPT-Account-Id

Rejected: Divide Pro utilization by two | no documented conversion rule and the behavior could misstate other plans or future API responses

Confidence: medium

Scope-risk: narrow

Directive: Preserve API percentages unless Codex documents a supported conversion

Tested: ./app.sh --test; ./app.sh --smoke; node --check internal/web/static/app.js; git diff --check

Not-tested: Live OAuth comparison against the reporter's Pro (More) account
Named profile clients were missing the account metadata needed by the new
usage header, and the single-account All view omitted the source disclosure.
Forward account IDs to usage clients, carry the note and plan label through
every account view, and count quota articles independently of the note when
laying out tablet cards. Use GPT-6 Luna for the tiny starter request.

Constraint: No supported conversion rule explains the API/CLI percentage difference
Rejected: Halve Pro utilization | could misstate current or future server limits
Directive: Keep usage metadata scoped to each profile and preserve API percentages
Confidence: high
Scope-risk: narrow
Tested: app.sh full race suite and smoke checks; eight isolated browser regressions; JavaScript syntax; gofmt and diff checks
Not-tested: Live reporter account comparison and live GPT-6 Luna window anchoring
Related: #142
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.54839% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/agent/codex_agent_manager.go 86.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Use the canonical account header for usage requests and guard default-profile
credential adoption and saving against identity changes. Preserve token
rotation without metadata and retain the latest token when a login changes.
Supply plan labels from the existing server formatter, refresh changing source
notes, and escape legacy account names in both text and attributes.

Constraint: Usage requests must follow Codex's ChatGPT-Account-Id convention
Rejected: Keep alternate account headers | upstream does not use them
Directive: Do not replace the tracked profile token with a different login or stale startup token
Confidence: high
Scope-risk: moderate
Tested: Targeted race tests through app.sh; vet and macOS production build; seven Node VM renderer checks; syntax, gofmt and diff checks
Not-tested: Full socket suite and browser cases under the current sandbox; live OAuth quota comparison and Luna window anchoring
Related: #144
The spawned shell creates the marker with O_TRUNC before printf writes, so
the polling loop could read a transient 0-byte file and fail the test
immediately. Treat an empty read as "not yet" and keep waiting; only a
non-empty value that disagrees with the expected marker is a failure.

This is why Test (Windows) failed on CI while the same commit passed on
Linux and macOS: Windows shell startup is slower, widening the window.

Tested: go test -race -count=50 ./internal/update/
@prakersh
prakersh merged commit a26875f into main Oct 2, 2026
24 checks passed
@prakersh
prakersh deleted the fix/142-codex-pro-more-usage branch October 2, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex Pro (More) weekly quota differs from CLI: 87% used in wham/usage vs 43–44% in /status

1 participant