make config file dir configurable - #750
Conversation
WalkthroughThe changes refactor the configuration and state file locations in the application, replacing hardcoded user home directory paths with locations derived from a new, configurable Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Possibly related PRs
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
holmes/config.py(2 hunks)holmes/core/config.py(1 hunks)holmes/core/toolset_manager.py(1 hunks)holmes/interactive.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit Inference Engine (CLAUDE.md)
**/*.py: Use Ruff for formatting and linting (configured in pyproject.toml)
Type hints required (mypy configuration in pyproject.toml)
Files:
holmes/core/toolset_manager.pyholmes/core/config.pyholmes/interactive.pyholmes/config.py
🧠 Learnings (3)
holmes/core/toolset_manager.py (2)
Learnt from: CR
PR: robusta-dev/holmesgpt#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-27T14:10:31.590Z
Learning: Applies to holmes/plugins/toolsets/**/*.yaml : Toolsets: holmes/plugins/toolsets/{name}.yaml or {name}/
Learnt from: nherment
PR: #535
File: holmes/plugins/toolsets/bash/bash_toolset.py:207-209
Timestamp: 2025-06-24T05:51:04.543Z
Learning: The init_config method in toolsets should be idempotent - safely callable multiple times without errors. self.config should maintain consistent typing (not alternate between dict and config object types) throughout the object lifecycle.
holmes/interactive.py (1)
Learnt from: CR
PR: robusta-dev/holmesgpt#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-27T14:10:31.590Z
Learning: Applies to holmes/plugins/prompts/**/*.jinja2 : Prompts: holmes/plugins/prompts/{name}.jinja2
holmes/config.py (4)
Learnt from: nherment
PR: #610
File: .github/workflows/llm-evaluation.yaml:39-42
Timestamp: 2025-07-08T08:45:41.069Z
Learning: The robusta-dev/holmesgpt codebase has comprehensive existing validation for Azure environment variables (AZURE_API_BASE, AZURE_API_KEY, AZURE_API_VERSION) and MODEL in tests/llm/utils/classifiers.py, tests/llm/conftest.py, and holmes/core/llm.py. Don't suggest adding redundant validation logic.
Learnt from: nherment
PR: #610
File: .github/workflows/llm-evaluation.yaml:39-42
Timestamp: 2025-07-08T08:45:41.069Z
Learning: When suggesting improvements to environment variable handling in robusta-dev/holmesgpt, check first if validation logic already exists rather than reimplementing it.
Learnt from: CR
PR: robusta-dev/holmesgpt#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-27T14:10:31.590Z
Learning: Applies to holmes/plugins/prompts/**/*.jinja2 : Prompts: holmes/plugins/prompts/{name}.jinja2
Learnt from: nherment
PR: #535
File: holmes/plugins/toolsets/bash/bash_toolset.py:207-209
Timestamp: 2025-06-24T05:51:04.543Z
Learning: The init_config method in toolsets should be idempotent - safely callable multiple times without errors. self.config should maintain consistent typing (not alternate between dict and config object types) throughout the object lifecycle.
🧬 Code Graph Analysis (1)
holmes/config.py (4)
holmes/utils/definitions.py (1)
RobustaConfig(11-13)holmes/utils/env.py (1)
replace_env_vars_values(29-53)holmes/utils/file_utils.py (1)
load_yaml_file(19-56)holmes/utils/pydantic_utils.py (2)
RobustaBaseConfig(14-15)load_model_from_file(39-54)
🪛 GitHub Actions: Build and test HolmesGPT
holmes/config.py
[error] 112-120: ruff-format: File was reformatted by ruff-format hook. Please run 'ruff --fix' or the pre-commit hook locally to apply formatting changes.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Pre-commit checks
- GitHub Check: llm_evals
🔇 Additional comments (7)
holmes/core/config.py (1)
1-5: LGTM! Clean and focused configuration module.The implementation is straightforward and follows good practices:
- Uses
os.environ.get()with a sensible default fallback- Centralizes the configurable base directory in one location
- Uses
os.path.expanduser()to properly handle the tilde in the default pathholmes/core/toolset_manager.py (2)
10-10: LGTM! Proper import of the centralized config path.The import follows the established pattern for using the configurable base directory.
16-16: LGTM! Consistent usage of configurable directory path.The change successfully replaces the hardcoded path with the configurable
config_path_dir, maintaining backward compatibility while enabling customization via theCONFIG_PATH_DIRenvironment variable.holmes/interactive.py (2)
30-30: LGTM! Consistent import of the centralized config path.The import aligns with the configurable directory approach used across the codebase.
824-826: LGTM! Proper usage of configurable directory with safety checks.The implementation correctly:
- Uses the configurable
config_path_dirfor the history file location- Maintains the existing directory creation logic to ensure the parent directory exists
- Preserves backward compatibility with the default
~/.holmespathholmes/config.py (2)
34-34: LGTM! Consistent import of the centralized config path.The import follows the established pattern for using the configurable base directory.
40-40: LGTM! Proper usage of configurable directory path.The change successfully replaces the hardcoded path with the configurable
config_path_dir, maintaining backward compatibility while enabling customization via theCONFIG_PATH_DIRenvironment variable.
export CONFIG_PATH_DIR=/home/azureuser/testholmes
running holmes aks gives the following files correctly