Conversation
The Grok credits proxy (`/v1/billing?format=credits`) publishes a `productUsage` array next to `creditUsagePercent`, but the decoder dropped it. Show it as plain "Usage breakdown" text rows under the single weekly bar, never as extra rate windows or progress bars. Product shares are percentages of the same weekly pool as the aggregate: every observed payload sums to it, including below-100% multi-product samples (2 = 1+1, 3 = 2+1, 4 = 3+1, 6 = 4+2 for GrokBuild + GrokChat). The display is guarded accordingly: - decode `productUsage` fail-soft; malformed entries never affect the weekly total or period - attach products only when the aggregate is the wire `creditUsagePercent` and the shares sum to its raw value within 1 pp; never under the on-demand `used/cap` fallback or a period-only answer - `completing(with:)` keeps only its own products, so a grok.com total never carries proxy shares - keep reset-credit rows first and append the breakdown instead of replacing `details` wholesale in both Grok fetch strategies Supersedes steipete#3900 (closed pending per-product evidence, see steipete#2989). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Four live `?format=credits` payloads from one account (2026-09-25), below 100% with two products after grok.com chat usage: 2 = 1+1, 3 = 2+1, 4 = 3+1, 6 = 4+2 (GrokBuild + GrokChat). Each parses to its wire products and sums to the weekly total; the 6 = 4+2 payload renders one bar plus "Grok Chat 4%" / "Grok Build 2%" rows. Also refresh the card renders from a live two-product snapshot and document the samples (grok.com chat = GetGrokCreditsConfig product id 4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 25, 2026, 2:43 AM ET / 06:43 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch decodes Grok billing product percentages and displays them as text rows beneath the existing weekly quota bar, with tests, documentation, and menu-card proof images. Merge readiness⛔ Blocked before merge - 3 items remain Current main and v0.66.0 still omit Grok product rows, so this PR remains useful. The latest head fixes the prior incomplete-breakdown finding and has convincing live proof. The remaining blocker is the repository owner's approval of the user-facing percentage interpretation. Priority: P2 Review scores
Verification
How this fits togetherCodexBar's Grok provider turns billing responses into a usage snapshot. The CLI and menu card then display its weekly quota bar and supporting details. flowchart TD
A[Grok billing response] --> B[Decode weekly total and products]
B --> C{Complete products compose total?}
C -->|Yes| D[One bar with product rows]
C -->|No| E[One bar only]
D --> F[CLI and menu card]
E --> F
Decision needed
Why: The owner previously withheld this user-facing interpretation when only a Build sample was available; the new evidence changes the basis for that decision but does not itself record approval. Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one Grok quota bar and show product rows only for complete, same-response values that compose its total, subject to the owner's approval of that interpretation. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this adds provider detail. The before and after CLI output and inspected card renders establish the requested display difference. Is this the best way to solve the issue? Yes, subject to owner approval: text rows retain Grok's single quota bar, and complete same-response validation avoids attaching product values to a fallback total. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b9844e4d74e6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Malformed `productUsage` entries were dropped one by one before the 1 pp composition check, so an incomplete list could still pass it: with `creditUsagePercent: 6`, a valid Chat 5 plus a malformed Build entry left 5, within tolerance, and rendered as a complete "Usage breakdown". Decode products all-or-nothing: a single malformed entry (or a non-array value) now yields no breakdown. The weekly total, period, tier, and usage flags are unchanged, and unknown product names or zero-usage entries remain valid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @olddonkey. Landed on main via #3988 with your co-author credit and changelog thanks, and it ships in the next release. The breakdown reads the per-product shares already present in the credits response and renders them through the shared detail rows under the weekly bar, so there are no extra requests. Malformed or mismatched shares leave the main quota intact, and the reset-credit enrichment paths now preserve the rows instead of replacing them. The regression test fails on the old code and passes after the change; verification here is fixture-based because no live Grok account was available on this Mac. |
Carry the validated per-product shares from Grok's existing billing response through the web billing snapshot into ordinary detail rows under the weekly bar, with no extra requests; inconsistent or malformed shares omit the breakdown while keeping the main quota. Adopts steipete#3975. Closes steipete#3975 Co-authored-by: olddonkey <olddonkeyblog@gmail.com>
What this PR does
Grok's card has one weekly bar, and it doesn't say which Grok product used the week. The credits endpoint already reports that split (
productUsage), and CodexBar was discarding it. This PR shows it as plain text rows under the same single bar:No new bars and no per-product limits are claimed. Grok still has exactly one quota.
This supersedes #3900, which was closed because a single Build-only sample couldn't establish what the product percentages are measured against (#2989). This PR adds the missing evidence: live payloads below 100% with two products.
Percentage basis: live evidence
The same account was sampled on 2026-09-25, and the CLI proxy
GET /v1/billing?format=creditsand grok.comGetGrokCreditsConfigreturned identical values. Between samples the only thing that changed was grok.com chat usage, andGrokChat(grok.com product id 4) appeared as a second entry:creditUsagePercentEvery sample sums to the aggregate, including the unequal splits. A "share of usage" reading would make the rows sum to 100 regardless of the aggregate, so each product is a percentage of the same weekly pool. Values are whole percents on both surfaces. All four live payloads are checked into the tests verbatim.
Voice: grok CLI 1.0.41's voice mode is dictation over
wss://api.x.ai/v1/stt. About 3 hours of transcribed audio produced no billing change and no product entry, so this PR contains no Voice fixture. Voice would still render correctly under the guard below (an unknown product name passes through as its raw ID), but I couldn't observe it.Guard
The rows assume "shares add up to the total", and the code checks that on every response:
creditUsagePercent, and only when they sum to its raw (unclamped) value within 1 percentage point.used/capfallback, a period-only answer, or a total borrowed from grok.com (completing(with:)keeps only its own products).Proof
Everything here comes from the same account at the same moment (2026-09-25 04:54 UTC). The runs used an isolated
CFFIXED_USER_HOME,CODEXBAR_DISABLE_KEYCHAIN_ACCESS=1, and--source oauth, so only~/.grok/auth.jsonwas read: no Keychain, no browser cookies. Email is redacted.Before: released CodexBar 0.65.0,
CodexBarCLI usage --provider grok --source oauthAfter: this branch, same command
--format jsonfor the same run still shows exactly one window:"primary": {"usedPercent": 6, "windowMinutes": 10080}, "secondary": null, "tertiary": null, plus"details": [{"title": "Usage breakdown", "rows": [{"label": "Grok Chat", "value": "4%"}, {"label": "Grok Build", "value": "2%"}]}].Menu card (production
UsageMenuCardViewrendered offscreen from that live snapshot withhidePersonalInfoon; see how it was rendered):productUsage)Changes
GrokCreditsProxyFetcher: all-or-nothing, fail-softproductUsagedecoding. A single malformed entry or a non-array value drops the whole breakdown, so a partial list can't pass the sum check as if it were complete. It never changes the weekly total, the reset, the window, or the wire-published/implicit-zero flags. It also applies the composition guard above. (c56e731c7, after ClawSweeper's first review: Chat 5 plus a malformed Build entry under a total of 6 used to render as a complete breakdown.)GrokWebBillingSnapshot.productUsageis a new defaulted field.applying(subscriptionTier:)carries it;completing(with:)keeps only its own.GrokUsageSnapshot.toUsageSnapshot()adds aUsage breakdownsection only when the weekly bar exists.UsageFormatter.percentString, and the section reuses the existingUsage breakdownstring, so there's no new localization.GrokProviderDescriptor: both fetch strategies used to replacedetailswith the reset-coupon section. One helper now puts the coupon section first and then the breakdown.docs/grok.mddocuments the mapping and the evidence..github/pr-proof/grok-product-usage/contains the card renders.Tests
Grok Chat 4%/Grok Build 2%rows.Commands run:
make check: 0 violationsmake test: exit 0; 126/126 groups passed on the first run (1,391 selections, 0 failures, 0 timeouts, 928 s) on headc56e731c7. Main's newer commits don't touch Grok, and the branch merges cleanly with them.🤖 Generated with Claude Code