Skip to content

Grok: zero-usage week drops the weekly Credits window again in 0.79.0 (ACP billing short-circuits the #3261 fallback) #4674

Closed

Description

@psl75011

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

  1. Use a Grok account at the start of a weekly period, before any usage. The CLI proxy GET /v1/billing?format=credits then returns currentPeriod (weekly, active) and prepaidBalance, but omits creditUsagePercent and productUsage (proto3 zero values).
  2. Run CodexBarCLI usage --provider grok --json on 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

  1. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    P2Normal priority bug or improvement with limited blast radius.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    no-staleExempts this issue from stale automation.
    and removed
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 21, 2026
  2. clawsweeper commented on Oct 21, 2026

    @clawsweeper

    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:

    • add P2: A source-established single-provider regression hides weekly quota information without blocking the core runtime or first useful run.
    • add impact:ux-friction: The weekly Credits bar disappears despite recoverable billing data, leaving users and JSON consumers without the expected quota view.
    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.
    • add clawsweeper:queueable-fix: Current issue advisory state selects this label.
    • add 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:

    • Establish a failing synthetic ACP active-week plus prepaid-balance regression before implementing the repair.
    • CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --filter 'GrokFailedBillingWorkTests|GrokZeroUsageTests|GrokCreditsProxyFetcherTests|GrokAccountContextTests|GrokPrepaidBalanceTests'
    • make check
    • Verify cancellation, bounded timeout, unavailable credentials, malformed/inactive enrichment, wallet preservation, and no extra request for published ACP usage.

    What I checked:

    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 20, 2026, 9:30 PM ET / October 21, 2026, 01:30 UTC.

  3. added a commit that references this issue on Oct 21, 2026
    10dbc83
  4. steipete commented on Oct 21, 2026

    @steipete
    Owner

    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.

  5. added a commit that references this issue on Oct 21, 2026
    ad0c567
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExempts this issue from stale automation.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions