Skip to content

fix(usage): only show enabled providers - #6094

Open
moenzuel wants to merge 1 commit into
pingdotgg:mainfrom
moenzuel:fix/usage-enabled-providers
Open

fix(usage): only show enabled providers#6094
moenzuel wants to merge 1 commit into
pingdotgg:mainfrom
moenzuel:fix/usage-enabled-providers

Conversation

@moenzuel

@moenzuel moenzuel commented Aug 11, 2026

Copy link
Copy Markdown

The Usage page scanned and rendered both Claude Code and Codex even when one was disabled, so disabled providers could contribute historical transcripts and appear in charts and tables.

Usage scans now follow effective provider enablement, including legacy settings and explicit provider instances. The merged view carries the provider scope across environments, and web charts, legends, tooltips, and daily columns render only providers in that scope. External CLI sessions remain included for enabled providers.

Fixes #5997

Testing

  • vp run -r test
  • vp run --filter t3 --filter @t3tools/web --filter @t3tools/shared typecheck
  • Targeted lint and formatting checks
  • Focused usage regression tests (25 tests)

Made with GPT-5.6-sol in T3 Code through the Codex harness.


Note

Low Risk
Scoped usage scanning and display logic with unit tests; no auth, billing, or data-deletion behavior.

Overview
Usage no longer always scans Claude and Codex transcripts or shows both in the UI when a provider is disabled.

Server: New selectEnabledUsageProviders picks which providers to scan from legacy providers.*.enabled, per-instance enabled, and config.enabled, with explicit default instances overriding legacy flags. UsageService only resolves transcript directories for providers in that set.

Merge + UI: mergeUsage adds providersInScope (union of scan sources across environments, including providers with zero usage). The Usage page filters chart legend, series, tooltips, and daily breakdown columns to that scope instead of a fixed provider list.

Docs: User docs note that disabled providers are omitted from scans without deleting session files.

Reviewed by Cursor Bugbot for commit 3233f39. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Filter usage page charts, legends, and tables to only show enabled providers

  • UsageService.make now resolves transcript directories only for providers enabled in ServerSettings, skipping Claude or Codex paths when the respective provider is disabled.
  • mergeUsage computes a providersInScope field by unioning provider kinds across current environments, and UsagePage uses this to derive visibleProviders.
  • Charts, legends, and tables in UsagePage iterate over visibleProviders instead of the global PROVIDER_ORDER, so disabled providers are fully hidden.
  • selectEnabledUsageProviders (new util) determines enablement by checking provider instances; an explicit default instance overrides legacy settings.providers[driver].enabled fallback.
  • Behavioral Change: disabling a provider removes its historical transcript data from usage scans without deleting session files.
📊 Macroscope summarized 3233f39. 6 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

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: 54ab693e-4e46-45ef-aa7c-232ba78efea5

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 11, 2026
{ provider: "claude" as const, dir: claudeDir },
{ provider: "codex" as const, dir: path.join(codexLayout.sharedHomePath, "sessions") },
];
if (enabledProviders.has("claude")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟠 High usage/UsageService.ts:221

resolveTranscriptDirs enables a provider when any custom instance is enabled (via selectEnabledUsageProviders), but then resolves the transcript directory from the legacy settings.providers.claudeAgent / settings.providers.codex config — not from the enabled instance's own config. When an enabled custom instance has a different homePath and the legacy provider is disabled or points elsewhere, the scan reads the wrong home directory: it omits the enabled instance's transcripts and may include transcripts from a differently configured or disabled home. The directory resolution needs to iterate over each enabled instance's config rather than collapsing enabled instances to a single provider-level boolean.

Also found in 1 other location(s)

apps/server/src/usage/usageProviderSelection.ts:23

isDriverEnabled treats any enabled custom instance as enabling the provider, but UsageService.resolveTranscriptDirs still resolves exactly one directory from settings.providers.<driver> rather than that enabled instance's config. For example, an enabled codex_work instance with config.homePath = "~/.codex-work" and a disabled legacy/default Codex config causes the scan to read the disabled default's sessions and omit the enabled instance's sessions. The selection needs to preserve enabled instance configs/directories (and potentially scan each distinct home), rather than collapsing them to a provider boolean.

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/usage/UsageService.ts around line 221:

`resolveTranscriptDirs` enables a provider when any custom instance is enabled (via `selectEnabledUsageProviders`), but then resolves the transcript directory from the legacy `settings.providers.claudeAgent` / `settings.providers.codex` config — not from the enabled instance's own `config`. When an enabled custom instance has a different `homePath` and the legacy provider is disabled or points elsewhere, the scan reads the wrong home directory: it omits the enabled instance's transcripts and may include transcripts from a differently configured or disabled home. The directory resolution needs to iterate over each enabled instance's config rather than collapsing enabled instances to a single provider-level boolean.

Also found in 1 other location(s):
- apps/server/src/usage/usageProviderSelection.ts:23 -- `isDriverEnabled` treats any enabled custom instance as enabling the provider, but `UsageService.resolveTranscriptDirs` still resolves exactly one directory from `settings.providers.<driver>` rather than that enabled instance's `config`. For example, an enabled `codex_work` instance with `config.homePath = "~/.codex-work"` and a disabled legacy/default Codex config causes the scan to read the disabled default's sessions and omit the enabled instance's sessions. The selection needs to preserve enabled instance configs/directories (and potentially scan each distinct home), rather than collapsing them to a provider boolean.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3233f39bf1

ℹ️ 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".

Comment on lines +211 to +212
for (const source of environment.summary.sources) {
providersInScope.add(source.fingerprint.provider);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Version the new provider-scope semantics

When a current web or desktop client connects to an environment running a server from before this commit, that server still returns both Claude and Codex sources with contractVersion: 3; this new inference therefore treats both providers as enabled, and the existing version check accepts and merges their historical usage instead of marking the environment stale. Bump USAGE_CONTRACT_VERSION or add an explicitly versioned scope field before interpreting sources this way, otherwise the fix silently fails for mixed-version remote environments.

AGENTS.md reference: AGENTS.md:L72-L74

Useful? React with 👍 / 👎.

@macroscopeapp

macroscopeapp Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found. This PR changes which usage providers get scanned and displayed based on enabled state, introducing new selection logic. A high-severity finding identifies that custom instance configurations may cause scanning wrong directories. The behavioral changes and unresolved bug warrant human review.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: I see Codex usage, but I only enabled Claude Code as provider

1 participant