Repository navigation
Grok: zero-usage week drops the weekly Credits window again in 0.79.0 (ACP billing short-circuits the #3261 fallback) #4674
Description
Summary
On a zero-usage week, codexbar usage --provider grok --json on 0.79.0 returns no usage.primary at all. Only providerCost remains. On 0.77.0, the same machine and the same auth file return the weekly Credits window at 0 %.
This looks like the #3261 symptom coming back through the ACP billing path added in #4595.
Versions
- Bad: CodexBar 0.79.0, Linux x86_64 glibc tarball (
CodexBarCLI-v0.79.0-linux-x86_64.tar.gz). - Good: CodexBar 0.77.0, same platform.
- Grok CLI auth file present; plan SuperGrok Heavy.
Steps
- Use a Grok account at the start of a weekly period, before any usage. The CLI proxy
GET /v1/billing?format=creditsthen returnscurrentPeriod(weekly, active) andprepaidBalance, but omitscreditUsagePercentandproductUsage(proto3 zero values). - Run
CodexBarCLI usage --provider grok --jsonon 0.77.0 and on 0.79.0.
Expected
usage.primary with usedPercent: 0, windowMinutes: 10080 and resetsAt at the period end, as 0.77.0 returns (source: grok-web).
Actual (0.79.0)
source: grok-cli. Key paths present: usage.providerCost.*, usage.updatedAt. Key paths missing compared with 0.77.0: usage.primary.usedPercent, usage.primary.windowMinutes, usage.primary.resetsAt, rateWindowLabels.primary. Reproduced 4 times on 2026-10-21.
Suspected cause
GrokRPCClient.fetchBilling() (v0.79.0, Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift:88) accepts the credits snapshot when credits.usedPercent != nil || credits.prepaidBalanceUSD != nil. On a zero-usage week the payload has a prepaid balance but no creditUsagePercent, so the result is accepted with an unknown percent. In GrokStatusProbe.swift:177-182, that non-nil webBilling makes hasBilling true, so the probe never throws and the provider's web fallback is not reached. On 0.77.0 that fallback (source: grok-web) is what returns the implicit zero (usedPercentIsImplicitZero, the #3261 fix). resolvingUnknownUsage in GrokProviderDescriptor.swift applies the same enrichment to the proxy path only.
0.78.0 was not tested; #4595 landed between 0.77.0 and 0.79.0.
Impact
Any consumer of usage --json or serve loses the weekly bar for the whole first part of each week, until usage becomes non-zero.
Activity
clawsweeper commentedon Oct 21, 2026
Codex review: this still needs some work.
Summary
Keep open: current main accepts ACP billing with a prepaid balance but no percentage, bypassing the existing enrichment that restores the weekly usage window.
Reproducibility: Current source establishes the failure: omitted percentage plus a valid prepaid balance yields ACP success, no primary window, and no enrichment; the reporter supplies repeated 0.79.0 versus 0.77.0 results, but this review ran no tests or live account probes.
Regression provenance
Possible regression — suspected (reviewed change). No predecessor PR is attributed.
Next step
Add a failing ACP active-period regression, then restore bounded usage enrichment while preserving prepaid-only results and unknown-usage safeguards.
Review details
Best possible solution:
Apply the existing bounded, same-account usage enrichment to ACP credits while retaining prepaid balances and strict implicit-zero validation.
Do we have a high-confidence way to reproduce the issue?
Current source establishes the failure: omitted percentage plus a valid prepaid balance yields ACP success, no primary window, and no enrichment; the reporter supplies repeated 0.79.0 versus 0.77.0 results, but this review ran no tests or live account probes.
Is this the best way to solve the issue?
Reuse the established enrichment and merge rules rather than inferring zero from JSON omissions or rejecting useful wallet-only billing; a focused ACP regression must fail before the repair.
AGENTS.md: found and applied where relevant.
Codex review notes: model internal, reasoning medium; reviewed against 9093308f0b79.
Label changes
Label changes:
P2: A source-established single-provider regression hides weekly quota information without blocking the core runtime or first useful run.impact:ux-friction: The weekly Credits bar disappears despite recoverable billing data, leaving users and JSON consumers without the expected quota view.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P2: A source-established single-provider regression hides weekly quota information without blocking the core runtime or first useful run.impact:ux-friction: The weekly Credits bar disappears despite recoverable billing data, leaving users and JSON consumers without the expected quota view.Evidence reviewed
Acceptance criteria:
What I checked:
Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift:88, 9093308f0b79)Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift:208, 9093308f0b79)Tests/CodexBarTests/GrokFailedBillingWorkTests.swift:178, 9093308f0b79)docs/grok.md:68, 9093308f0b79)Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift:88, d82bddb55ef6)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed October 20, 2026, 9:30 PM ET / October 21, 2026, 01:30 UTC.
fix(grok): expose the ACP regression test's credentials mode
test(repro): show steipete#4674 regression fails without ACP enrichme…
test(proof): add shipped CLI gold proof for steipete#4674
test(proof): diagnose Foundation trust in the CLI gold proof
fix(grok): restore the weekly credits window on a zero-usage week
fix(grok): expose the ACP regression test's credentials mode
test(proof): run steipete#4674 regression red/green on Linux-hosted CI
test(proof): add shipped CLI gold proof for steipete#4674
test(proof): diagnose Foundation trust in the CLI gold proof
fix(grok): reuse bounded enrichment for ACP credit usage
steipete commentedon Oct 21, 2026
Fixed in #4679 (ad0c567). Thanks @psl75011! The regression came from the ACP billing path added in 0.78: a wallet-only success skipped the zero-usage check, so a quiet week lost its weekly Credits window. ACP results now go through the same validation as before, so a confirmed zero-usage week shows the window at 0 used. It will be in the next release.
fix(grok): keep the weekly Credits window on a zero-usage week (steip…