Skip to content

Conversation

@mainred
Copy link
Collaborator

@mainred mainred commented Oct 31, 2025

To avoid printing the lengthy toolset status, we mute the status for console, since we have /tools to print the toolset status.
Also, we unform the output for both using and not using toolset.

With cache

Loaded models: ['azure/gpt-5-mini']
Loading toolsets...
Refreshing available datasources (toolsets)
Toolset statuses are cached to /home/azureuser/.holmes/toolsets_status.json
Using 44 datasources (toolsets). To view all available toolsets: run '/tools'. To refresh: use flag `--refresh-toolsets`
Using model: azure/gpt-5-mini (272,000 total tokens, 54,400 output tokens)
Welcome to HolmesGPT: Type '/exit' to exit, '/help' for commands.

Without cache

Loaded models: ['azure/gpt-5-mini']
Loading toolsets...
Using 44 datasources (toolsets). To view all available toolsets: run '/tools'. To refresh: use flag `--refresh-toolsets`
Using model: azure/gpt-5-mini (272,000 total tokens, 54,400 output tokens)
Welcome to HolmesGPT: Type '/exit' to exit, '/help' for commands.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

Adds a mute_log_status flag to Toolset.check_prerequisites and threads it through ToolsetManager methods to optionally suppress prerequisite logging; renames load_toolset_with_status to load_console_toolset_with_status; downgrades some service/prometheus discovery logs to debug; minor CLI string-slicing whitespace fixes and test updates for the renamed method.

Changes

Cohort / File(s) Summary
Core toolset prerequisite handling
holmes/core/tools.py
Added parameter mute_log_status: bool = False to Toolset.check_prerequisites(). Logging paths updated to suppress failure/success messages when muted. Added/adjusted imports related to transformers and config merging.
Toolset manager infrastructure
holmes/core/toolset_manager.py
Threaded mute_log_status through _list_all_toolsets(), check_toolset_prerequisites(), and refresh_toolset_status(); renamed load_toolset_with_status()load_console_toolset_with_status() and updated internal call sites and log messages; ensured cached loads run prerequisite checks with mute flag where required.
Interactive CLI parsing
holmes/interactive.py
Fixed minor whitespace in slash-command argument slicing for /show and /run parsing (removed stray space in slice expressions).
Plugin toolsets logging & imports
holmes/plugins/toolsets/prometheus/prometheus.py, holmes/plugins/toolsets/service_discovery.py
Changed some discovery log messages from INFO to DEBUG. Reorganized/clarified imports and metadata comments in Prometheus plugin.
Tests
tests/core/test_toolset_manager.py
Updated tests to use load_console_toolset_with_status() (renamed from load_toolset_with_status) and adjusted patched targets/expectations accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant ToolsetManager
    participant Toolset
    participant Logger

    Note over Caller,ToolsetManager: High-level prerequisite flow with optional log suppression

    Caller->>ToolsetManager: check_toolset_prerequisites(toolsets, mute_log_status=bool)
    ToolsetManager->>Toolset: check_prerequisites(mute_log_status=bool)
    alt mute_log_status = true
        Toolset->>Toolset: Evaluate prerequisites (no status logs)
        Note right of Logger: Logging suppressed for failures/success
    else mute_log_status = false
        Toolset->>Logger: Log prerequisite failures/success
    end
    Toolset-->>ToolsetManager: result/status
    ToolsetManager-->>Caller: aggregated status
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas to focus on:
    • Verify mute_log_status is consistently passed through all call paths in toolset_manager.py and callers.
    • Confirm the rename load_console_toolset_with_status is applied everywhere (including tests/mocks) and doesn't break external integrations.
    • Check logging level changes in plugin files for any monitoring/observability expectations.
    • Review the new imports in tools.py for unused or circular import risks.

Possibly related PRs

Suggested reviewers

  • nherment
  • moshemorad
  • aantn

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "mute logging toolset status for console" is directly related to the main objective and primary changes in the changeset. The changes across multiple files consistently implement the capability to suppress (mute) log output for toolset status when operating in a console context, evidenced by the addition of the mute_log_status parameter, the renaming of methods to be console-specific (e.g., load_console_toolset_with_status), and the reworking of log messages to reference console-focused usage. The title is concise, clear, and specific enough for a developer scanning history to understand that this PR addresses logging verbosity for console toolset status output.
Description Check ✅ Passed The PR description clearly relates to the changeset. It explains the motivation (muting lengthy toolset status output because /tools command provides that information) and the implementation approach (adding mute_log_status parameter to suppress logging and renaming methods to console-specific variants like load_console_toolset_with_status). The description includes concrete before/after output examples demonstrating the normalized console output for both cached and non-cached scenarios, which directly corresponds to the changes made throughout holmes/core/tools.py, holmes/core/toolset_manager.py, and related test files. The description is sufficiently specific and on-topic.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch toolset-loading-lengthy

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

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

205-222: Fix parameter propagation bug in refresh_toolset_status.

The mute_log_status parameter on line 205 is defined but ignored on line 221, where a hardcoded True value is passed to _list_all_toolsets. This means the parameter has no effect and will always mute logs, regardless of the caller's intention.

Apply this diff to fix the parameter propagation:

     def refresh_toolset_status(
         self,
         dal: Optional[SupabaseDal] = None,
         enable_all_toolsets=False,
         toolset_tags: Optional[List[ToolsetTag]] = None,
         mute_log_status=True,
     ):
         """
         Refresh the status of all toolsets and cache the status to a file.
         Loading cached toolsets status saves the time for runtime tool executor checking the status of each toolset

         enabled toolset when:
         - build-in toolset specified in the config and not explicitly disabled
         - custom toolset not explicitly disabled
         """

         all_toolsets = self._list_all_toolsets(
             dal=dal,
             check_prerequisites=True,
             enable_all_toolsets=enable_all_toolsets,
             toolset_tags=toolset_tags,
-            mute_log_status=True,
+            mute_log_status=mute_log_status,
         )
🧹 Nitpick comments (1)
holmes/core/toolset_manager.py (1)

481-481: Minor: Extra blank line.

An extra blank line was added here, which appears unintentional. Consider removing it to maintain consistent code formatting.

Apply this diff to remove the extra blank line:

-
     from holmes.core.transformers import registry
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 77626fe and b3479b3.

📒 Files selected for processing (6)
  • holmes/core/tools.py (3 hunks)
  • holmes/core/toolset_manager.py (10 hunks)
  • holmes/interactive.py (1 hunks)
  • holmes/plugins/toolsets/prometheus/prometheus.py (4 hunks)
  • holmes/plugins/toolsets/service_discovery.py (1 hunks)
  • tests/core/test_toolset_manager.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: Use Ruff for formatting and linting (configured in pyproject.toml) for all Python code
Type hints are required; code should pass mypy (configured in pyproject.toml)
ALWAYS place Python imports at the top of the file, not inside functions or methods

Files:

  • holmes/core/tools.py
  • holmes/interactive.py
  • holmes/plugins/toolsets/prometheus/prometheus.py
  • tests/core/test_toolset_manager.py
  • holmes/core/toolset_manager.py
  • holmes/plugins/toolsets/service_discovery.py
holmes/plugins/toolsets/**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Toolsets must be located as holmes/plugins/toolsets/{name}.yaml or holmes/plugins/toolsets/{name}/

Files:

  • holmes/plugins/toolsets/prometheus/prometheus.py
  • holmes/plugins/toolsets/service_discovery.py
tests/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

Only use pytest markers that are defined in pyproject.toml; never introduce undefined markers/tags

Files:

  • tests/core/test_toolset_manager.py
tests/**

📄 CodeRabbit inference engine (CLAUDE.md)

Test files should mirror the source structure under tests/

Files:

  • tests/core/test_toolset_manager.py
🧠 Learnings (3)
📚 Learning: 2025-10-01T06:01:13.215Z
Learnt from: mainred
Repo: robusta-dev/holmesgpt PR: 992
File: holmes/plugins/toolsets/__init__.py:106-109
Timestamp: 2025-10-01T06:01:13.215Z
Learning: In the holmesgpt repository (Python), function-scoped imports are acceptable when dealing with optional dependencies that may be missing on some platforms. For example, PrometheusToolset is imported inside the load_python_toolsets function to avoid import-time failures when DISABLE_PROMETHEUS_TOOLSET is true.

Applied to files:

  • holmes/plugins/toolsets/prometheus/prometheus.py
📚 Learning: 2025-10-05T13:01:12.288Z
Learnt from: CR
Repo: robusta-dev/holmesgpt PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-05T13:01:12.288Z
Learning: Applies to tests/**/test_case.yaml : Do NOT put toolset configuration directly in test_case.yaml; keep toolset config in a separate toolsets.yaml

Applied to files:

  • tests/core/test_toolset_manager.py
📚 Learning: 2025-08-08T06:15:30.784Z
Learnt from: nilo19
Repo: robusta-dev/holmesgpt PR: 695
File: holmes/core/transformers/registry.py:9-19
Timestamp: 2025-08-08T06:15:30.784Z
Learning: holmes/core/transformers/registry.py: TransformerRegistry is intentionally single-threaded and not designed to be thread-safe; avoid proposing locks unless multi-threaded access is introduced later.

Applied to files:

  • holmes/core/toolset_manager.py
🧬 Code graph analysis (4)
holmes/core/tools.py (4)
tests/core/test_prompt.py (1)
  • console (14-15)
holmes/core/transformers/transformer.py (1)
  • Transformer (12-31)
holmes/core/transformers/base.py (3)
  • TransformerError (11-14)
  • BaseTransformer (17-62)
  • name (55-62)
holmes/utils/config_utils.py (1)
  • merge_transformers (11-91)
holmes/plugins/toolsets/prometheus/prometheus.py (2)
holmes/common/openshift.py (1)
  • load_openshift_token (10-15)
holmes/core/tools.py (3)
  • StructuredToolResult (78-102)
  • StructuredToolResultStatus (51-75)
  • Tool (172-364)
tests/core/test_toolset_manager.py (2)
holmes/core/toolset_manager.py (1)
  • load_console_toolset_with_status (240-329)
holmes/core/tools.py (2)
  • Toolset (533-782)
  • ToolsetTag (142-145)
holmes/core/toolset_manager.py (1)
holmes/core/tools.py (3)
  • Toolset (533-782)
  • check_prerequisites (682-761)
  • ToolsetTag (142-145)
🪛 Ruff (0.14.2)
holmes/core/toolset_manager.py

205-205: Unused method argument: mute_log_status

(ARG002)

⏰ 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: llm_evals
  • GitHub Check: Pre-commit checks
🔇 Additional comments (7)
holmes/interactive.py (1)

210-210: LGTM! Clear guidance for users.

The updated welcome banner effectively directs users to the /tools command for viewing toolset information, aligning with the PR objective to consolidate toolset status display.

holmes/plugins/toolsets/service_discovery.py (1)

38-40: LGTM! Appropriate log level reduction.

Downgrading the service discovery URL log from info to debug reduces console noise while preserving the information for debugging purposes. This aligns well with the PR's goal to streamline console output.

holmes/plugins/toolsets/prometheus/prometheus.py (1)

1552-1552: LGTM! Consistent log level adjustment.

The logging level change from info to debug for Prometheus auto-discovery is consistent with similar changes in service_discovery.py and supports the PR objective to reduce console verbosity.

tests/core/test_toolset_manager.py (1)

127-166: Tests updated correctly, but consider additional coverage.

The test updates properly reflect the method rename from load_toolset_with_status to load_console_toolset_with_status. All assertions remain valid.

However, consider adding test coverage for the new mute_log_status parameter behavior. Currently, there are no tests verifying that logging is actually suppressed when mute_log_status=True. This could be tested by:

  1. Mocking the logger and asserting specific log calls are/aren't made
  2. Verifying the parameter is correctly propagated through the call chain

Would you like me to suggest a test implementation?

holmes/core/tools.py (1)

682-761: LGTM! Clean implementation of logging suppression.

The mute_log_status parameter is well-implemented with:

  • Sensible default (False) maintaining backward compatibility
  • Clear docstring explaining the parameter's purpose
  • Consistent application to both success (✅) and failure (❌) logging paths
holmes/core/toolset_manager.py (2)

240-329: LGTM! Well-structured console-specific loader.

The rename from load_toolset_with_status to load_console_toolset_with_status clearly communicates the method's console-focused purpose. The implementation correctly:

  • Adds "Loading toolsets..." message for user feedback
  • Consistently uses mute_log_status=True to suppress detailed prerequisite logs
  • Provides a consolidated summary message directing users to /tools command

79-143: LGTM! Consistent mute_log_status propagation.

The mute_log_status parameter is properly threaded through:

  • _list_all_toolsets receives and passes it to check_toolset_prerequisites
  • check_toolset_prerequisites forwards it to each toolset's check_prerequisites method
  • Default value (False) preserves existing behavior

@github-actions
Copy link
Contributor

Results of HolmesGPT evals

  • ask_holmes: 34/36 test cases were successful, 1 regressions, 1 setup failures
Test suite Test case Status
ask 01_how_many_pods
ask 02_what_is_wrong_with_pod
ask 04_related_k8s_events
ask 05_image_version
ask 09_crashpod
ask 10_image_pull_backoff
ask 110_k8s_events_image_pull
ask 11_init_containers
ask 13a_pending_node_selector_basic
ask 14_pending_resources
ask 15_failed_readiness_probe
ask 17_oom_kill
ask 18_oom_kill_from_issues_history
ask 19_detect_missing_app_details
ask 20_long_log_file_search
ask 24_misconfigured_pvc
ask 24a_misconfigured_pvc_basic
ask 28_permissions_error 🚧
ask 39_failed_toolset
ask 41_setup_argo
ask 42_dns_issues_steps_new_tools
ask 43_current_datetime_from_prompt
ask 45_fetch_deployment_logs_simple
ask 51_logs_summarize_errors
ask 53_logs_find_term
ask 54_not_truncated_when_getting_pods
ask 59_label_based_counting
ask 60_count_less_than
ask 61_exact_match_counting
ask 63_fetch_error_logs_no_errors
ask 79_configmap_mount_issue
ask 83_secret_not_found
ask 86_configmap_like_but_secret
ask 93_calling_datadog[0]
ask 93_calling_datadog[1]
ask 93_calling_datadog[2]

Legend

  • ✅ the test was successful
  • :minus: the test was skipped
  • ⚠️ the test failed but is known to be flaky or known to fail
  • 🚧 the test had a setup failure (not a code regression)
  • 🔧 the test failed due to mock data issues (not a code regression)
  • 🚫 the test was throttled by API rate limits/overload
  • ❌ the test failed and should be fixed before merging the PR

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