Skip to content

Align OpenAI Codex usage stats with reset windows#2955

Open
paraliine wants to merge 1 commit into
Wei-Shaw:mainfrom
paraliine:main
Open

Align OpenAI Codex usage stats with reset windows#2955
paraliine wants to merge 1 commit into
Wei-Shaw:mainfrom
paraliine:main

Conversation

@paraliine
Copy link
Copy Markdown

@paraliine paraliine commented Jun 1, 2026

Summary

This PR aligns OpenAI OAuth Codex usage window stats with the displayed reset windows.

Previously, the 5h and 7d local stats were always queried using rolling windows:

  • now - 5h
  • now - 7d

That could make requests/tokens/cost differ from the actual quota window shown by the Codex utilization and
reset time.

Changes

  • Added a small helper to derive the stats start time from the already parsed UsageProgress.ResetsAt.
  • For active reset windows, stats now use:
    • 5h: resets_at - 5h
    • 7d: resets_at - 7d
  • If the reset time is missing or expired, behavior falls back to the previous rolling window logic.

Notes

This keeps the change minimal and reuses the existing parsed UsageProgress data instead of reparsing raw
accounts.extra fields.

Closes #2954

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

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.

OpenAI OAuth 的用量窗口统计未与 Codex 重置窗口对齐

1 participant