Repository navigation
Conversation
WalkthroughThe changes introduce a more flexible mechanism for determining when to load the Robusta AI model in the configuration. The Changes
Sequence Diagram(s)sequenceDiagram
participant Env as Environment
participant Config as Config
participant Models as Model List
Env->>Config: Provide ROBUSTA_AI and MODEL environment variables
Config->>Config: load_from_env() sets should_try_robusta_ai
Config->>Config: model_post_init() calls _should_load_robusta_ai()
alt should_try_robusta_ai is True
Config->>Env: Check ROBUSTA_AI value
Config->>Models: Check if other models exist
alt No conflicting env vars or models
Config->>Models: Add Robusta AI model
else If ROBUSTA_AI is False or other models exist
Config->>Models: Do not add Robusta AI model
end
else should_try_robusta_ai is False
Config->>Models: Do not add Robusta AI model
end
✨ Finishing Touches
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 (
|
arikalon1
left a comment
There was a problem hiding this comment.
looks good, left a couple of minor comments
48e9f46 to
ac7b4aa
Compare
…fault-when-enabled
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
holmes/config.py (1)
158-176: LGTM! Well-implemented decision tree for conditional loading.The logic correctly handles:
- CLI vs server distinction via
should_try_robusta_ai- Explicit ROBUSTA_AI environment variable when set
- Backward compatibility when MODEL is set
- Avoiding conflicts when model list exists
- Fallback loading when no other models configured
Consider simplifying the final condition as suggested by static analysis:
- # if the user has provided a model list, we don't need to load the robusta AI model - if self._model_list: - return False - - return True + # if the user has provided a model list, we don't need to load the robusta AI model + return not self._model_list
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
holmes/common/env_vars.py(2 hunks)holmes/config.py(4 hunks)tests/config_class/test_config_load_robusta_ai.py(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: nherment
PR: robusta-dev/holmesgpt#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: robusta-dev/holmesgpt#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.
holmes/common/env_vars.py (3)
Learnt from: nherment
PR: robusta-dev/holmesgpt#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: moshemorad
PR: robusta-dev/holmesgpt#391
File: holmes/common/env_vars.py:25-25
Timestamp: 2025-07-17T20:00:38.344Z
Learning: For the robusta-dev/holmesgpt repository, do not flag FBT003 (boolean positional value in function call) as an issue. The team is okay with boolean positional arguments in function calls.
Learnt from: nherment
PR: robusta-dev/holmesgpt#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.
holmes/config.py (2)
Learnt from: nherment
PR: robusta-dev/holmesgpt#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: robusta-dev/holmesgpt#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.
tests/config_class/test_config_load_robusta_ai.py (1)
Learnt from: nherment
PR: robusta-dev/holmesgpt#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.
🪛 Ruff (0.12.2)
holmes/config.py
172-175: Return the condition not self._model_list directly
Replace with return not self._model_list
(SIM103)
⏰ 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)
- GitHub Check: llm_evals
- GitHub Check: Pre-commit checks
- GitHub Check: Pre-commit checks
🔇 Additional comments (7)
holmes/common/env_vars.py (2)
6-11: LGTM! Well-implemented tri-state logic for environment variables.The function signature change correctly enables returning
Nonewhen an environment variable is unset, which supports the new conditional loading logic for Robusta AI. The implementation properly handles the tri-state scenario.
29-29: LGTM! Supports the new conditional loading mechanism.Changing the default from
FalsetoNoneenables the new logic inConfig._should_load_robusta_ai()to make intelligent decisions based on other environment variables whenROBUSTA_AIis unset.tests/config_class/test_config_load_robusta_ai.py (1)
1-85: Excellent comprehensive test coverage for the new conditional loading logic.The test suite thoroughly covers all scenarios:
- CLI vs server behavior differences
- All three states of ROBUSTA_AI (True/False/None)
- Interaction with existing model lists and MODEL environment variable
- Proper mocking and assertions
The tests validate the complex conditional logic introduced in
Config._should_load_robusta_ai()method.holmes/config.py (4)
112-112: LGTM! Good separation of concerns with the new flag.The
should_try_robusta_aiflag provides clear control over when to attempt loading Robusta AI, with appropriate defaults for CLI (False) vs server (True) usage.
152-156: LGTM! Clean integration with the new conditional logic.The change from direct
ROBUSTA_AIcheck to using_should_load_robusta_ai()method provides better encapsulation and supports the new tri-state logic.
244-244: LGTM! Enables conditional loading for server environments.Setting
should_try_robusta_ai = Trueinload_from_env()correctly enables the conditional loading logic for server deployments while keeping CLI usage unchanged.
61-61: LGTM! Simplified iteration over model parameters.The change to iterate over values only is appropriate since the keys are handled elsewhere in the model loading logic.
…fault-when-enabled
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
holmes/config.py (1)
158-175: Well-structured conditional logic for Robusta AI loading.The method correctly implements the backward compatibility requirements by checking environment variables and existing configurations in the right order. This aligns perfectly with the PR objectives.
Apply this diff to simplify the final condition as suggested by static analysis:
- # if the user has provided a model list, we don't need to load the robusta AI model - if self._model_list: - return False - - return True + # if the user has provided a model list, we don't need to load the robusta AI model + return not self._model_list
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
holmes/config.py(4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: nherment
PR: robusta-dev/holmesgpt#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: nherment
PR: robusta-dev/holmesgpt#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.
holmes/config.py (2)
Learnt from: nherment
PR: robusta-dev/holmesgpt#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: robusta-dev/holmesgpt#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.
🪛 Ruff (0.12.2)
holmes/config.py
172-175: Return the condition not self._model_list directly
Replace with return not self._model_list
(SIM103)
⏰ 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)
- GitHub Check: Pre-commit checks
- GitHub Check: llm_evals
- GitHub Check: Pre-commit checks
🔇 Additional comments (4)
holmes/config.py (4)
61-61: Good practice: Using underscore for unused variable.This change correctly uses the underscore convention for the unused dictionary key, improving code readability.
112-112: Well-designed flag for conditional Robusta AI loading.The new field with a clear name and appropriate default value supports the PR objective of conditionally loading Robusta AI while maintaining backward compatibility.
152-156: Clean implementation of conditional Robusta AI loading.The logic correctly delegates the decision to a dedicated method and provides good logging visibility. The model configuration setup looks appropriate.
244-244: Correct enablement of Robusta AI loading for environment-based configs.Setting
should_try_robusta_ai = Trueinload_from_envappropriately enables the conditional loading logic for server/production scenarios while keeping it disabled for CLI usage.
…fault-when-enabled
…fault-when-enabled
This PR added logic to load Robusta AI when the env var isn't provided.
To support backward compatibility we check first if any mode / model list is define in env var and if not we try load robusta ai.