Repository navigation
fix(cli): support monthly Codex usage windows - #6333
serdarkarisik54-spec wants to merge 5 commits into
Conversation
miguel-heygen
left a comment
There was a problem hiding this comment.
Thanks for this. It's a clear, well-scoped fix. The 30-day constant matches how Codex itself labels a monthly window (30 days), the new case reuses the existing duplicate-window guard, and the duplicate-monthly test covers it nicely.
One thing to change before merge:
monthly should always be present, like spend (packages/cli/src/utils/usageBudget.ts:41, :86, :106). Right now Codex results always include monthly, but Claude Code and Grok results leave the key out entirely. The usage docs promise that an unavailable window is null, and spend already follows that rule for harnesses that never report it. A script that checks result.monthly === null would get undefined on Claude Code and Grok. The existing tests don't notice because toEqual treats a missing key and an undefined key the same. A simpler shape is:
monthly: UsageWindow | null(required) inHarnessUsagemonthly: UsageWindow | null = nullas theknownUsageparameter- keep the original
window !== nullfilter and returnmonthlyunconditionally
Then add monthly: null to the Claude Code and Grok toEqual expectations, so the shape stays pinned.
Smaller docs follow-ups:
docs/packages/cli.mdx(theusagesection: JSON example and the paragraph that explainssession/weekly/spend) doesn't mentionmonthlyyet.skills/hyperframes-cli/references/upgrade-info-misc.md:132: please addmonthlyto the "Known results contain ..." field list and note that it isnulloutside Codex, the same way the text describesspend.
Optional: a test that pairs a 5-hour primary with a 30-day secondary would confirm both session and monthly come through together.
Also, the full CI suite hasn't run on this fork yet, so I'll take another look once it's green.
Verdict: COMMENT
Reasoning: The monthly mapping is correct, but monthly should be emitted as null on every harness to match the documented contract and spend, and the full CI has not run on the fork.
What
Recognize Codex's 30-day (2,592,000-second) usage window as a separate
monthlyfield inhyperframes usage --json.Why
Some Codex accounts return a 30-day allowance window. The CLI currently recognizes only 5-hour and 7-day windows, so this account returns
unsupported_usage_windoweven though its usage data is valid.How
monthlyto Codex window parsing and result validation.Test plan
bunx vitest run usageBudget.test.ts— 34 tests passed in an isolated workspace with the CLI's Ajv and Vitest dependencies.