Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(usage): add Grok and OpenCode reporting #5704

Closeddevteapot(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/5704/headopened View on GitHub

Related to #5706

What changed

  • scan Grok updates.jsonl usage and mark its incomplete transcript coverage as partial
  • scan legacy and next-generation OpenCode SQLite histories, including WAL-aware cache invalidation
  • add environment and provider filters across totals, charts, notices, and daily breakdowns
  • merge compatible older usage summaries from connected environments
  • document how usage coverage, de-duplication, and cost estimates work

Why

The Usage page only reported Claude Code and Codex, so Grok and OpenCode activity was absent. It also excluded compatible summaries from older connected servers and offered no way to isolate one environment or provider.

This gives users a more complete view while preserving honest coverage notices: Grok remains explicitly partial, duplicate transcript sources are counted once, and raw token costs remain estimates rather than invoices.

Validation

  • vp test run apps/server/src/usage/usageAggregation.test.ts apps/server/src/usage/usageOpenCode.test.ts apps/server/src/usage/usageScanCache.test.ts apps/server/src/usage/usageTranscripts.test.ts apps/web/src/usage/usageMerge.test.ts apps/web/src/components/usage/UsageProviderChart.test.ts (67 tests)
  • vp run --filter=t3 --filter=@t3tools/web --filter=@t3tools/contracts typecheck
  • targeted vp lint for all changed TypeScript files
  • targeted vp fmt --check for all changed source and documentation files

Screenshots

Before

Screenshot 2026-08-08 at 16 11 08

After

Screenshot 2026-08-08 at 16 05 56 Screenshot 2026-08-08 at 16 06 19 Screenshot 2026-08-08 at 16 06 22 Screenshot 2026-08-08 at 16 06 32 Screenshot 2026-08-08 at 16 06 36

Generated with GPT-5.6-sol in the Codex harness through T3 Code and Grok 4.5 in Cursor.

Note

Add Grok and OpenCode provider reporting to usage tracking

  • Adds Grok and OpenCode as tracked providers in the usage pipeline, reading Grok from ~/.grok/sessions/updates.jsonl and OpenCode from SQLite databases under its XDG data directory.
  • Implements parseGrokLine and readOpenCodeDatabaseRecords to parse provider-specific formats; both support deduplication via per-record keys.
  • Bumps USAGE_CONTRACT_VERSION to 5 and adds 'grok' and 'opencode' to the UsageProviderKind union in usage.ts.
  • Adds provider filtering to mergeUsage and introduces a compatibility window (USAGE_MERGE_COMPATIBLE_SINCE = 3) so older-but-compatible summaries are included rather than treated as stale.
  • Extends the usage UI with environment and provider filter selectors; the chart legend becomes interactive, allowing users to focus a single provider.
  • Grok sources report status: 'partial' because only sessions that wrote updates.jsonl are covered.
Macroscope summarized 53ee6fd.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: f9ee2cbf-2c67-4c52-9480-8a4ed9827a79

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      1 blocking correctness issue found. New feature adding Grok and OpenCode provider integrations with new SQLite/JSONL parsing logic, UI filtering controls, and contract changes. The scope and new capability introduced warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      Closing this PR after an automated pass over open pull requests. Duplicates another usage-reporting proposal while adding a broad client, contract, or provider integration.

Sign in to join this conversation.