feat(usage): include MCode activity - #7904
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
One finding on the new MCode provider presentation: the series color is a single static value that is barely legible on the light canvas. Everything else in scope (provider order derivation, colSpan={PROVIDER_ORDER.length + 3} fix, the coverage-notice row, the generic chart/tooltip/skeleton loops) stays consistent with the existing usage UI contract.
Posted via Macroscope — UI Consistency
ApprovabilityVerdict: Skipped Macroscope did not run approvability analysis for this PR. Macroscope could not determine whether this PR modifies its approvability configuration, so the PR was not approved automatically. A PR that may change the rules that govern approval is never approved automatically. |
1e4f622 to
c9e0fe0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9e0fe073a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4f0106f90
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dafb96fd03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 709b341. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 709b341385
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Problem
T3 Code's Usage page does not include activity from MCode. MCode's terminal UI and desktop app share the same local runtime, so both surfaces are missing from provider totals, charts, and model breakdowns.
What changed
local_runtime_token_usagerows from its shared runtime SQLite storeMINIMAX_DATA_DIRand the legacyMAVIS_DATA_DIRoverrideVerification
git diff --checkpassedMerge order
This PR and #7877 independently target the current v4 usage contract and therefore both introduce v5. Whichever merges second must be rebased and advance the combined contract version before it is ready to merge.
The available before/after usage captures contain private local totals, so they are not attached to this PR.
Built with Codex (GPT-5).
Note
Add
mcodeusage provider with SQLite store reading and contract version5negotiationmcodeas a newUsageProviderKind. The server reads token usage from the MCode SQLite store (local_runtime_token_usagetable) via an inline worker thread with bounded timeouts, probes primary/alternate DB paths, and parses rows throughparseMcodeUsageRow.USAGE_CONTRACT_VERSIONfrom4to5. AddscontractVersiontoUsageSummaryInputandmakeWindowoutput. Legacy clients receive version4responses vianegotiateUsageContractVersion, which excludesmcodedata entirely.USAGE_SCAN_CACHE_VERSIONfrom2to3; addscompleteFromMstoCachedFilefor window-bounded MCode cache reuse viaisReusableCachedFile.mergeUsageto preferoksources overpartialduplicates, excludefailed/missingsources from ownership, and surface partial/failed provider sources in a newincompleteSourcesarray onMergedUsage.--usage-provider-mcode), and provider ordering across web and mobile UIs;UsageCoverageNoticenow displays incomplete or failed source messages.USAGE_SCAN_CACHE_VERSION!=3) in usageScanCache.ts are invalidated and treated as empty.listTranscriptFilesreturn type changed toTranscriptListing(addsfailedEntries) — callers in UsageService.ts are updated.Macroscope summarized dec5c52.
Note
Medium Risk
Touches the usage RPC contract, scan cache format, and merge ownership, plus worker-thread SQLite reads. Rolling upgrades are negotiated, but a second v5 PR would need a further bump, and v2 caches are discarded.
Overview
Adds MCode as a third usage provider so the Usage page includes MiniMax TUI and desktop activity from the shared local SQLite runtime (
~/.minimax, withMINIMAX_DATA_DIR/MAVIS_DATA_DIRoverrides).The server reads
local_runtime_token_usageoff the event loop via an embedded worker (busy + 30s wall timeouts), probes primary vs alternate DB paths, and fingerprints the SQLite file plus WAL. Scan cache is bumped to v3 with acompleteFromMsbound so windowed MCode scans are not reused for a wider request. Failed reads stay uncached instead of looking like empty usage.The usage contract is v5. Clients advertise
contractVersion; older clients still get a v4 response with MCode omitted. Merge logic prefers a complete duplicate over a partial one, drops fully failed sources from totals, and surfacesincompleteSourceson web and mobile. Charts, tables, and docs pick up MCode branding.Reviewed by Cursor Bugbot for commit dec5c52. Bugbot is set up for automated code reviews on this repo. Configure here.