Repository navigation
ROB-1824 fix: use env var for robusta api endpoint for on premise users - #858
Conversation
WalkthroughAdded a Config.configure_robusta_ai_model() method and removed the inline Robusta API-key auto-detection from Config._get_llm. holmes/utils/robusta.py now calls the new configure_robusta_ai_model() when the Robusta model is present in config._model_list. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Utils as holmes/utils/robusta.py
participant Config as Config
participant _get_llm as Config._get_llm
participant LLM as DefaultLLM
note right of Utils #DDEBF7: Load credentials
Utils->>Config: set config.api_key(...)
alt ROBUSTA_AI_MODEL_NAME in config._model_list
Utils->>Config: configure_robusta_ai_model()
note right of Config #E6F4EA: inject Robusta model + api_key into _model_list
end
Config->>_get_llm: build LLM with model_params
alt model_params.base_url == ROBUSTA_API_ENDPOINT
_get_llm->>_get_llm: use model_params (no inline api_key fallback)
else
_get_llm->>_get_llm: use non-Robusta/default path
end
_get_llm->>LLM: Construct DefaultLLM(...)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes Possibly related PRs
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ 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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
holmes/config.py (1)
483-487: Coercebase_urlto str to avoid TypeError in the membership checkSince
ROBUSTA_API_ENDPOINTis always a string (it defaults to"https://api.robusta.dev"inenv_vars.py), you only need to guard againstmodel_params.get("base_url")returningNone. Here’s a streamlined diff for lines 483–487 inholmes/config.py:if ( - not api_key - and ROBUSTA_API_ENDPOINT in model_params.get("base_url", "") - and self.api_key - ): - api_key = self.api_key.get_secret_value() + # Coerce base_url to str to avoid TypeError when it’s None + ): + pass + base_url = str(model_params.get("base_url") or "") + if ( + not api_key + and ROBUSTA_API_ENDPOINT in base_url + and self.api_key + ): + api_key = self.api_key.get_secret_value()Optional backward-compat fallback for hard-coded “robusta.dev” URLs:
- if ( + if ( not api_key - and ROBUSTA_API_ENDPOINT in base_url + and ( + ROBUSTA_API_ENDPOINT in base_url + or "robusta.dev" in base_url + ) and self.api_key ):
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
holmes/config.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit Inference Engine (CLAUDE.md)
**/*.py: ALWAYS place Python imports at the top of the file, not inside functions or methods
Type hints are required (project is type-checked with mypy)
Use Ruff for formatting and linting (configured in pyproject.toml)
Files:
holmes/config.py
🧠 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.
📚 Learning: 2025-07-08T08:45:41.069Z
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.
Applied to files:
holmes/config.py
⏰ 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 (1)
holmes/config.py (1)
483-487: LGTM: Env-based detection improves on-prem compatibilitySwitching the Robusta detection to use ROBUSTA_API_ENDPOINT instead of a hard-coded domain is the right move for on-prem flexibility.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
holmes/utils/robusta.py (1)
6-10: Callconfigure_robusta_ai_model()unconditionally and add a return type.The current guard (
if ROBUSTA_AI_MODEL_NAME in config._model_list) prevents configuration in cases where the Robusta model isn’t pre-inserted (e.g., some CLI or config flows). Letconfigure_robusta_ai_model()determine eligibility (especially after the fix in Config). Also, add the missing return type per project type-hinting guidelines.Apply this diff:
-def load_robusta_api_key(dal: SupabaseDal, config: Config): - if ROBUSTA_AI_MODEL_NAME in config._model_list: - account_id, token = dal.get_ai_credentials() - config.api_key = SecretStr(f"{account_id} {token}") - config.configure_robusta_ai_model() +def load_robusta_api_key(dal: SupabaseDal, config: Config) -> None: + account_id, token = dal.get_ai_credentials() + config.api_key = SecretStr(f"{account_id} {token}") + config.configure_robusta_ai_model()
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
holmes/config.py(1 hunks)holmes/utils/robusta.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit Inference Engine (CLAUDE.md)
**/*.py: ALWAYS place Python imports at the top of the file, not inside functions or methods
Type hints are required (project is type-checked with mypy)
Use Ruff for formatting and linting (configured in pyproject.toml)
Files:
holmes/utils/robusta.pyholmes/config.py
🧠 Learnings (1)
📓 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.
🧬 Code Graph Analysis (1)
holmes/utils/robusta.py (1)
holmes/config.py (1)
configure_robusta_ai_model(145-151)
⏰ 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
No description provided.