Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions holmes/core/tool_calling_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,19 +491,19 @@ def call( # type: ignore
):
raise Exception(
"The Azure model you chose is not supported. Model version 1106 and higher required."
)
) from e
else:
logging.error(
f"LLM BadRequestError on model={self.llm.model} (iteration {i}): {e}",
exc_info=True,
)
logging.debug("Full traceback for BadRequestError:", exc_info=True)
raise
except Exception as e:
logging.error(
f"LLM call failed on model={self.llm.model} (iteration {i}): "
f"{type(e).__name__}: {e}",
exc_info=True,
)
logging.debug("Full traceback for LLM call failure:", exc_info=True)
raise

response = full_response.choices[0] # type: ignore
Expand Down Expand Up @@ -680,8 +680,9 @@ def _directly_invoke_tool_call(

except Exception as e:
logging.error(
f"Tool call to {tool_name} failed with an Exception", exc_info=True
f"Tool call to {tool_name} failed with an Exception: {e}"
)
logging.debug("Full traceback:", exc_info=True)
tool_response = StructuredToolResult(
status=StructuredToolResultStatus.ERROR,
error=f"Tool call failed: {e}",
Expand Down Expand Up @@ -1014,15 +1015,15 @@ def call_stream(
else:
logging.error(
f"LLM BadRequestError on model={self.llm.model} (streaming iteration {i}): {e}",
exc_info=True,
)
logging.debug("Full traceback for BadRequestError:", exc_info=True)
raise
except Exception as e:
logging.error(
f"LLM call failed on model={self.llm.model} (streaming iteration {i}): "
f"{type(e).__name__}: {e}",
exc_info=True,
)
logging.debug("Full traceback for LLM call failure:", exc_info=True)
raise

response_message = full_response.choices[0].message # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion holmes/core/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ def __execute_subprocess(self, cmd) -> Tuple[str, int]:
except Exception as e:
logger.error(
f"An unexpected error occurred while running '{cmd}': {e}",
exc_info=True,
)
logger.debug("Full traceback:", exc_info=True)
output = f"Command execution failed with error: {e}"
return output, 1

Expand Down
8 changes: 5 additions & 3 deletions holmes/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,8 @@ def save_conversation_to_file(
f"[bold {STATUS_COLOR}]Conversation saved to {json_output_file}[/bold {STATUS_COLOR}]"
)
except Exception as e:
logging.error(f"Failed to save conversation: {e}", exc_info=e)
logging.error(f"Failed to save conversation: {e}")
logging.debug("Full traceback:", exc_info=e)
console.print(
f"[bold {ERROR_COLOR}]Failed to save conversation: {e}[/bold {ERROR_COLOR}]"
)
Expand Down Expand Up @@ -1432,8 +1433,9 @@ def get_bottom_toolbar():
)
break
except Exception as e:
logging.error("An error occurred during interactive mode:", exc_info=e)
console.print(f"[bold {ERROR_COLOR}]Error: {e}[/bold {ERROR_COLOR}]")
logging.debug("Full traceback for interactive mode error:", exc_info=e)
console.print(f"\n[bold {ERROR_COLOR}]Error: {e}[/bold {ERROR_COLOR}]")
console.print(f"[dim]Tip: Use -v for more details[/dim]")

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.

⚠️ Potential issue | 🟡 Minor

Remove extraneous f prefix — no placeholders in this string.

Ruff F541 flags this correctly. The string has no interpolation.

Proposed fix
-            console.print(f"[dim]Tip: Use -v for more details[/dim]")
+            console.print("[dim]Tip: Use -v for more details[/dim]")
🧰 Tools
🪛 Ruff (0.15.0)

[error] 1438-1438: f-string without any placeholders

Remove extraneous f prefix

(F541)

🤖 Prompt for AI Agents
In `@holmes/interactive.py` at line 1438, The console.print call uses an
unnecessary f-string prefix for a plain literal; locate the console.print call
that currently reads console.print(f"[dim]Tip: Use -v for more details[/dim]")
and remove the leading "f" so it becomes a normal string literal; update the
call in the interactive.py function/method where console.print is used and
re-run the linter (Ruff) to ensure the F541 warning is resolved.

finally:
# Print trace URL for debugging (works for both success and error cases)
trace_url = tracer.get_trace_url()
Expand Down
18 changes: 12 additions & 6 deletions holmes/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ def alertmanager(
try:
issues = source.fetch_issues()
except Exception as e:
logging.error("Failed to fetch issues from alertmanager", exc_info=e)
logging.error(f"Failed to fetch issues from alertmanager: {e}")
logging.debug("Full traceback:", exc_info=e)
return

if alertmanager_limit is not None:
Expand Down Expand Up @@ -596,7 +597,8 @@ def jira(
try:
issues = source.fetch_issues()
except Exception as e:
logging.error("Failed to fetch issues from Jira", exc_info=e)
logging.error(f"Failed to fetch issues from Jira: {e}")
logging.debug("Full traceback:", exc_info=e)
return

console.print(
Expand Down Expand Up @@ -688,7 +690,8 @@ def ticket(
if issue_to_investigate is None:
raise Exception(f"Issue {ticket_id} Not found")
except Exception as e:
logging.error(f"Failed to fetch issue from {source}", exc_info=e)
logging.error(f"Failed to fetch issue from {source}: {e}")
logging.debug("Full traceback:", exc_info=e)
console.print(
f"[bold red]Error: Failed to fetch issue {ticket_id} from {source}.[/bold red]"
)
Expand Down Expand Up @@ -792,7 +795,8 @@ def github(
try:
issues = source.fetch_issues()
except Exception as e:
logging.error("Failed to fetch issues from GitHub", exc_info=e)
logging.error(f"Failed to fetch issues from GitHub: {e}")
logging.debug("Full traceback:", exc_info=e)
return

console.print(
Expand Down Expand Up @@ -873,7 +877,8 @@ def pagerduty(
try:
issues = source.fetch_issues()
except Exception as e:
logging.error("Failed to fetch issues from PagerDuty", exc_info=e)
logging.error(f"Failed to fetch issues from PagerDuty: {e}")
logging.debug("Full traceback:", exc_info=e)
return

console.print(
Expand Down Expand Up @@ -956,7 +961,8 @@ def opsgenie(
try:
issues = source.fetch_issues()
except Exception as e:
logging.error("Failed to fetch issues from OpsGenie", exc_info=e)
logging.error(f"Failed to fetch issues from OpsGenie: {e}")
logging.debug("Full traceback:", exc_info=e)
return

console.print(
Expand Down
6 changes: 4 additions & 2 deletions holmes/utils/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def stream_investigate_formatter(
else:
yield create_sse_message(message.event.value, message.data)
except Exception as e:
logging.error(f"Error during streaming investigation: {e}", exc_info=True)
logging.error(f"Error during streaming investigation: {e}")
logging.debug("Full traceback:", exc_info=True)
if _is_rate_limit_error(e):
yield create_rate_limit_error_message(str(e))
else:
Expand Down Expand Up @@ -131,7 +132,8 @@ def stream_chat_formatter(
else:
yield create_sse_message(message.event.value, message.data)
except Exception as e:
logging.error(f"Error during streaming chat: {e}", exc_info=True)
logging.error(f"Error during streaming chat: {e}")
logging.debug("Full traceback:", exc_info=True)
if _is_rate_limit_error(e):
yield create_rate_limit_error_message(str(e))
else:
Expand Down
Loading