Conversation
This branch has not been deployed
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
Some unified-billing SuperGrok Heavy accounts show a weekly 0% used in the official Grok Build CLI while CPAMP shows unknown usage because the REST response omits
creditUsagePercent. Add a bounded, read-only gRPC-web-text check for confirmed SuperGrok/Heavy subscriptions. Accept implicit zero only from a complete successful response matching the active REST week; the existing quota UI then displays 100% remaining.This extends #710 and #840 without treating a missing REST percentage as zero. Free and unconfirmed plans remain unknown.
Scope
Changes
SuperGrokorSuperGrok Heavythrough the same credential's settings endpoint before the optional gRPC read.api-callresponse cannot safely carry arbitrary binary. Decode independently padded base64 chunks, including trailers.grpc-implicit-zeroprovenance in the billing summary and preserve REST reset metadata. Optional read failures leave REST health and existing account actions unchanged.User Impact
Affected paid accounts show 100% remaining instead of unknown, consistent with the official CLI's zero-use representation. Zero may include usage rounded down to zero; this does not establish a token allowance or that no tokens were consumed. All other missing usage stays unknown.
Compatibility / Runtime Notes
/v0/management/api-calland$TOKEN$; no new CPA core endpoint is required.Data / Security Notes
Tokens remain resolved by CPA; the panel never reads auth-file secrets. No inference requests, credential changes, purchases, reset redemption, or production config changes. Committed fixtures contain synthetic timestamps and no account identifiers. Optional billing errors do not become disable/recovery signals.
Risk / Rollback
Risk level: Medium — depends on an upstream internal billing protocol and a narrowly documented proto3 default-value interpretation.
On unexpected responses, usage remains unknown. Revert this PR to restore REST-only quota display. No database rollback is needed.
Verification
Commands / evidence:
The first repository-test attempt lacked a merge base due to the shallow clone. After fetching the history, all repository tests passed.
Read-only live evidence (2026-09-26): same account checked with CPA v7.3.15 and Grok Build 1.0.41. Official CLI
/usageshowed Heavy weekly 0%; both stored OAuth tokens independently produced the same period-only REST response. Settings confirmed SuperGrok Heavy. gRPC-web-text through CPA returned HTTP 200 and gRPC status 0, and the new parser accepted the complete active period, yielding expected remaining percentage 100. No real account data is included in fixtures. The production panel was not replaced or restarted.Screenshots / Recordings
N/A — no UI components/layout changed. An Accounts display-model regression verifies
usedPercent: 0andremainingPercent: 100; the native official CLI observation and read-only transport check are described above. No manual check of the modified panel is claimed.Docs
Docs decision: add bilingual provider-manual notes on the bounded zero-use interpretation. Existing pages/navigation and demo layout are unchanged. Include this fix in the next release notes; do not rewrite historical release behavior.
Related