Skip to content

fix: show SuperGrok Heavy from billing subscription tier - #2991

Merged
steipete merged 11 commits into
steipete:mainfrom
olddonkey:fix/grok-supergrok-heavy-plan
Aug 17, 2026
Merged

fix: show SuperGrok Heavy from billing subscription tier#2991
steipete merged 11 commits into
steipete:mainfrom
olddonkey:fix/grok-supergrok-heavy-plan

Conversation

@olddonkey

@olddonkey olddonkey commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Grok OIDC login always labeled the account as SuperGrok. The credits API does not include the plan name; the live value is subscription_tier_display on GET /v1/settings.

Usage percent is unchanged from the existing CodexBar credits rule: a parseable period without creditUsagePercent is 0%.

Changes

  • Fetch /v1/settings after a successful CLI-proxy credits call and map subscription_tier_display to loginMethod
  • Also apply that settings tier on a successful CLI RPC billing result, and on the identity-only team fallback
  • Settings failure keeps billing data and falls back to the OIDC SuperGrok label

Test plan

  • Focused Grok unit tests, including CLI RPC snapshots with webBilling == nil
  • Local swift build --product CodexBarCLI
  • Live auto usage --provider grok on SuperGrok Heavy reports loginMethod: SuperGrok Heavy
  • Live --source cli still fails with Method not found on grok 1.0.4 (expected); the RPC success path is covered by unit tests

Live proof (redacted)

{
  "source": "grok-cli-proxy",
  "loginMethod": "SuperGrok Heavy",
  "primary": { "resetsAt": "2026-08-23T18:42:45Z", "usedPercent": 1 }
}

Not sent for review.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

OIDC login always mapped to SuperGrok. Read subscriptionTier from the
CLI credits envelope and stop treating Heavy's omitted credit percent
as 0% usage.
@olddonkey
olddonkey force-pushed the fix/grok-supergrok-heavy-plan branch from 4d886ae to 57189d2 Compare August 16, 2026 23:26
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 10:34 PM ET / August 17, 2026, 02:34 UTC.

ClawSweeper review

What this changes

The PR reads the authenticated Grok CLI settings tier and uses it to label usage snapshots as SuperGrok or SuperGrok Heavy across CLI, proxy, and team-identity paths.

Merge readiness

Ready for maintainer review

This focused Grok label fix is correct on review and has sufficient redacted live proof; it is ready for ordinary maintainer review after the current platform checks finish.

Priority: P2
Reviewed head: e91d9693b61bf9e1ed8b95d761a577b6986c7496

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused provider fix with real after-fix output, explicit fallback handling, and targeted regression coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body contains redacted after-fix live CLI output showing the SuperGrok Heavy label and retained usage result from the CLI-proxy route.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body contains redacted after-fix live CLI output showing the SuperGrok Heavy label and retained usage result from the CLI-proxy route.
Evidence reviewed 6 items Current main lacks tier enrichment: Current main derives Grok loginMethod only from stored credentials, so it cannot distinguish a SuperGrok Heavy subscription from the OIDC SuperGrok fallback.
Account isolation: The PR fetches the settings tier only for auth-file billing and deliberately skips it for a cookie/gRPC fallback session, preventing cross-principal plan labels.
Bounded optional request: Settings enrichment has a two-second request timeout and bounded join; timeout or ordinary request failure returns no overlay without discarding usage.
Findings None None.
Security None None.

How this fits together

CodexBar’s Grok provider resolves credentials, obtains usage through CLI RPC or billing fallbacks, and emits a normalized usage snapshot to the menu bar and CLI. This change enriches that snapshot with the subscription label from the matching authenticated CLI settings endpoint.

flowchart LR
    A[Grok auth file] --> B[CLI RPC or proxy billing]
    B --> C[Usage snapshot]
    A --> D[CLI settings endpoint]
    D --> E[Authenticated tier enrichment]
    C --> E
    E --> F[Normalized Grok identity]
    F --> G[Menu bar and CLI output]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and coverage production +191/-22, tests +365, docs/changelog +21/-1 across 11 files Most added code is accompanied by focused tests for the new provider branches and identity boundaries.

Technical review

Best possible solution:

Merge the bounded authenticated settings enrichment once the pending platform matrix validates the final head, retaining the existing no-overlay fallback when settings are unavailable.

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

Yes. Current main’s identity mapping unconditionally uses the OIDC credential label, while the supplied redacted after-fix CLI output demonstrates the SuperGrok Heavy result through the corrected route.

Is this the best way to solve the issue?

Yes. Reading the authenticated CLI settings tier is the narrow source-of-truth path, while the implementation preserves existing usage parsing and isolates browser-cookie sessions.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The PR corrects an inaccurate Grok subscription label with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body contains redacted after-fix live CLI output showing the SuperGrok Heavy label and retained usage result from the CLI-proxy route.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains redacted after-fix live CLI output showing the SuperGrok Heavy label and retained usage result from the CLI-proxy route.

Evidence

What I checked:

Likely related people:

  • steipete: Recent Grok credit parsing and usage-label commits establish the current behavior this PR extends. (role: recent Grok-provider contributor; confidence: high; commits: 79077dd72a2e, 2fa8bae27a76; files: Sources/CodexBarCore/Providers/Grok/GrokStatusProbe.swift, Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift, Sources/CodexBarCore/Providers/Grok/GrokCreditsProxyFetcher.swift)
  • Vincent Peng: Introduced the Grok team-principal billing fallback that this PR enriches with an identity label. (role: team-fallback contributor; confidence: high; commits: f1a5d3691e3d; files: Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift, Sources/CodexBarCore/Providers/Grok/GrokStatusProbe.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the active platform test matrix finish on the final head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • 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.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-16T23:47:15.586Z sha 23f1288 :: needs changes before merge. :: [P2] Propagate the settings tier through the CLI route
  • reviewed 2026-08-16T23:56:40.262Z sha 221a74e :: needs changes before merge. :: [P2] Carry the settings tier into the web team fallback
  • reviewed 2026-08-17T00:12:02.379Z sha c7a6355 :: needs changes before merge. :: [P2] Reject tier-only credits responses so the usage fallback still runs
  • reviewed 2026-08-17T00:21:09.860Z sha 72c4ac5 :: needs changes before merge. :: [P2] Reject tier-only credits responses so the fallback still runs
  • reviewed 2026-08-17T00:29:30.844Z sha 71b4a2f :: needs changes before merge. :: [P2] Expire or remove the cached settings tier
  • reviewed 2026-08-17T00:36:28.775Z sha 453e4f2 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T00:49:25.174Z sha 187c88a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T01:15:24.942Z sha 7fe7347 :: needs maintainer review before merge. :: none

The credits endpoint does not include subscriptionTier. Use
subscription_tier_display from /v1/settings, and drop inferred 0%
usage on SuperGrok Heavy.
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Aug 16, 2026
Plan name still comes from settings. Credits percent stays on the
existing rule: a period without creditUsagePercent is 0%.
@olddonkey

Copy link
Copy Markdown
Contributor Author

Addressing the ClawSweeper review on 464165b:

  • Added redacted live proof to the PR body from a real SuperGrok Heavy account.
  • Latest head is 23f1288e5. The settings response is subscription_tier_display= SuperGrok Heavy, and codexbar usage --provider grok now reports loginMethod: SuperGrok Heavy.
  • Usage stays at the existing CodexBar credits rule (period without creditUsagePercent = 0%). We are not treating Heavy omitted percent as unknown.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 16, 2026
Auto mode tries grok agent billing first. A successful RPC snapshot
had no webBilling, so identity stayed SuperGrok. Load
subscription_tier_display on that path too.
@olddonkey

Copy link
Copy Markdown
Contributor Author

Addressing the latest ClawSweeper finding on 23f1288e5:

The settings tier is now attached on the CLI RPC success path too (GrokUsageSnapshot.subscriptionTier), not only webBilling. Identity-only team fallback also keeps the settings label. Usage percent is still the existing credits rule.

@clawsweeper re-review

@olddonkey

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Aug 16, 2026
SwiftFormat hoistTry/hoistAwait failed in CI. Load the settings tier
into a local before constructing snapshots, apply it at the web
strategy exit so cookie and team fallbacks get the same plan, and
bound the enrichment request at two seconds.
@olddonkey

Copy link
Copy Markdown
Contributor Author

Addressing the latest Codex review on 221a74e:

  • P1: hoisted the settings try await into locals in GrokStatusProbe so SwiftFormat hoistTry / hoistAwait is clean.
  • P2: settings enrichment now happens at the GrokWebFetchStrategy exit, covering CLI-proxy, cookie/gRPC fallback, and team identity-only.
  • P2: settings uses a 2s request timeout plus BoundedTaskJoin (2s), and caches the last successful tier per user.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Aug 17, 2026
Cookie billing is a different browser session, so do not attach the
auth.json settings plan. Cache keys now include principal type and
team id so Personal and Team do not share a stale tier.
@olddonkey

Copy link
Copy Markdown
Contributor Author

Addressing the latest account-isolation review:

  • P1: settings tier is applied only when authenticatedByAuthFile == true. Cookie/gRPC fallback no longer reuses the auth.json plan. The old cookie test that expected Heavy is now inverted.
  • P2: settings cache keys are user:<id> vs team:<teamId>:<id>, so Personal and Team principals no longer share a stale tier.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

A credits payload with only subscriptionTier is not usable usage.
Throw parseFailed and let cookie/gRPC fallback continue; the plan
name still comes from settings enrichment.
@olddonkey

Copy link
Copy Markdown
Contributor Author

Addressing the latest P2 on 72c4ac5:

Tier-only credits payloads now parseFailed instead of returning empty usage. That lets fetchProxyFirst continue into legacy cookie/gRPC billing. Plan name still comes from /v1/settings on the auth-file path.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Do not keep SuperGrok Heavy after a settings timeout or empty 200.
A failed or missing subscription_tier_display now falls back to the
OIDC SuperGrok label for this refresh.
@olddonkey

Copy link
Copy Markdown
Contributor Author

Addressing the latest P2 on 71b4a2f:

Removed the process-lifetime settings-tier cache. Timeouts, request failures, and 200s without subscription_tier_display now return no overlay, so identity falls back to OIDC SuperGrok instead of a stale Heavy label.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 17, 2026
Record the user-visible plan-label fix under 0.51.1 Unreleased.
@olddonkey

Copy link
Copy Markdown
Contributor Author

Added the missing 0.51.1 changelog bullet for the user-visible SuperGrok Heavy plan label.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@steipete
steipete merged commit f3f3cce into steipete:main Aug 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants