fix(quota): accurate Cursor totals and restore missing Kimi usage#159
Closed
Wibias wants to merge 1 commit into
Closed
fix(quota): accurate Cursor totals and restore missing Kimi usage#159Wibias wants to merge 1 commit into
Wibias wants to merge 1 commit into
Conversation
Prefer Cursor totalPercentUsed as the monthly meter (keep auto/API pools secondary), parse unix-ms reset strings, and harden Kimi parsing for data envelopes, weekly limits, and coding-host API keys.
lidge-jun
added a commit
that referenced
this pull request
Jul 19, 2026
Docs-only Phase-0 cycle: dependency-ordered phase map (010-080), immutable
source refs codex/source-pr{152,153,154,156,157,158,159}-*, attribution
contract per 260718 precedent, and Sol review verdicts folded per phase:
- PR#152 FAIL -> pid-identity guard, captured-port wait, activation tests
- PR#157 FAIL -> honest error codes, /findsid verification, deadline budget
- PR#156 GWF -> legacy identity-less migration, cross-token user_id preference
- PR#158 GWF -> matcher narrowed to local abort contract, compact activation
- PR#159 GWF -> active-key-only probe, envelope null handling, key-mode gate
- PR#153 GWF4 -> key-compat override, grant renewal repr, token redaction,
identity-required persistence, poll cadence, 401 replay,
terminal refresh codes, host fail-closed
- PR#154 FAIL -> close-origin-aware focus restore
Roadmap A-gate: 4 audit rounds vs Sol reviewer, final VERDICT PASS.
lidge-jun
added a commit
that referenced
this pull request
Jul 19, 2026
…ey-mode gate Repairs for community PR #159 absorb (source head 90eca76), Sol review findings (all P2): - resolveKimiQuotaBearer: only the ACTIVE key is used; an unresolved env reference no longer silently walks apiKeyPool — the meter would belong to a different account than the one routing requests. - unwrapKimiQuotaPayload: null outer placeholders ({ usage: null, data: {...} }) no longer mask a usable nested payload. - maybeFetchProviderQuota: the key-auth Kimi probe requires authMode === 'key'; forward/local modes carry no credential of ours and are not probed. - Activation tests: unresolved-env no-probe, forward-mode no-probe, null-envelope unwrap. Co-authored-by: Wibias <37517432+Wibias@users.noreply.github.com>
Owner
|
Thanks — both the Cursor totalPercentUsed fix and the Kimi limits[] mapping were right, and it's landed on
Full suite green (3,087 tests). Closing in favor of the dev-landed commits; ships with the next release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
totalPercentUsedas the monthly meter (matching Settings → Usage) while still showing First-party / API pool bars as secondary windows, and parses Connect RPC unix-ms reset strings.dataenvelopes, map weekly windows fromlimits[]when top-levelusageis absent, accept direct percent fields, and probe coding-host API-key providers (kimi-code) without ever sending credentials to non-canonical hosts.Test plan
bun test tests/provider-quota.test.ts tests/quota-bars-rows.test.tskimi-codeAPI-key onhttps://api.kimi.com/coding/v1shows 5h / weekly / total subscription creditsGET /api/provider-quotas?refresh=1returnscursor:period-usageandkimi:usageswithout leaking tokens/raw payloads