Skip to content

Dashboard surface for Grok reset coupons #4329

Closed

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

  1. added
    account-poolOAuth, credentials, Codex pool, quota, failover, plans
    guiDashboard, tray, settings UI
    on Sep 12, 2026
  2. lidge-jun commented on Sep 12, 2026

    @lidge-jun
    OwnerAuthor

    리뷰 · 우선순위 48 / 80

    설명

    이 이슈는 xAI Grok 계정 주간 한도에 걸렸을 때, 대시보드에서 리셋 쿠폰 장수를 보고 바로 쓰게 해 달라는 요청이다. Codex 계정 풀이 이미 티켓 뱃지와 사용 다이얼로그를 쓰는 것과 같은 자리를 말한다. 백엔드는 #4306으로 이미 dev에 있다. gRPC-Web 클라이언트, 저널 원장, GET /api/grok/reset-coupons, POST /api/grok/reset-coupons/consume, ocx account grok-reset-coupons까지. 대시보드만 의도적으로 빠져 있어서, Providers > xAI Grok > Accounts는 한도 바만 100%로 보이고 쿠폰은 터미널로만 확인한다.

    요구가 구체적이다. OAuth 행마다 남은 장수 뱃지(0이면 흐리게, 있으면 강조), 클릭 시 유효 기간 목록, 만료가 가까운 쿠폰을 쓴다고 이름 붙이기, 확인 후에만 사용. 결과가 애매할 때의 문구도 이슈가 미리 못 박는다. replayed failure는 200이어도 실패로, 타임아웃은 모름으로 두고 재POST가 아니라 재읽기, capacity·identity mismatch는 각자 메시지, “안 썼다”고 말하려면 정말 알아야 한다. reauth가 필요한 행, API 키 xAI, 다른 프로바이더는 뱃지도 없고 빌링 읽기도 없다.

    대안으로는 CLI ocx account grok-reset-coupons --consume --yes와, 나중에 쿠폰 수를 xAI 쿼타 probe에 실어 뱃지를 공짜로 그리는 후속이 적혀 있다. 후자는 서버 변경이 필요해서 이번 단위에 넣지 말라고 한 판단이 맞다. 미러 대상으로 찍은 Codex 표면은 gui/src/components/codex-account-pool-helpers.tsx와 codex-account-reset-modal.tsx다. 지금 dev HEAD(a0676af29)에도 그 파일이 있고, Grok 쪽만 비어 있던 상태가 이슈 서술과 같다.

    구현은 이미 #4330으로 올라와 있다. 같은 날 연 이슈·PR이고, PR 본문이 Closes #4329를 건다. 이슈 본문의 성공 기준이 PR의 세 가지 무거운 행동(정산 code로 성공 판정, abort 후 POST 금지, roster epoch와 계정별 token 분리)과 그대로 맞는다. 지금 따로 설계를 더 쓸 필요는 거의 없고, #4330 리뷰·CI가 이 이슈의 완료 조건이다. 같은 주제를 다른 이슈로 다시 열 필요도 없다.

    경로 #4306 / src/server/management/grok-coupon-routes.ts - 이슈가 가리키는 백엔드가 HEAD에 있다. 대시보드만 비어 있던 상태가 맞다.

    경로 Codex 미러 - codex-account-pool-helpers.tsx·codex-account-reset-modal.tsx 패턴을 따르라는 안내가 #4330 구현과 일치한다.

    경로 후속(쿼타 probe 접기) - 이슈가 “나중”으로 미룬 선택이 맞다. 뱃지를 무료로 그리려면 서버 변경이 필요하고, 이번 단위 범위를 넘는다.

    경로 #4330 - 구현 PR이 이미 열려 있고 Closes를 건다. 이슈만 남기고 PR을 닫을 이유는 없다.

    메인테이너의 판단이 필요한 지점

    너의 추천
    이슈 자체는 구현 스펙으로 충분하다. #4330 CI가 초록이면 그 PR을 머지해 이 이슈를 닫아라. 쿼타 접기는 별도 후속 이슈로 남겨도 된다. types/config 스플릿과 무관하다.

    이 댓글은 grok-bot이 작성했습니다

  3. lidge-jun commented on Sep 12, 2026

    @lidge-jun
    OwnerAuthor

    Shipped in #4330, merged into dev as dbad475. The badge and dialog are live on Providers > xAI Grok > Accounts; ocx account grok-reset-coupons still covers the terminal path.

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