Skip to content

fix(quota): surface Bailian 5h/weekly/monthly windows via quota.windows (#4594) - #4680

Closed
diegosouzapw wants to merge 1 commit into
release/v3.8.34from
fix/4594-bailian-quota-windows
Closed

diegosouzapw wants to merge 1 commit into
release/v3.8.34from
fix/4594-bailian-quota-windows

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Closes #4594

Problem

The Bailian quota fetcher computed per-window percentages (5h / weekly / monthly) internally and returned them as window5h / windowWeekly / windowMonthly, but it never:

  1. surfaced a shared quota.windows map (the contract quotaPreflight checks for per-window cutoffs), nor
  2. called registerQuotaWindows (the registry the dashboard uses to discover a provider's window names).

So operators could not enforce separate 5h/weekly/monthly cutoffs through the same preflight path other providers use — routing fell back to a single worst-percent signal, under-modeling a near-exhausted shorter window.

Fix (mirrors codex/opencode)

  • parseBailianQuotaResponse now also returns a windows map keyed by 5h/weekly/monthly (legacy fields preserved for quotaMonitor / cooldown consumers).
  • registerBailianCodingPlanQuotaFetcher now calls registerQuotaWindows("bailian-coding-plan", ["5h","weekly","monthly"]).
  • Exported parseBailianQuotaResponse + BAILIAN_QUOTA_WINDOWS for the regression test.

Validation (Hard Rule #18 — TDD)

tests/unit/bailian-quota-windows-4594.test.ts — 3 cases (RED before the change → GREEN):

  • parser surfaces a windows map keyed by the 3 windows, values mirroring the legacy fields
  • legacy window5h/windowWeekly/windowMonthly + worst-case percentUsed preserved
  • getQuotaWindows("bailian-coding-plan") returns the registered windows after registration

Existing bailian-quota-fetcher.test.ts (14) still green. typecheck:core clean, ESLint 0 errors.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw

Copy link
Copy Markdown
Collaborator Author

Closing as a duplicate — #4594 was already fixed by #4610 ("fix(quota): expose Bailian quota windows", merged), which adds the same registerQuotaWindows + quota.windows map for the Bailian 5h/weekly/monthly windows. Superseded; no action needed here.

@diegosouzapw
diegosouzapw deleted the fix/4594-bailian-quota-windows branch June 22, 2026 20:22
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