Skip to content

Contradictory Usage API snapshot masks fresh runtime quota evidence #376

Description

@bvdcode

Summary

After a provider-side usage incident, Codex Pooler can keep presenting an account as having 0% weekly quota remaining while fresh runtime response headers report substantial quota remaining and requests continue to succeed.

This is a conflict between current provider surfaces. The Usage API observation is the newest observation; it is not stale. The defect is that Pooler presents the pessimistic value as an unqualified current fact despite contradictory fresh evidence.

Observed behavior

Codex Pooler version: 0.7.5

Two fresh observations for the same account-level secondary/weekly window and reset cycle were retained:

  • Usage API: 100% used / 0% remaining, observed at 2026-09-10T05:52:00Z — newest and selected for display.
  • Response headers: 37% used / 63% remaining, observed at 2026-09-10T05:50:48Z — fresh and not selected.

A rate-limit event also previously reported 63% remaining, but had become stale by the time of the snapshot above.

The scheduled account reconciliation continued to refresh the contradictory Usage API value every minute. The upstream account remained usable and successful runtime traffic kept reporting 63% remaining, but the account card and cockpit continued to show Weekly 0%.

This occurred after the provider temporarily showed the included quota as exhausted and later restored it in the user-facing subscription UI.

Impact

  • Operators cannot tell that current provider surfaces disagree.
  • A healthy account may appear exhausted even while it successfully serves requests.
  • Operators may unnecessarily pause/relink the account or redeem a saved reset.
  • Presentation asserts certainty where the retained evidence is contradictory.

Relevant selection behavior

CodexPooler.Quotas.Evidence assigns higher merge precedence to runtime rate-limit events and response headers than to the Usage API (90/80 vs 60). However, CodexPooler.Upstreams.Quota.WindowSelector.logical_selection_score/2 ranks pressure_rank before merge_precedence and observation timestamp.

Consequently, a 100% used Usage API observation beats a fresh 37% used runtime-header observation for the same cycle because it is more pessimistic. In the observed snapshot, the Usage API row was also newer.

Expected behavior

Contradictory fresh quota observations for the same reset cycle should not be collapsed into an unqualified 0% remaining display.

One acceptable behavior would be to select the stronger runtime evidence. Another would be to expose an explicit conflicted/uncertain state while retaining fail-closed routing behavior. The operator must be able to distinguish confirmed exhaustion from disagreement between provider surfaces.

Suggested acceptance coverage

  • A fresh Usage API 100% used snapshot conflicts with fresh response headers reporting lower usage in the same reset cycle.
  • The UI exposes the conflict instead of asserting an unqualified authoritative zero.
  • Routing and operator presentation expose consistent semantics.
  • A later converged observation clears the conflict automatically.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions