Skip to content

fix: derive quota windows from duration#74

Merged
jacobcxdev merged 1 commit into
mainfrom
fix/duration-driven-quota-windows
Jul 13, 2026
Merged

fix: derive quota windows from duration#74
jacobcxdev merged 1 commit into
mainfrom
fix/duration-driven-quota-windows

Conversation

@jacobcxdev

Copy link
Copy Markdown
Owner

What changed

  • derive shared and scoped quota-window identities from provider-reported duration metadata
  • support canonical generic duration keys throughout ordering, rendering, aggregation, and history
  • reject missing or conflicting duration metadata instead of guessing from slot position
  • cold-start burn history after gaps longer than a quota period

Why

OpenAI temporarily suspended five-hour windows and returned weekly limits through primary_window. Positional parsing labelled those weekly limits as five-hour windows, corrupting pace and aggregate calculations.

Impact

Current weekly-only Codex responses render as 7d, while normal five-hour plus weekly responses remain compatible. JSON and cache schemas remain unchanged.

Validation

  • go test -race -count=1 ./...
  • go vet ./...
  • go build ./...
  • live comparison of limit_window_seconds against cq check codex --json

- Used provider-reported periods for shared and scoped quota windows.
- Added canonical duration keys and generic period calculations.
- Reset stale burn history after unobserved window periods.
@jacobcxdev
jacobcxdev merged commit 99472b5 into main Jul 13, 2026
2 checks passed
@jacobcxdev
jacobcxdev deleted the fix/duration-driven-quota-windows branch July 13, 2026 19:53
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.

1 participant