Skip to content

feat(TrifolaKit): add Grok SuperGrok plan usage to Quota and MCP - #13

Merged
ss251 merged 6 commits into
mainfrom
feat/grok-quota
Jul 21, 2026
Merged

ss251 merged 6 commits into
mainfrom
feat/grok-quota

Conversation

@ss251

@ss251 ss251 commented Jul 21, 2026 •

Copy link
Copy Markdown
Owner

Intent

Add Grok SuperGrok plan usage to trifola's Quota screen and MCP quota_windows as a third provider (#5), following the existing ClaudeQuota network pattern: read the OAuth bearer token from ~/.grok/auth.json (OIDC/SuperGrok scope, legacy fallback), fetch grok.com's GetGrokCreditsConfig gRPC-web billing endpoint, and parse the protobuf for used-percent + reset time. Consent-gated (grokQuotaAccessEnabled, default off), honest error taxonomy, injectable HTTP transport so tests never hit the network, and the bearer token must never be logged/printed/persisted outside the request Authorization header. No change to Claude/Codex quota behavior.

What Changed

  • Adds a consent-gated Grok SuperGrok quota provider (GrokQuota) that reads the OAuth bearer from ~/.grok/auth.json (OIDC/SuperGrok scope with legacy fallback), POSTs to grok.com’s GetGrokCreditsConfig gRPC-web billing endpoint, and parses used-percent plus reset time from the protobuf response, with an injectable HTTP transport and redacted credential types so the token never leaves the request Authorization header.
  • Surfaces Grok as a third provider on the Quota screen and in MCP quota_windows (alongside Claude and Codex), behind grokQuotaAccessEnabled (default off / “Show Grok usage”), with honest unavailable statuses when consent, credentials, or the endpoint fail, and no change to Claude/Codex quota behavior.
  • Locks the new path in with unit and MCP tests, documents the SuperGrok privacy row and architecture, and hardens the gRPC-web frame parser plus the MCP Grok wait budget so partial payloads and one retry still fit the bridge timeout.

Risk Assessment

⚠️ Medium: Feature meets the stated intent and prior timeout/frame fixes landed cleanly, but MCP worst-case latency roughly doubles when all providers are consented and a residual truncated-frame parse edge case remains.

Testing

Exercised Grok credential parse, gRPC-web billing parse, consent-gated fetch, MCP quota_windows third provider, and headless Quota UI renders; all focused suites passed and reviewer-visible PNG plus MCP JSON artifacts confirm SuperGrok usage without live network or token leakage.

  • Evidence: Plan quota UI dark — Claude + Grok SuperGrok, consent-off, degradation (local file: /var/folders/nc/j5wdfhws2q56jzdcj_jkdvww0000gn/T/no-mistakes-evidence/01KY1D3J1EJYRAP8745BXQYB16/quota-dark.png)
  • Evidence: Plan quota UI light — Claude + Grok SuperGrok, consent-off, degradation (local file: /var/folders/nc/j5wdfhws2q56jzdcj_jkdvww0000gn/T/no-mistakes-evidence/01KY1D3J1EJYRAP8745BXQYB16/quota-light.png)
  • Evidence: Provider-parity quota section (dark) (local file: /var/folders/nc/j5wdfhws2q56jzdcj_jkdvww0000gn/T/no-mistakes-evidence/01KY1D3J1EJYRAP8745BXQYB16/parity/quota-section-dark.png)
  • Evidence: Provider-parity quota section (light) (local file: /var/folders/nc/j5wdfhws2q56jzdcj_jkdvww0000gn/T/no-mistakes-evidence/01KY1D3J1EJYRAP8745BXQYB16/parity/quota-section-light.png)
Evidence: MCP quota_windows end-user transcript (claude + codex + grok SuperGrok)

MCP tool: quota_windows [claude] available=True status=ok — Session (5h) 91%, Weekly 58% [codex] available=True status=ok — 5 hour 37.5%, Weekly 62.25% [grok] available=True status=ok — SuperGrok 42.5% used, reset_runway=11d Consent gate (default): grokQuotaAccessEnabled=false Consent-off status: consent not granted in trifola Settings Token redaction: GrokQuotaCredentials(token: <redacted>, ...)

MCP tool: quota_windows
note: Provider quota is consent-gated independently. Claude reads its OAuth usage endpoint; Codex reads local rollout rate-limit events only; Grok reads SuperGrok plan usage from xAI's billing endpoint after consent. A provider is always present, including when consent or data is unavailable.

[claude] available=True status=ok
  - Session (5h): 91% used, reset_runway=35m
  - Weekly (all models): 58% used, reset_runway=4d

[codex] available=True status=ok
  - 5 hour: 37.5% used, reset_runway=2h
  - Weekly: 62.25% used, reset_runway=3d

[grok] available=True status=ok
  - SuperGrok: 42.5% used, reset_runway=11d

Consent gate (default): grokQuotaAccessEnabled=false
Consent-off status: consent not granted in trifola Settings
Token redaction: GrokQuotaCredentials(token: <redacted>, expiresAt: 2030-01-01T00:00:00Z, scope: https://auth.x.ai::client)
Evidence: MCP quota_windows structured evidence (intent checks + full payload + error taxonomy)
{
  "error_taxonomy": [
    {
      "case": "noCredentials",
      "leaks_token": "false",
      "line": "Grok plan usage needs a signed-in xAI session \u2014 run `grok login`."
    },
    {
      "case": "expired",
      "leaks_token": "false",
      "line": "Grok rejected the saved credentials \u2014 run `grok login` to refresh."
    },
    {
      "case": "unauthorized",
      "leaks_token": "false",
      "line": "Grok rejected the saved credentials \u2014 run `grok login` to refresh."
    },
    {
      "case": "network(\"timeout\")",
      "leaks_token": "false",
      "line": "Grok plan usage endpoint didn't answer. Costs and attention don't need it."
    },
    {
      "case": "badPayload",
      "leaks_token": "false",
      "line": "Couldn't read Grok plan usage."
    }
  ],
  "intent_checks": {
    "consent_default_off": true,
    "consent_off_blocks_fetch": "consent not granted in trifola Settings",
    "credential_description_redacted": "GrokQuotaCredentials(token: <redacted>, expiresAt: 2030-01-01T00:00:00Z, scope: https://auth.x.ai::client)",
    "provider_keys": [
      "claude",
      "codex",
      "grok"
    ],
    "superGrok_window": {
      "title": "SuperGrok",
      "used_percent": 42.5
    },
    "third_provider_in_quota_windows": true,
    "token_never_in_mcp_reply": true
  },
  "quota_windows_payload": {
    "note": "Provider quota is consent-gated independently. Claude reads its OAuth usage endpoint; Codex reads local rollout rate-limit events only; Grok reads SuperGrok plan usage from xAI's billing endpoint after consent. A provider is always present, including when consent or data is unavailable.",
    "providers": {
      "claude": {
        "available": true,
        "fetched_at": "2027-01-03T18:13:20Z",
        "provider": "claude",
        "status": "ok",
        "windows": [
          {
            "reset_in_seconds": 2100,
            "reset_runway": "35m",
            "resets_at": "2027-01-03T18:48:20Z",
            "title": "Session (5h)",
            "used_fraction": 0.91,
            "used_percent": 91
          },
          {
            "reset_in_seconds": 345600,
            "reset_runway": "4d",
            "resets_at": "2027-01-07T18:13:20Z",
            "title": "Weekly (all models)",
            "used_fraction": 0.58,
            "used_percent": 58
          }
        ]
      },
      "codex": {
        "available": true,
        "fetched_at": "2027-01-03T18:13:20Z",
        "provider": "codex",
        "status": "ok",
        "windows": [
          {
            "reset_in_seconds": 7200,
            "reset_runway": "2h",
            "resets_at": "2027-01-03T20:13:20Z",
            "title": "5 hour",
            "used_fraction": 0.375,
            "used_percent": 37.5
          },
          {
            "reset_in_seconds": 259200,
            "reset_runway": "3d",
            "resets_at": "2027-01-06T18:13:20Z",
            "title": "Weekly",
            "used_fraction": 0.6225,
            "used_percent": 62.25
          }
        ]
      },
      "grok": {
        "available": true,
        "fetched_at": "2026-07-21T04:10:41Z",
        "provider": "grok",
        "status": "ok",
        "windows": [
          {
            "reset_in_seconds": 1000000,
            "reset_runway": "11d",
            "resets_at": "2027-01-15T08:00:00Z",
            "title": "SuperGrok",
            "used_fraction": 0.425,
            "used_percent": 42.5
          }
        ]
      }
    }
  }
}
Evidence: Raw MCP evidence dump (JSON-RPC reply included)
{
  "consent_off_status" : "consent not granted in trifola Settings",
  "credential_description" : "GrokQuotaCredentials(token: <redacted>, expiresAt: 2030-01-01T00:00:00Z, scope: https:\/\/auth.x.ai::client)",
  "error_taxonomy" : [
    {
      "case" : "noCredentials",
      "leaks_token" : "false",
      "line" : "Grok plan usage needs a signed-in xAI session — run `grok login`."
    },
    {
      "case" : "expired",
      "leaks_token" : "false",
      "line" : "Grok rejected the saved credentials — run `grok login` to refresh."
    },
    {
      "case" : "unauthorized",
      "leaks_token" : "false",
      "line" : "Grok rejected the saved credentials — run `grok login` to refresh."
    },
    {
      "case" : "network(\"timeout\")",
      "leaks_token" : "false",
      "line" : "Grok plan usage endpoint didn't answer. Costs and attention don't need it."
    },
    {
      "case" : "badPayload",
      "leaks_token" : "false",
      "line" : "Couldn't read Grok plan usage."
    }
  ],
  "grokQuotaAccessEnabled_default" : false,
  "has_claude_codex_grok" : true,
  "provider_keys" : [
    "claude",
    "codex",
    "grok"
  ],
  "quota_windows_jsonrpc" : "{\"id\":1,\"jsonrpc\":\"2.0\",\"result\":{\"content\":[{\"text\":\"{\\\"note\\\":\\\"Provider quota is consent-gated independently. Claude reads its OAuth usage endpoint; Codex reads local rollout rate-limit events only; Grok reads SuperGrok plan usage from xAI's billing endpoint after consent. A provider is always present, including when consent or data is unavailable.\\\",\\\"providers\\\":{\\\"claude\\\":{\\\"available\\\":true,\\\"fetched_at\\\":\\\"2027-01-03T18:13:20Z\\\",\\\"provider\\\":\\\"claude\\\",\\\"status\\\":\\\"ok\\\",\\\"windows\\\":[{\\\"reset_in_seconds\\\":2100,\\\"reset_runway\\\":\\\"35m\\\",\\\"resets_at\\\":\\\"2027-01-03T18:48:20Z\\\",\\\"title\\\":\\\"Session (5h)\\\",\\\"used_fraction\\\":0.91,\\\"used_percent\\\":91},{\\\"reset_in_seconds\\\":345600,\\\"reset_runway\\\":\\\"4d\\\",\\\"resets_at\\\":\\\"2027-01-07T18:13:20Z\\\",\\\"title\\\":\\\"Weekly (all models)\\\",\\\"used_fraction\\\":0.58,\\\"used_percent\\\":58}]},\\\"codex\\\":{\\\"available\\\":true,\\\"fetched_at\\\":\\\"2027-01-03T18:13:20Z\\\",\\\"provider\\\":\\\"codex\\\",\\\"status\\\":\\\"ok\\\",\\\"windows\\\":[{\\\"reset_in_seconds\\\":7200,\\\"reset_runway\\\":\\\"2h\\\",\\\"resets_at\\\":\\\"2027-01-03T20:13:20Z\\\",\\\"title\\\":\\\"5 hour\\\",\\\"used_fraction\\\":0.375,\\\"used_percent\\\":37.5},{\\\"reset_in_seconds\\\":259200,\\\"reset_runway\\\":\\\"3d\\\",\\\"resets_at\\\":\\\"2027-01-06T18:13:20Z\\\",\\\"title\\\":\\\"Weekly\\\",\\\"used_fraction\\\":0.6225,\\\"used_percent\\\":62.25}]},\\\"grok\\\":{\\\"available\\\":true,\\\"fetched_at\\\":\\\"2026-07-21T04:10:41Z\\\",\\\"provider\\\":\\\"grok\\\",\\\"status\\\":\\\"ok\\\",\\\"windows\\\":[{\\\"reset_in_seconds\\\":1000000,\\\"reset_runway\\\":\\\"11d\\\",\\\"resets_at\\\":\\\"2027-01-15T08:00:00Z\\\",\\\"title\\\":\\\"SuperGrok\\\",\\\"used_fraction\\\":0.425,\\\"used_percent\\\":42.5}]}}}\",\"type\":\"text\"}],\"isError\":false}}",
  "quota_windows_payload" : {
    "note" : "Provider quota is consent-gated independently. Claude reads its OAuth usage endpoint; Codex reads local rollout rate-limit events only; Grok reads SuperGrok plan usage from xAI's billing endpoint after consent. A provider is always present, including when consent or data is unavailable.",
    "providers" : {
      "claude" : {
        "available" : true,
        "fetched_at" : "2027-01-03T18:13:20Z",
        "provider" : "claude",
        "status" : "ok",
        "windows" : [
          {
            "reset_in_seconds" : 2100,
            "reset_runway" : "35m",
            "resets_at" : "2027-01-03T18:48:20Z",
            "title" : "Session (5h)",
            "used_fraction" : 0.91000000000000003,
            "used_percent" : 91
          },
          {
            "reset_in_seconds" : 345600,
            "reset_runway" : "4d",
            "resets_at" : "2027-01-07T18:13:20Z",
            "title" : "Weekly (all models)",
            "used_fraction" : 0.57999999999999996,
            "used_percent" : 58
          }
        ]
      },
      "codex" : {
        "available" : true,
        "fetched_at" : "2027-01-03T18:13:20Z",
        "provider" : "codex",
        "status" : "ok",
        "windows" : [
          {
            "reset_in_seconds" : 7200,
            "reset_runway" : "2h",
            "resets_at" : "2027-01-03T20:13:20Z",
            "title" : "5 hour",
            "used_fraction" : 0.375,
            "used_percent" : 37.5
          },
          {
            "reset_in_seconds" : 259200,
            "reset_runway" : "3d",
            "resets_at" : "2027-01-06T18:13:20Z",
            "title" : "Weekly",
            "used_fraction" : 0.62250000000000005,
            "used_percent" : 62.25
          }
        ]
      },
      "grok" : {
        "available" : true,
        "fetched_at" : "2026-07-21T04:10:41Z",
        "provider" : "grok",
        "status" : "ok",
        "windows" : [
          {
            "reset_in_seconds" : 1000000,
            "reset_runway" : "11d",
            "resets_at" : "2027-01-15T08:00:00Z",
            "title" : "SuperGrok",
            "used_fraction" : 0.42499999999999999,
            "used_percent" : 42.5
          }
        ]
      }
    }
  },
  "superGrok_title" : "SuperGrok",
  "superGrok_used_percent" : 42.5,
  "token_leaked_in_mcp_reply" : false
}
Evidence: Focused test run summary
Grok SuperGrok quota verification
All focused suites passed (GrokQuota 19, MCP/consent 19).
UI: --render-quota PNGs show Claude+Grok SuperGrok, consent-off Access off, degradation.
MCP: quota_windows returns claude+codex+grok; SuperGrok 42.5% via stub; consent default off; token redacted.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 3 issues (1 warning, 2 infos)
  • ⚠️ Sources/TrifolaKit/MCPServer.swift:140 - grokQuotaFetchTimeout is 18s, but GrokQuotaFetcher.fetch uses a 15s per-request timeout and retries once on timeout/408/502/503/504/deadline (up to ~30s). Claude deliberately sets quotaFetchTimeout (35) past its ~30s request timeout; Grok does not. On a transient timeout, blockingGrokQuotaFetch will return "grok quota fetch timed out" while the detached retry is still in flight, so MCP quota_windows can report unavailable even when the retry would succeed. Raise grokQuotaFetchTimeout to ≥ ~32–35s (and update the ≤60 budget test), or stop retrying under the MCP bridge / shrink per-attempt timeout so 2×request + margin fits the wait.
  • ℹ️ Sources/TrifolaKit/GrokQuota.swift:246 - grpcWebDataFrames returns [] (discarding already-parsed frames) when trailing incomplete header bytes remain after valid frames (guard index + 5 &lt;= bytes.count else { return [] }). Trailer parsing uses break instead. Uncommon for clean gRPC-web bodies, but a 1–4 byte trailer pad would fail a otherwise-valid SuperGrok payload. Prefer break / return frames on short remainder.
  • ℹ️ Sources/TrifolaKit/GrokQuota.swift:196 - Used-% is recovered only from fixed32 (wire type 5) floats with path ending in field 1 in [0,100]; fixed64/double (wire type 1) values are skipped entirely in scanProtobuf. That matches the synthetic fixtures and CodexBar-derived shape claimed in the PR, but any upstream schema shift to double percent would surface as permanent badPayload/"Couldn't read Grok plan usage" with no alternate path. Residual schema-coupling risk, not a logic error against current fixtures.

🔧 Fix: Raise Grok MCP wait; keep partial frames
3 issues (1 warning, 2 infos) still open:

  • ℹ️ Sources/TrifolaKit/GrokQuota.swift:253 - Round-1 fixed incomplete headers (break instead of return []), but a complete 5-byte header whose length overruns the remaining body still does return [], discarding any already-parsed data frames. Trailer parsing uses break for the same case. A valid SuperGrok data frame followed by a truncated later frame (common under partial reads) therefore fails as badPayload even though a usable payload was already collected. Change the overrun branch to break / return frames for parity with the header fix.
  • ℹ️ Sources/TrifolaKit/MCPServer.swift:358 - tools/list and quota_windows note/description correctly describe triple-provider Claude/Codex/Grok, but initializeResult instructions still say quota_windows is "real Claude + Codex plan limits". Agents that only read server instructions will miss the Grok SuperGrok surface. Update that phrase to include Grok.
  • ⚠️ Sources/TrifolaKit/MCPServer.swift:667 - quotaWindows() invokes Claude, Codex, and Grok providers sequentially. After raising grokQuotaFetchTimeout to 35s to cover the 15s×2 retry budget, worst-case live tool wall-clock is roughly credentialReadTimeout + 35 + 2 + 35 ≈ 75s (budget test now ≤90), vs the prior ~40s Claude+Codex cap. Default-off consent keeps this dormant, but with all three consents enabled a dual-network stall can block MCP stdio much longer than before. Overlap the two network bridges (wall clock ≈ max(claude, grok) + codex) if that latency budget still matters.
✅ **Test** - passed

✅ No issues found.

  • swift test --filter GrokQuota (credentials OIDC/legacy, protobuf/gRPC-web parser, stub fetcher, error taxonomy, MCP blocking Grok fetch — 19 passed)
  • swift test --filter &#39;MCPQuota|quotaWindows|QuotaConsent&#39; (triple-provider quota_windows, consent gates for Claude/Codex/Grok, timeout budgets — 19 passed)
  • swift build --product Trifola then Trifola --render-quota &lt;evidence&gt;/quota (dark/light Plan quota UI with Grok SuperGrok + consent-off + degradation)
  • Trifola --render-parity &lt;evidence&gt;/parity (includes quota-section dark/light)
  • Evidence harness: stubbed auth.json + GrokQuotaHTTPTransport → blockingGrokQuotaFetch + MCP tools/call quota_windows JSON (SuperGrok 42.5%, token never in reply, grokQuotaAccessEnabled default false)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Summary by CodeRabbit

  • New Features

    • Added opt-in Grok SuperGrok plan usage and quota visibility alongside Claude and Codex.
    • Added a “Show Grok usage” setting, off by default.
    • Extended quota windows and MCP results to include Grok status and usage.
  • Privacy

    • Grok access reads local credentials only after consent and sends no transcripts.
    • Clear statuses are shown when access, credentials, or service availability are missing.
  • Documentation

    • Updated privacy, architecture, and changelog documentation for Grok quota access.

ss251 and others added 4 commits July 21, 2026 09:18
…dows (#5)

A GrokQuotaProvider on the ClaudeQuota network pattern: reads the OAuth
token from ~/.grok/auth.json (OIDC/SuperGrok scope, legacy fallback),
fetches grok.com's GetGrokCreditsConfig billing endpoint, and parses the
gRPC-web protobuf for used-% + reset. Consent-gated (grokQuotaAccessEnabled,
default off), wired into the MCP quota_windows block and the Quota screen
alongside Claude and Codex, with an honest error taxonomy (no login /
expired / rejected / offline / unparseable) and no five-hour window Grok
doesn't have. The bearer token never leaves the request's Authorization
header. Wire format derived from CodexBar (MIT, © Peter Steinberger);
implemented trifola-native with an injectable transport so tests never
hit the network.

Co-Authored-By: Grok 4.5 <grok@x.ai>
Non-author review noted the gRPC-web/protobuf parser is bounded only by
construction. Add explicit hostile-input cases (truncated frame, absurd
0xFFFFFFFF length, over-deep nesting, never-terminating varint, noise) —
each must return a .failure, never crash or hang, since the parser eats an
attacker-influenceable remote response.

Co-Authored-By: Grok 4.5 <grok@x.ai>
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ss251, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d21b3983-d8f0-4209-ac14-e391485628da

📥 Commits

Reviewing files that changed from the base of the PR and between cb4c822 and 2822d07.

📒 Files selected for processing (3)
  • Tests/TrifolaKitTests/MCPServerTests.swift
  • Tests/TrifolaKitTests/WarmLaunchHydrationTests.swift
  • docs/ARCHITECTURE.md
📝 Walkthrough

Walkthrough

This PR adds Grok/SuperGrok as a third consent-gated quota provider. It introduces credential loading from ~/.grok/auth.json, a gRPC-web fetcher with injectable HTTP transport, QuotaStore refresh integration, MCP quota_windows support, Settings/UI toggles, and updated docs/tests.

Changes

Grok Quota Provider

Layer / File(s) Summary
Grok consent and preference model
Sources/TrifolaKit/Settings.swift, Tests/TrifolaKitTests/SettingsTests.swift
Adds grokQuotaAccessEnabled to AppPreferences (default false, Codable) and grok to QuotaConsent, with corresponding tests.
Grok credential loading and quota fetcher
Sources/TrifolaKit/GrokQuota.swift, Tests/TrifolaKitTests/GrokQuotaTests.swift
Adds GrokQuotaCredentials/GrokQuotaCredentialReader, GrokQuotaError, GrokQuotaHTTPTransport, GrokBillingUsage, gRPC-web/protobuf parsing, and GrokQuotaFetcher with retry logic, plus a full offline test suite.
QuotaStore Grok refresh integration
Sources/TrifolaKit/ClaudeQuota.swift, Tests/TrifolaKitTests/QuotaConsentTests.swift
QuotaStore gains grokHome/grokTransport, a consent-gated grok.quota refresh probe, and snapshot/status application on success/failure.
MCP quota_windows Grok provider
Sources/TrifolaKit/MCPServer.swift, Sources/Trifola/main.swift, Tests/TrifolaKitTests/MCPServerTests.swift
Adds blockingGrokQuotaFetch, wires it into the live server and selfcheck, extends quota_windows payload/descriptor to include grok, with updated tests including a stub transport.
Settings and Quota UI for Grok
Sources/Trifola/SettingsWindow.swift, Sources/Trifola/QuotaSection.swift, Sources/Trifola/Render.swift
Adds a "Show Grok usage" toggle, a Grok provider block with dedicated source label, and Grok fixtures in headless quota renders.
Documentation updates for Grok quota
CHANGELOG.md, README.md, docs/ARCHITECTURE.md
Documents Grok SuperGrok consent gating, auth source, and quota_windows behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.74% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding Grok SuperGrok plan usage support to Quota and MCP.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/grok-quota

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/ARCHITECTURE.md`:
- Around line 99-102: Update the SuperGrok plan usage description near the
billing endpoint flow to state that the fetch may issue an initial POST plus one
retry on failure, rather than saying it POSTs once. Preserve the existing
consent, token confinement, and injectable transport details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9a86670a-3683-485a-a2fd-61348c199088

📥 Commits

Reviewing files that changed from the base of the PR and between 52ff7ae and cb4c822.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • README.md
  • Sources/Trifola/QuotaSection.swift
  • Sources/Trifola/Render.swift
  • Sources/Trifola/SettingsWindow.swift
  • Sources/Trifola/main.swift
  • Sources/TrifolaKit/ClaudeQuota.swift
  • Sources/TrifolaKit/GrokQuota.swift
  • Sources/TrifolaKit/MCPServer.swift
  • Sources/TrifolaKit/Settings.swift
  • Tests/TrifolaKitTests/GrokQuotaTests.swift
  • Tests/TrifolaKitTests/MCPServerTests.swift
  • Tests/TrifolaKitTests/QuotaConsentTests.swift
  • Tests/TrifolaKitTests/SettingsTests.swift
  • docs/ARCHITECTURE.md

Comment thread docs/ARCHITECTURE.md Outdated
@ss251
ss251 merged commit e27ff36 into main Jul 21, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant