Skip to content

Fix server loading tools - #534

Merged
arikalon1 merged 1 commit into
masterfrom
fix_server_loading_tools
Jun 17, 2025
Merged

arikalon1 merged 1 commit into
masterfrom
fix_server_loading_tools

Conversation

@moshemorad

Copy link
Copy Markdown
Collaborator

No description provided.

@moshemorad
moshemorad requested a review from arikalon1 June 17, 2025 12:19
@coderabbitai

coderabbitai Bot commented Jun 17, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The implementation of the list_server_toolsets method in ToolsetManager was updated to call the internal _list_all_toolsets method with adjusted parameters, replacing the previous call to load_toolset_with_status. Correspondingly, the related test now patches _list_all_toolsets instead of load_toolset_with_status. No public interfaces were changed.

Changes

File(s) Change Summary
holmes/core/toolset_manager.py Updated list_server_toolsets to use _list_all_toolsets with check_prerequisites=True instead of load_toolset_with_status and removed refresh_status parameter.
tests/core/test_toolset_manager.py Modified test to patch _list_all_toolsets instead of load_toolset_with_status; test logic unchanged.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant ToolsetManager
    participant DAL

    Caller->>ToolsetManager: list_server_toolsets()
    ToolsetManager->>ToolsetManager: _list_all_toolsets(dal, enable_all_toolsets=False, toolset_tags, check_prerequisites=True)
    ToolsetManager->>DAL: (internal toolset retrieval)
    ToolsetManager-->>Caller: [toolsets]
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.

@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

🔭 Outside diff range comments (1)
holmes/core/toolset_manager.py (1)

274-290: refresh_status is now unused and doc-string promises aren’t met

The recent refactor removed the call to load_toolset_with_status, but kept the refresh_status parameter (default =True).
Today the flag does absolutely nothing – we always rebuild the toolset list and prerequisites every call.
Moreover, the doc-string still claims to “refresh by default” vs “rely on cache”, and the function name says “List enabled toolsets”, yet the implementation returns all toolsets, including the disabled ones.

Clean-up or wire-up is required to avoid misleading API:

-def list_server_toolsets(
-    self, dal: Optional[SupabaseDal] = None, refresh_status=True
+)  # Remove dead arg (or re-introduce cache path)
+def list_server_toolsets(
+    self, dal: Optional[SupabaseDal] = None
 ) -> List[Toolset]:
@@
-        toolsets_with_status = self._list_all_toolsets(
-            dal,
-            check_prerequisites=True,
-            enable_all_toolsets=False,
-            toolset_tags=self.server_tool_tags,
-        )
-        return toolsets_with_status
+        # Only return enabled toolsets – aligns with doc-string
+        return [
+            ts
+            for ts in self._list_all_toolsets(
+                dal,
+                check_prerequisites=True,
+                enable_all_toolsets=False,
+                toolset_tags=self.server_tool_tags,
+            )
+            if ts.enabled
+        ]

Either drop the parameter (breaking but clearer) or pass it through to load_toolset_with_status when refresh_status=False to honour the original contract.

Leaving it as dead code invites confusion for callers and maintainers.

🧹 Nitpick comments (1)
tests/core/test_toolset_manager.py (1)

167-173: Strengthen the assertion – verify the patched call signature

Great that the test now patches _list_all_toolsets, but it would be safer to assert the method was invoked with the expected arguments:

     mock_list_all_toolsets.return_value = [toolset]
     result = toolset_manager.list_server_toolsets()
     assert toolset in result
+
+    # Ensure internal call uses the intended parameters
+    mock_list_all_toolsets.assert_called_once_with(
+        toolset_manager,               # self
+        None,                          # dal
+        check_prerequisites=True,
+        enable_all_toolsets=False,
+        toolset_tags=toolset_manager.server_tool_tags,
+    )

This guards against future regressions where the implementation might silently change the flags.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59107a7 and dc91e46.

📒 Files selected for processing (2)
  • holmes/core/toolset_manager.py (1 hunks)
  • tests/core/test_toolset_manager.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
holmes/core/toolset_manager.py (1)
holmes/core/tools.py (1)
  • check_prerequisites (377-432)
tests/core/test_toolset_manager.py (1)
holmes/core/tools.py (2)
  • Toolset (301-443)
  • ToolsetTag (90-93)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: build (3.12)
  • GitHub Check: build (3.10)
  • GitHub Check: build (3.11)
  • GitHub Check: Pre-commit checks
  • GitHub Check: build (3.12)

@github-actions

Copy link
Copy Markdown
Contributor

Results of HolmesGPT evals

Test suite Test case Status
ask_holmes 01_how_many_pods ⚠️
ask_holmes 02_what_is_wrong_with_pod ✅
ask_holmes 02_what_is_wrong_with_pod_LOKI ✅
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 07_high_latency_LOKI ✅
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 12_job_crashing_CORALOGIX ⚠️
ask_holmes 12_job_crashing_LOKI ⚠️
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 20_long_log_file_search_LOKI ✅
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 23_app_error_in_current_logs_LOKI ✅
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 ⚠️
investigate 01_oom_kill ✅
investigate 02_crashloop_backoff ✅
investigate 03_cpu_throttling ✅
investigate 04_image_pull_backoff ✅
investigate 05_crashpod ✅
investigate 05_crashpod_LOKI ✅
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 ✅

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

nice work

@arikalon1
arikalon1 merged commit fea7861 into master Jun 17, 2025
@arikalon1
arikalon1 deleted the fix_server_loading_tools branch June 17, 2025 13:20
@mainred

mainred commented Jun 18, 2025

Copy link
Copy Markdown
Collaborator

Thanks for fixing the issue.

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.

3 participants