Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(usage): do not scan ~/projects when Claude transcripts are missing #7177

Closedmaslinedwin(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7177/headopened View on GitHub

Summary

Fixes #7088.

When Claude has never been used, a missing ~/.claude/projects no longer falls back to walking the entire ~/projects tree. The default missing dir is reported as a missing source. Custom claudeAgent.homePath / CLAUDE_CONFIG_DIR still uses <home>/projects when the nested path is absent.

Test plan

  • Usage page with no ~/.claude/projects returns quickly and does not walk ~/projects
  • Custom Claude home still finds <home>/projects transcripts
  • Codex usage unchanged

Note

Low Risk Localized usage transcript path resolution with pure helpers and tests; no auth, data migration, or API contract changes beyond correct scan roots.

Overview Fixes incorrect Claude usage scanning when the default transcript folder is absent. Previously, a missing ~/.claude/projects caused the scanner to fall back to ~/projects, which could walk a huge tree and skew or slow usage reads.

Now path choice lives in usageClaudeTranscriptDir.ts: default installs always target ~/.claude/projects (missing dir → missing source, no ~/projects fallback). A non-empty configured claudeAgent.homePath still uses <home>/projects only when nested .claude/projects does not exist; whitespace-only config counts as default.

UsageService passes whether the home is an explicit override into that resolver after probing the nested directory on disk. Unit tests cover default, custom home, and override detection.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9695da9b4a90c3c8555585273a4b736c22c554db. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix Claude transcript resolution to avoid scanning ~/projects when no explicit home override is set

Previously, the Claude transcript directory resolver would fall back to <home>/projects when <home>/.claude/projects did not exist, even for default (non-overridden) home paths. This caused unintended directory scanning.

  • Adds isClaudeHomeExplicitOverride to classify a configured homePath as explicit only when non-empty after trimming.
  • Adds resolveClaudeTranscriptDirPath as a pure utility that skips the <home>/projects fallback unless the home path is an explicit override.
  • Updates UsageService to pass the override flag when resolving transcript directories.
  • Behavioral Change: default Claude home paths no longer fall back to ~/projects; only explicit home overrides may use the <override>/projects fallback.
Macroscope summarized 9695da9.
    1. 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: 028e6cc4-dfcb-43c1-95a0-4b304951d422

      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. Approvability

      Verdict: Approved 9695da9

      This is a straightforward bug fix that prevents unintended directory scanning by ensuring the code doesn't fall back to ~/projects when Claude transcripts are missing. The change is conservative, well-tested with unit tests, and self-contained.

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

      This comment is posted by Julius' dot

      Closing for missing verification results. The new tests cover default and custom Claude transcript paths, but the PR provides only an unchecked test plan and no executed checks or observed results. Run the focused path tests and report their command and result, including the missing default directory and custom home cases, then request reconsideration.

    5. juliusmarminge closed this

Sign in to join this conversation.