Skip to content

Show braintrust traces on exceptions - #1048

Merged
aantn merged 4 commits into
masterfrom
show-traces-on-exceptions
Oct 31, 2025
Merged

aantn merged 4 commits into
masterfrom
show-traces-on-exceptions

Conversation

@aantn

@aantn aantn commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

When testing deepseek with SambaNova, I ran into an issue where SambaNova was returning errors. I wanted to troubleshoot it with --trace=braintrust, but couldn't do so because traces are not shown on exceptions from the LLM. This PR fixes that.

@aantn
aantn requested a review from arikalon1 October 9, 2025 12:06
@aantn
aantn enabled auto-merge (squash) October 9, 2025 12:06
@coderabbitai

coderabbitai Bot commented Oct 9, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Move trace-URL printing from the success path into a finally block in interactive mode so the tracer is queried and the trace URL (if any) is printed regardless of success or exception. No public API or signature changes.

Changes

Cohort / File(s) Summary
Interactive error trace link
holmes/interactive.py
Shifted trace-URL printing into a finally block so the tracer is queried and "View trace" is printed when available on both success and exception paths. Removed previous conditional success-only print. No API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant CLI as Interactive CLI
  participant Engine
  participant Tracer

  User->>CLI: Enter command
  CLI->>Engine: Execute
  alt Engine returns result
    Engine-->>CLI: Result
    CLI-->>User: Output result
  else Engine raises exception
    Engine-->>CLI: Exception
    CLI-->>User: Error message
  end
  Note right of CLI: finally block executes (both success & error)
  CLI->>Tracer: get_trace_url()
  Tracer-->>CLI: trace URL (optional)
  opt Trace available
    CLI-->>User: "View trace: <url>"
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 title "Show braintrust traces on exceptions" directly aligns with the main change in the pull request. The raw summary indicates that the modification moves trace URL printing from the success path to a finally block, ensuring traces are printed regardless of whether the run succeeds or encounters exceptions. The title concisely and clearly communicates this primary objective without vagueness, jargon, or unnecessary noise.
Description Check ✅ Passed The description is directly related to the changeset and provides meaningful context about the problem being addressed. It explains the motivation (inability to troubleshoot with --trace=braintrust when exceptions occur) and confirms that the PR fixes this issue by enabling trace display on exceptions. The description aligns with the actual code changes that move trace URL printing to a finally block, making it clearly relevant to the changeset.
✨ 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 show-traces-on-exceptions

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 210773e and 4408f05.

📒 Files selected for processing (1)
  • holmes/interactive.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.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/interactive.py
🧬 Code graph analysis (1)
holmes/interactive.py (1)
holmes/core/tracing.py (2)
  • get_trace_url (136-137)
  • get_trace_url (216-239)
⏰ 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: build
🔇 Additional comments (1)
holmes/interactive.py (1)

1264-1268: LGTM! Finally block correctly ensures trace URL is shown on exceptions.

The implementation correctly achieves the PR objective by printing the trace URL regardless of whether the interaction succeeds or fails. The conditional check prevents spurious output when no trace exists.


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.

Comment thread holmes/interactive.py
@aantn

aantn commented Oct 21, 2025

Copy link
Copy Markdown
Collaborator Author

@mainred do you mean re-reviewing please?

@aantn
aantn merged commit be4d04f into master Oct 31, 2025
8 checks passed
@aantn
aantn deleted the show-traces-on-exceptions branch October 31, 2025 17:02
@github-actions

Copy link
Copy Markdown
Contributor

Results of HolmesGPT evals

  • ask_holmes: 32/36 test cases were successful, 3 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.

3 participants