Skip to content

Try load robusta ai - #650

Merged
arikalon1 merged 6 commits into
masterfrom
ROB-972-holmes-should-use-robusta-ai-by-default-when-enabled
Jul 21, 2025
Merged

arikalon1 merged 6 commits into
masterfrom
ROB-972-holmes-should-use-robusta-ai-by-default-when-enabled

Conversation

@moshemorad

@moshemorad moshemorad commented Jul 17, 2025 •

Copy link
Copy Markdown
Collaborator

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.

@coderabbitai

coderabbitai Bot commented Jul 17, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes introduce a more flexible mechanism for determining when to load the Robusta AI model in the configuration. The load_bool utility now allows returning None if an environment variable is unset. The Config class gains logic to conditionally load the Robusta AI model based on environment variables and model list contents. Comprehensive tests are added for these behaviors.

Changes

File(s) Change Summary
holmes/common/env_vars.py Modified load_bool to return default (possibly None) if env var is unset; updated function signature.
holmes/config.py Added should_try_robusta_ai field and _should_load_robusta_ai method to Config; updated model loading logic; improved model file parsing.
tests/config_class/test_config_load_robusta_ai.py Added new test module with multiple unit tests for Robusta AI model loading based on environment and config.

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
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@moshemorad
moshemorad requested a review from aantn July 17, 2025 20:59
arikalon1
arikalon1 previously approved these changes Jul 17, 2025

@arikalon1 arikalon1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good, left a couple of minor comments

Comment thread holmes/config.py
Comment thread holmes/config.py Outdated
@moshemorad
moshemorad force-pushed the ROB-972-holmes-should-use-robusta-ai-by-default-when-enabled branch from 48e9f46 to ac7b4aa Compare July 18, 2025 15:25
@moshemorad
moshemorad marked this pull request as ready for review July 18, 2025 15:26
@moshemorad
moshemorad requested a review from arikalon1 July 18, 2025 15:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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:

  1. CLI vs server distinction via should_try_robusta_ai
  2. Explicit ROBUSTA_AI environment variable when set
  3. Backward compatibility when MODEL is set
  4. Avoiding conflicts when model list exists
  5. 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

📥 Commits

Reviewing files that changed from the base of the PR and between d2258b8 and 39fe5bc.

📒 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 None when 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 False to None enables the new logic in Config._should_load_robusta_ai() to make intelligent decisions based on other environment variables when ROBUSTA_AI is 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_ai flag 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_AI check 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 = True in load_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.

@arikalon1 arikalon1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 39fe5bc and 983f248.

📒 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 = True in load_from_env appropriately enables the conditional loading logic for server/production scenarios while keeping it disabled for CLI usage.

@github-actions

Copy link
Copy Markdown
Contributor

Results of HolmesGPT evals

  • ask_holmes: 46/66 test cases were successful, 1 regressions

  • investigate: 14/16 test cases were successful, 0 regressions

Test suite Test case Status
ask_holmes 01_how_many_pods ✅
ask_holmes 02_what_is_wrong_with_pod ✅
ask_holmes 03_what_is_the_command_to_port_forward ✅
ask_holmes 04_related_k8s_events ✅
ask_holmes 05_image_version ✅
ask_holmes 06_explain_issue ✅
ask_holmes 07_high_latency ✅
ask_holmes 08_sock_shop_frontend ⚠️
ask_holmes 09_crashpod ✅
ask_holmes 10_image_pull_backoff ✅
ask_holmes 11_init_containers ✅
ask_holmes 12_job_crashing ✅
ask_holmes 13_pending_node_selector ✅
ask_holmes 14_pending_resources ✅
ask_holmes 15_failed_readiness_probe ✅
ask_holmes 16_failed_no_toolset_found ✅
ask_holmes 17_oom_kill ✅
ask_holmes 18_crash_looping_v2 ✅
ask_holmes 19_detect_missing_app_details ✅
ask_holmes 20_long_log_file_search ✅
ask_holmes 21_job_fail_curl_no_svc_account ✅
ask_holmes 22_high_latency_dbi_down ⚠️
ask_holmes 23_app_error_in_current_logs ✅
ask_holmes 24_misconfigured_pvc ✅
ask_holmes 25_misconfigured_ingress_class ⚠️
ask_holmes 26_multi_container_logs ✅
ask_holmes 27_permissions_error_no_helm_tools ❌
ask_holmes 28_permissions_error_helm_tools_enabled ⚠️
ask_holmes 29_events_from_alert_manager ✅
ask_holmes 30_basic_promql_graph_cluster_memory ✅
ask_holmes 31_basic_promql_graph_pod_memory ✅
ask_holmes 32_basic_promql_graph_pod_cpu ✅
ask_holmes 33_http_latency_graph ✅
ask_holmes 34_memory_graph ✅
ask_holmes 35_tempo ✅
ask_holmes 36_argocd_find_resource ✅
ask_holmes 37_argocd_wrong_namespace ✅
ask_holmes 38_rabbitmq_split_head ✅
ask_holmes 39_failed_toolset ✅
ask_holmes 40_disabled_toolset ✅
ask_holmes 41_setup_argo ✅
ask_holmes 42_dns_issues_result_all_tools ⚠️
ask_holmes 42_dns_issues_result_new_tools ⚠️
ask_holmes 42_dns_issues_result_old_tools ⚠️
ask_holmes 42_dns_issues_steps_new_all_tools ⚠️
ask_holmes 42_dns_issues_steps_new_tools ⚠️
ask_holmes 42_dns_issues_steps_old_tools ⚠️
ask_holmes 43_current_datetime_from_prompt ✅
ask_holmes 43_slack_deployment_logs ✅
ask_holmes 44_slack_statefulset_logs ⚠️
ask_holmes 45_fetch_deployment_logs_simple ✅
ask_holmes 46_job_crashing_no_longer_exists ⚠️
ask_holmes 47_truncated_logs_context_window ⚠️
ask_holmes 48_logs_since_thursday ⚠️
ask_holmes 49_logs_since_last_week ⚠️
ask_holmes 50_logs_since_specific_date ⚠️
ask_holmes 51_logs_summarize_errors ✅
ask_holmes 52_logs_login_issues ✅
ask_holmes 53_logs_find_term ✅
ask_holmes 54_not_truncated_when_getting_pods ✅
ask_holmes 55_kafka_runbook ⚠️
ask_holmes 56_kafka_runbook_no_tool ⚠️
ask_holmes 58_counting_pods_by_status ⚠️
ask_holmes 59_label_based_counting ✅
ask_holmes 60_time_based_filtering ✅
ask_holmes 61_exact_match_counting ✅
investigate 01_oom_kill ✅
investigate 02_crashloop_backoff ✅
investigate 03_cpu_throttling ✅
investigate 04_image_pull_backoff ✅
investigate 05_crashpod ✅
investigate 06_job_failure ✅
investigate 07_job_syntax_error ✅
investigate 08_memory_pressure ✅
investigate 09_high_latency ✅
investigate 10_KubeDeploymentReplicasMismatch ✅
investigate 11_KubePodCrashLooping ✅
investigate 12_KubePodNotReady ✅
investigate 13_Watchdog ✅
investigate 14_tempo ✅
investigate 15_dns_resolution ⚠️
investigate 16_dns_resolution_no_tool ⚠️

Legend

  • ✅ the test was successful
  • ⚠️ the test failed but is known to be flakky or known to fail
  • ❌ the test failed and should be fixed before merging the PR

@arikalon1
arikalon1 merged commit 6e11244 into master Jul 21, 2025
@arikalon1
arikalon1 deleted the ROB-972-holmes-should-use-robusta-ai-by-default-when-enabled branch July 21, 2025 06:44
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.

2 participants