Skip to content
Source
Sign inSign up
pingdotgg/t3code

Usage page ignores providerInstances (and CODEX_HOME) — Codex usage shows zero when the home is configured via Settings #6310

ClosedThYpHo0n(GitHub profile, opens in a new tab) opened this issue 1 comment

Summary

The Usage page's transcript scanner resolves provider home directories exclusively from the legacy settings.providers.{codex,claudeAgent} struct (UsageService.resolveTranscriptDirs → resolveCodexHomeLayout(settings.providers.codex) in apps/server/src/usage/UsageService.ts).

The Settings UI, however, persists provider configuration to the newer providerInstances map. Result: setting "CODEX_HOME path" on a Codex provider in Settings has no effect on the Usage page — the scanner keeps reading the default ~/.codex/sessions, and if rollouts live anywhere else, Codex usage reports zero while the provider itself works fine.

The spawned codex app-server also inherits a CODEX_HOME env var from the server's environment when no homePath is configured, so an environment-provided Codex home writes rollouts to $CODEX_HOME/sessions while the scanner reads ~/.codex/sessions — same mismatch from a second direction. (Claude usage is unaffected in practice only because the legacy default happens to resolve to ~/.claude/projects.)

Reproduce

  1. Run t3 serve (observed on 0.0.34-nightly.20260811.1064; code unchanged on main) with CODEX_HOME=/some/dir exported, or set "CODEX_HOME path" to /some/dir on the Codex provider in Settings.
  2. Run some Codex turns — rollout files with token_count events appear under /some/dir/sessions/.
  3. Open the Usage page.

Expected: Codex usage from those rollouts is counted. Actual: Codex shows 0 tokens. <stateDir>/usage-scan-cache.json confirms no file under /some/dir/sessions was ever scanned; the codex source points at ~/.codex/sessions.

Suggested fix

resolveTranscriptDirs should derive scan directories from providerInstances (every enabled codex/claudeAgent instance, deduped), falling back to the legacy struct/defaults. Happy to send a small PR.

  1. closing as a duplicate of #5805 so the issue stays tracked in one place.

Sign in to join this conversation.