Repository navigation
mute unncessary info log for console - #994
Conversation
WalkthroughAdjusts logging behavior in configuration and toolset initialization, refines early-exit log levels in Supabase DAL, and ensures gzip is imported for evidence decompression. No public API changes or control-flow alterations beyond logging conditions. Changes
Sequence Diagram(s)Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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. Comment |
There was a problem hiding this comment.
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 (3)
holmes/plugins/toolsets/investigator/core_investigation.py (1)
38-41: Add type hints to satisfy mypy.Annotate tasks parameter and return type.
Apply this diff:
- def print_tasks_table(self, tasks): + def print_tasks_table(self, tasks: list[Task]) -> None:holmes/core/supabase_dal.py (1)
323-333: Avoid logging sensitive evidence payloads.logging.exception(f"...: {data}") can leak PII and large blobs. Log minimal context and use parameterized logging.
Apply this diff:
- except Exception: - logging.exception(f"Unknown issue unzipping gz finding: {data}") + except Exception: + # Avoid logging full evidence payloads (PII risk) + logging.exception( + "Unknown issue unzipping gz finding (id=%s, type=%s)", + data.get("id"), + data.get("enrichment_type"), + )holmes/core/llm.py (1)
218-236: Fix potential UnboundLocalError in token counting.When content is a dict with a "type" key, message_to_count is not set before use.
Apply this diff:
- elif isinstance(message["content"], dict): - if "type" not in message["content"]: - message_to_count = [ - {"type": "text", "text": json.dumps(message["content"])} - ] - token_count = litellm.token_counter( + elif isinstance(message["content"], dict): + if "type" not in message["content"]: + message_to_count = [ + {"type": "text", "text": json.dumps(message["content"])} + ] + else: + # Already a structured content block + message_to_count = [message["content"]] + token_count = litellm.token_counter( model=self.model, messages=message_to_count )
🧹 Nitpick comments (7)
holmes/plugins/toolsets/investigator/core_investigation.py (1)
65-76: Reduce log verbosity: downgrade task table logs to debug.Aligns with “mute info logs”; printing a full table at info is noisy.
Apply this diff:
- logging.info("Updated Investigation Tasks:") - logging.info(separator) - logging.info(header) - logging.info(separator) + logging.debug("Updated Investigation Tasks:") + logging.debug(separator) + logging.debug(header) + logging.debug(separator) @@ - logging.info(row) + logging.debug(row) @@ - logging.info(separator) + logging.debug(separator)holmes/config.py (2)
117-121: DAL property is optional but still eagerly instantiates SupabaseDal.This is okay, but if the goal is to avoid DAL initialization when not needed, consider only constructing DAL when explicitly requested by callers (not from registry creation).
Apply this diff to simplify the getter (no behavior change):
- return self._dal if self._dal else None + return self._dal
123-126: Avoid forcing DAL construction when creating LLM registry.Passing dal=self.dal triggers DAL creation via the property. Pass the raw backing field to keep DAL truly optional.
Apply this diff:
- self._llm_model_registry = LLMModelRegistry(self, dal=self.dal) + self._llm_model_registry = LLMModelRegistry(self, dal=self._dal)holmes/core/llm.py (1)
517-522: Environment substitution not applied to parsed model entries.Reassigning to local params has no effect on models; replace_env_vars_values likely returns a new dict.
Apply this diff:
- for _, params in models.items(): - params = replace_env_vars_values(params) + for key, params in list(models.items()): + models[key] = replace_env_vars_values(params)tests/test_server_endpoints.py (3)
21-23: Return None (or Instructions) instead of [] for get_global_instructions_for_account.The real method returns Optional[Instructions]; using [] can mask type issues.
Apply this diff:
- mock_dal.get_global_instructions_for_account.return_value = [] + mock_dal.get_global_instructions_for_account.return_value = None
81-90: Same note: prefer None for get_global_instructions_for_account mock.Apply this diff:
- mock_dal.get_global_instructions_for_account.return_value = [] + mock_dal.get_global_instructions_for_account.return_value = None
141-150: Same note: prefer None for get_global_instructions_for_account mock.Apply this diff:
- mock_dal.get_global_instructions_for_account.return_value = [] + mock_dal.get_global_instructions_for_account.return_value = None
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 85ce5b3 and e05ac64ceb967a1b9d53bdf67b1f32280bcaa234.
📒 Files selected for processing (5)
holmes/config.py(5 hunks)holmes/core/llm.py(3 hunks)holmes/core/supabase_dal.py(3 hunks)holmes/plugins/toolsets/investigator/core_investigation.py(1 hunks)tests/test_server_endpoints.py(6 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.py: Always place Python imports at the top of the file, not inside functions or methods
All Python code must include type hints (mypy enforced)
Files:
holmes/config.pyholmes/plugins/toolsets/investigator/core_investigation.pytests/test_server_endpoints.pyholmes/core/supabase_dal.pyholmes/core/llm.py
holmes/plugins/toolsets/**
📄 CodeRabbit inference engine (CLAUDE.md)
Toolsets must be organized under holmes/plugins/toolsets/ as either {name}.yaml files or directories
Files:
holmes/plugins/toolsets/investigator/core_investigation.py
holmes/{core,plugins}/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
All tools must return detailed error messages from underlying APIs, including executed command/query, time ranges/parameters, and full API error response; 'no data' responses must specify what was searched and where
Files:
holmes/plugins/toolsets/investigator/core_investigation.pyholmes/core/supabase_dal.pyholmes/core/llm.py
tests/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Only use pytest markers that are declared in pyproject.toml; never introduce undeclared markers/tags
Files:
tests/test_server_endpoints.py
tests/**
📄 CodeRabbit inference engine (CLAUDE.md)
Test layout should mirror the source structure under tests/
Files:
tests/test_server_endpoints.py
🧠 Learnings (1)
📚 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
🧬 Code graph analysis (4)
holmes/config.py (2)
holmes/core/supabase_dal.py (1)
SupabaseDal(64-603)holmes/core/llm.py (1)
models(514-515)
holmes/plugins/toolsets/investigator/core_investigation.py (2)
holmes/core/todo_tasks_formatter.py (1)
format_tasks(6-51)holmes/core/tools.py (6)
StructuredToolResult(78-102)StructuredToolResultStatus(51-75)Tool(162-353)ToolParameter(154-159)Toolset(520-735)ToolsetTag(142-145)
tests/test_server_endpoints.py (2)
tests/test_holmes_sync_toolsets.py (1)
mock_dal(24-28)holmes/core/supabase_dal.py (3)
get_global_instructions_for_account(446-465)get_workload_issues(494-542)get_resource_instructions(413-444)
holmes/core/llm.py (2)
holmes/config.py (1)
dal(117-120)holmes/core/supabase_dal.py (1)
SupabaseDal(64-603)
⏰ 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: Pre-commit checks
- GitHub Check: llm_evals
🔇 Additional comments (9)
holmes/core/supabase_dal.py (3)
3-3: LGTM: gzip import added for decompression.
69-72: LGTM: switched to debug when DAL is disabled.This reduces noise when tokens are not configured.
127-127: LGTM: reduced log level for missing Robusta config.holmes/config.py (2)
129-135: LGTM: muted model list logs unless multiple models are present.
452-458: LGTM: guard Robusta token retrieval behind optional DAL.Prevents needless DAL calls when not configured.
holmes/core/llm.py (2)
375-380: LGTM: LLMModelRegistry now accepts Optional DAL.
420-423: LGTM: Skip Robusta model loading when DAL is absent.tests/test_server_endpoints.py (2)
228-233: Prefer realistic types for DAL mocks.Align return types with SupabaseDal: get_workload_issues returns list[dict], get_resource_instructions returns Optional[ResourceInstructions].
Please verify server endpoint expectations; if they expect list[str], adjust accordingly. Otherwise, consider returning dicts (e.g., [{"data": "...", "enrichment_type": "text_file"}]) or constructing a ResourceInstructions instance in the test.
14-20: No changes required:server.dalis a module attribute
Line 81 inserver.pydefinesdal = config.daland noserver/dal.pyexists, sopatch("server.dal")correctly targets the attribute.
e05ac64 to
47c01fb
Compare
Make config.dal to optional since dal is passing down to tool_executor and to the tool. This protect the case when we don't use Dal is CLI.