CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

Grok: SuperGrok Business / team principal fails with "No personal team"

Open vesc-vesc opened this issue 4 months ago • 4 comments

Summary

Grok provider auth succeeds for a SuperGrok Business team member, but usage fetch fails with:

Grok web billing RPC failed with status 9: No personal team.

CLI path also cannot supply usage right now (x.ai/billing returns Method not found on current Grok Build CLI), so there is no working fallback.

This looks distinct from #1805 (weekly vs monthly calculation) and #1712 (xAI Platform prepaid API credits).

Environment

  • macOS 26.x (arm64)
  • CodexBar CLI 0.42.1 (steipete/tap/codexbar)
  • Grok Build CLI installed via Homebrew cask (grok 0.2.99)
  • Authenticated with grok login --device-auth as a team member (not personal SuperGrok only)

Steps to Reproduce

  1. Use an xAI account that is a member of SuperGrok Business / team, not (or not only) a personal SuperGrok principal.
  2. Install Grok Build CLI and run grok login (device/OAuth). Consent as Team.
  3. Confirm ~/.grok/auth.json exists and includes team identity fields (principal_type=Team, team_id, team_role, etc.).
  4. Enable provider and fetch usage:
codexbar config enable --provider grok
codexbar usage --provider grok -v --pretty

Actual Behavior

Verbose output shows both strategies fail:

[grok] fetch strategies:
  - grok.cli (cli) available error=Grok request failed: Method not found
  - grok.web (web) available error=Grok web billing RPC failed with status 9: No personal team.
Error: Grok web billing RPC failed with status 9: No personal team.

Direct probe of the documented web billing endpoint with the same OIDC bearer also returns:

HTTP 200
grpc-status: 9
grpc-message: No%20personal%20team.

against:

POST https://grok.com/grok_api_v2.GrokBuildBilling/GetGrokCreditsConfig

So this is not just a missing login: identity/auth is present, but the billing surface appears personal-team-only.

Expected Behavior

For SuperGrok Business / team principals, CodexBar should either:

  1. Read team/business Grok Build credit usage (preferred), or
  2. Clearly report that team billing is unsupported (instead of failing only with No personal team), and ideally still show identity/plan if available.

Notes / evidence (redacted)

  • grok login succeeds and writes official ~/.grok/auth.json with:
    • auth_mode: oidc
    • principal_type: Team
    • team_role: MEMBER
    • team name/email present
  • Token principal is team-scoped (not personal).
  • Grok CLI ACP path: initialize works; x.ai/billing returns -32601 Method not found (known limitation in recent Grok CLI versions; docs already mention this class of issue).
  • Related but different open issues:
    • #1805 Grok build usage (period/calculation)
    • #1712 Feature Request: XAI Platform (prepaid API credits)

Why this matters

Business/team SuperGrok seats are increasingly common. Today CodexBar can already track OpenAI Codex Team quotas well, but Grok Business members cannot get any usage percentage, which breaks multi-provider quota dashboards.

Happy to test a fix / provide additional redacted payload samples if useful.

vesc-vesc avatar Jul 13 '26 14:07 vesc-vesc

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 13, 2026, 11:28 AM ET / 15:28 UTC.

Summary Keep this issue open. Current main still sends team-scoped Grok credentials through a billing fallback whose unclassified gRPC status 9 becomes the opaque No personal team failure, despite the provider contract promising identity-only degradation when billing is unavailable. The previous ClawSweeper verdict remains valid, and the two linked Grok issues cover distinct products or calculations rather than this principal-routing defect.

Reproducibility: yes. at source level. Current main sends the known CLI Method not found path into a web RPC that reports unclassified status 9 errors verbatim; a live SuperGrok Business account was not used during this review.

Root-cause cluster Relationship: canonical Canonical: https://github.com/steipete/codexbar/issues/2129 Summary: This issue is the canonical report for Grok Business team-principal routing; the supplied related issues concern separate billing products or period calculations.

Members:

  • adjacent_distinct: https://github.com/steipete/codexbar/issues/1712 - That issue requests xAI Platform prepaid API-credit tracking, which uses a separate product and credential surface.
  • adjacent_distinct: https://github.com/steipete/codexbar/issues/1805 - That issue concerns weekly-versus-monthly Grok Build limit calculation after usage has already been obtained.

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Next step The failing source path and safe fallback boundary are clear enough for one focused repair without defining a new billing API.

Review details

Best possible solution:

Parse the official Grok principal type, preserve Grok-sourced identity for team accounts, skip or classify the known personal-team-only fallback, and show a specific unsupported-team-billing diagnostic until a tested team usage API is available.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level. Current main sends the known CLI Method not found path into a web RPC that reports unclassified status 9 errors verbatim; a live SuperGrok Business account was not used during this review.

Is this the best way to solve the issue?

Yes for the bounded repair. Principal-aware classification and identity-only degradation are narrower and safer than guessing an undocumented team billing endpoint.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • The current evidence does not establish a supported xAI team/business usage endpoint or response contract, so a repair must not invent team billing data.
  • The exact auth.json team-principal field stability across Grok CLI versions needs fixture coverage and reporter validation with redacted current data.

Codex review notes: model internal, reasoning high; reviewed against c852c135e10c.

Label changes

Label justifications:

  • P2: A specific provider account type authenticates successfully but cannot retrieve usage, with a bounded Grok-specific blast radius.
  • impact:auth-provider: The failure results from routing a team-scoped Grok principal through billing strategies that assume personal-team access.
  • impact:ux-friction: Users receive an opaque No personal team error rather than retained identity and an actionable account-support explanation.
Evidence reviewed

Acceptance criteria:

  • swift test --filter Grok
  • make test
  • make check

What I checked:

  • Current fallback contract: The Grok documentation says ~/.grok/auth.json supplies identity, the currently unavailable x.ai/billing method should degrade to identity-only, and the next strategy calls the grok.com billing gRPC endpoint. (docs/grok.md:247, c852c135e10c)
  • Unclassified team-principal failure: The web fetcher recognizes only selected authentication failures; other gRPC errors, including reported status 9 No personal team, are returned verbatim instead of being classified as unsupported team billing. (Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:1165, c852c135e10c)
  • Personal billing endpoint: Current main posts to GrokBuildBilling/GetGrokCreditsConfig, matching the endpoint that the reporter demonstrated rejects a team principal. (Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:1213, c852c135e10c)
  • Feature provenance: Merged pull request https://github.com/steipete/CodexBar/pull/965 introduced Grok identity from auth.json, the x.ai/billing strategy, identity-only degradation, and focused auth/billing tests; it merged as commit 0348028 on May 16, 2026. (Sources/CodexBarCore/Providers/Grok/GrokAuth.swift, 0348028)
  • Vision fit: VISION.md explicitly supports provider-limit coverage and bounded bug fixes that follow established provider and test patterns, while reserving broader auth behavior changes for sign-off. (VISION.md:235, c852c135e10c)
  • Related issue distinction: https://github.com/steipete/CodexBar/issues/1712 requests xAI Platform prepaid-credit support, while https://github.com/steipete/CodexBar/issues/1805 concerns Grok Build weekly-versus-monthly calculation after usage is available.

Likely related people:

  • taibaran: Authored the merged Grok provider implementation, including credential parsing, billing strategies, identity fallback, and the original focused tests. (role: feature introducer; confidence: high; commits: c0c3d6d, 479dfd1, 7ff4677; files: Sources/CodexBarCore/Providers/Grok/GrokAuth.swift, Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift, Sources/CodexBarCore/Providers/Grok/GrokStatusProbe.swift)
  • steipete: Refreshed and merged the original Grok provider branch and is directly connected to the current provider integration history. (role: merger and recent integrator; confidence: medium; commits: 0348028; files: Sources/CodexBarCore/Providers/Grok)
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.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

clawsweeper[bot] avatar Jul 13 '26 15:07 clawsweeper[bot]

🦞🔧 ClawSweeper is automatically building this issue.

The issue review finished and no active implementation pull request was found.

Automatic implementation progress:

  • State: Queued
  • Detail: Review complete; no active implementation PR was found. The Codex implementation worker is queued.
  • Run: https://github.com/openclaw/clawsweeper/actions/runs/29277888437
  • Updated: 2026-07-13T19:18:14.109Z
  • Opt out: add clawsweeper:manual-only or clawsweeper:human-review.

clawsweeper[bot] avatar Jul 13 '26 19:07 clawsweeper[bot]

Fixed by #2186, merged as 1b921ecf39305dff56ce30d6bdcc8c5f008f7101.

SuperGrok Business currently provides no Team usage numbers through the billing methods CodexBar can query. CodexBar now degrades gracefully for the exact Team-principal failure: it preserves the authenticated Team identity and reports an explicit Grok team usage is unavailable... diagnostic instead of failing with No personal team.

Verified by source review and deterministic gRPC-web stub tests. Live SuperGrok Business credentials were unavailable, so no live account probe was run. Closing as gracefully degraded pending a server-side Team usage API.

steipete avatar Jul 16 '26 19:07 steipete

Live Team-principal proof (CodexBar 0.44.0)

Post-upgrade check on a real SuperGrok Business Team member seat (redacted):

  • CodexBar CLI: 0.44.0 (steipete/tap/codexbar)
  • Grok Build CLI: 0.2.103
  • ~/.grok/auth.json: principal_type=Team, team_role=MEMBER (OIDC SuperGrok)
codexbar usage --provider grok --format json --pretty
# exit 0
# primary/secondary/tertiary: null
# diagnostic: "Grok team usage is unavailable from the current billing surface; identity is still available."
# accountEmail + accountOrganization present; loginMethod SuperGrok

CLI path still: x.ai/billing → Method not found (stdio). No remaining % available yet — matches maintainer note that SuperGrok Business has no Team usage surface for CodexBar. Identity-only degrade works as intended on a live Team account.

vesc-vesc avatar Jul 18 '26 01:07 vesc-vesc