Skip to content

Dashboard surface for Grok reset coupons #4329

Description

@lidge-jun

Area

Dashboard

What are you trying to accomplish?

When an xAI Grok account hits its weekly limit, I want to see whether that account still has a reset coupon and spend one without leaving the dashboard — the same way the Codex account pool already shows a ticket badge and a redemption dialog.

What prevents this today?

#4306 shipped the whole backend for this: a gRPC-Web client for prod_mc_billing.ConsumerUiSvc, a journaled idempotency ledger, GET /api/grok/reset-coupons, POST /api/grok/reset-coupons/consume, and ocx account grok-reset-coupons. The dashboard was explicitly out of scope there, so the Providers > xAI Grok > Accounts tab shows a weekly-limit bar at 100% and says nothing about the coupon that could reset it. The only way to see or spend one is the terminal.

What should OpenCodex do?

Each signed-in xAI account row should carry a ticket badge with its remaining coupon count, muted at zero and highlighted when a coupon is available. Clicking the badge should open a dialog that lists each coupon's validity window, names the coupon closest to expiry as the one that will be spent, and asks for confirmation before redeeming it.

The dialog must be honest about the outcome, because redemption is irreversible:

  • A replayed redemption that settled as a failure arrives as HTTP 200 with replayed: true and the original code. It must be reported as a failure, never as a completed reset.
  • A redemption that times out has an unknown outcome — the route may still be executing it, and a record that is still open re-executes on the next attempt. The dialog must stop posting and offer a re-read instead of a retry button.
  • A ledger-capacity refusal and an identity mismatch need their own messages, and no message may claim a coupon was not consumed unless that is known.

Rows that cannot spend a coupon — an account needing re-authentication, an API-key xAI setup, any non-xAI provider — should show no badge and trigger no billing read.

Example usage or interface

Today:

$ ocx account grok-reset-coupons
restok_vpYDqo  valid 2026-08-13 → 2026-09-13

Wanted, in Providers > xAI Grok > Accounts:

p***1@gmail.com   [🎫 1]  [Edit alias]  [🗑]
Weekly limit                          25% used

Clicking 🎫 1 opens "Grok reset coupons" listing Next to use · Valid from Aug 13, 2026 · Expires Sep 13, 2026 (1d left) with a "Use 1 coupon" button and a confirmation step.

Alternatives or workarounds

Running ocx account grok-reset-coupons --consume --yes in a terminal, which is what exists today. Folding the coupon count into the xAI quota probe would make the badge free to render, but it would spend a billing RPC on every quota refresh and needs a server change; that is worth doing later, not first.

Additional context

Backend: #4306. The dashboard mirrors the Codex reset-credit surface in gui/src/components/codex-account-pool-helpers.tsx and codex-account-reset-modal.tsx.

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

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

    account-poolOAuth, credentials, Codex pool, quota, failover, plansenhancementNew feature or requestguiDashboard, tray, settings UI

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions