Skip to content

fix(analyzers): respect custom config directories - #224

Merged
mike1858 merged 2 commits into
Piebald-AI:mainfrom
jimyag:fix/claude-config-dir
Jul 31, 2026
Merged

fix(analyzers): respect custom config directories#224
mike1858 merged 2 commits into
Piebald-AI:mainfrom
jimyag:fix/claude-config-dir

Conversation

@jimyag

@jimyag jimyag commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Respect the configuration directory overrides used by Claude Code and Codex instead of always reading from their default home-directory locations.

Closes #4.

Key changes

  • Read Claude transcripts from $CLAUDE_CONFIG_DIR/projects when the variable is non-empty.
  • Read Codex active and archived sessions from $CODEX_HOME, and load the fallback model from $CODEX_HOME/config.toml.
  • Preserve the existing ~/.claude and ~/.codex defaults when overrides are unset or empty.
  • Apply the resolved paths consistently to discovery, glob patterns, file watching, availability, and path validation.

Validation

  • cargo build --quiet
  • cargo test --quiet (408 passed)
  • cargo clippy --quiet -- -D warnings
  • cargo doc --quiet
  • cargo fmt --all --quiet

Summary by CodeRabbit

  • New Features

    • Added support for custom Claude Code configuration locations through CLAUDE_CONFIG_DIR.
    • Added support for custom Codex CLI data locations through CODEX_HOME.
    • Improved discovery of projects, sessions, archived data, and fallback model settings in custom locations.
  • Bug Fixes

    • Corrected handling of empty or missing configuration paths.
    • Improved fallback behavior when configuration files are missing, invalid, or incomplete.
  • Tests

    • Added coverage for default and custom configuration paths and fallback scenarios.

Honor CLAUDE_CONFIG_DIR and CODEX_HOME across discovery, watching, validation, and Codex fallback model loading. Preserve the existing home-directory defaults when overrides are unset or empty.

Signed-off-by: jimyag <git@jimyag.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jimyag, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 444f70b4-d105-456f-b83e-a5fcb0f23ea7

📥 Commits

Reviewing files that changed from the base of the PR and between 015ac8d and e7699f4.

📒 Files selected for processing (2)
  • src/analyzers/claude_code.rs
  • src/analyzers/tests/claude_code.rs
📝 Walkthrough

Walkthrough

Claude Code and Codex CLI now support configurable data roots through CLAUDE_CONFIG_DIR and CODEX_HOME. Both analyzers use shared root resolution for directory discovery and glob patterns, with tests covering custom, empty, missing, and invalid configurations.

Changes

Configurable analyzer roots

Layer / File(s) Summary
Claude Code configuration root
src/analyzers/claude_code.rs, src/analyzers/tests/claude_code.rs
Claude Code resolves project data from CLAUDE_CONFIG_DIR or $HOME/.claude. Tests cover custom, empty, and missing configuration values.
Codex CLI configuration root
src/analyzers/codex_cli.rs, src/analyzers/tests/codex_cli.rs
Codex CLI resolves session and configuration data from CODEX_HOME or $HOME/.codex. Tests cover session discovery and fallback model resolution.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: mike1858

Poem

A rabbit hops through configured trails,
Finds Claude’s projects and Codex’s files.
Empty roots yield homeward ways,
Custom paths guide discovery’s gaze.
Tests thump softly: paths align.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The Codex CLI changes are not covered by linked issue #4, which only requires CLAUDE_CONFIG_DIR support. Link a Codex-specific issue or move the Codex CLI changes into a separate pull request.
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: support for custom analyzer configuration directories.
Linked Issues check ✅ Passed The Claude Code changes satisfy issue #4 by honoring non-empty CLAUDE_CONFIG_DIR and preserving the default fallback.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/analyzers/claude_code.rs`:
- Around line 29-38: Update the project-ID extraction flow around
claude_projects_dir and extract_and_hash_project_id so custom configuration
roots use the resolved projects_dir as the path-relative hashing base, rather
than assuming a `.claude/projects` segment. Preserve existing default-root
behavior and add coverage using an arbitrary custom root to verify transcripts
from the same project produce the same project_hash.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 97582450-6afa-4f5f-8d53-12f26ab2c316

📥 Commits

Reviewing files that changed from the base of the PR and between 2ace23b and 015ac8d.

📒 Files selected for processing (4)
  • src/analyzers/claude_code.rs
  • src/analyzers/codex_cli.rs
  • src/analyzers/tests/claude_code.rs
  • src/analyzers/tests/codex_cli.rs

Comment thread src/analyzers/claude_code.rs
Derive project identity relative to the resolved projects directory so sessions under CLAUDE_CONFIG_DIR continue to aggregate by project.

Signed-off-by: jimyag <git@jimyag.com>

@mike1858 mike1858 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice. This is especially useful for when we use the common XDG config dir.

@mike1858
mike1858 merged commit 74d6080 into Piebald-AI:main Jul 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Respect the CLAUDE_CONFIG_DIR environment variable

2 participants