Skip to content

Add per-eval timeout to evals + small bug in eval results table - #910

Merged
aantn merged 1 commit into
masterfrom
per-eval-timeouts
Aug 26, 2025
Merged

aantn merged 1 commit into
masterfrom
per-eval-timeouts

Conversation

@aantn

@aantn aantn commented Aug 25, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@aantn
aantn requested a review from Sheeproid August 25, 2025 17:29
@coderabbitai

coderabbitai Bot commented Aug 25, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds optional per-test setup timeout support by introducing setup_timeout to HolmesTestCase, propagating it through run_commands to _invoke_command, and applying it to subprocess.run. Updates timeout messaging. Adjusts terminal reporter to compute average cost per test run (rows) instead of per unique test.

Changes

Cohort / File(s) Summary of changes
Per-test setup timeout plumbing
tests/llm/utils/test_case_utils.py, tests/llm/utils/commands.py
Added HolmesTestCase field setup_timeout: Optional[int]. Updated _invoke_command(command, cwd, timeout=None) to accept per-call timeout and pass it to subprocess.run. run_commands now derives timeout from test_case.setup_timeout (fallback to EVAL_SETUP_TIMEOUT). Updated timeout log and error message.
Reporting average cost denominator change
tests/llm/utils/reporting/terminal_reporter.py
Changed average cost calculation: total_cost / len(sorted_results) instead of dividing by count of unique test cases. Control flow and total cost aggregation unchanged.

Sequence Diagram(s)

sequenceDiagram
  participant Runner as run_commands
  participant Invoker as _invoke_command
  participant SubProc as subprocess.run

  Note over Runner: Determine per-test timeout<br/>(test_case.setup_timeout or env default)
  Runner->>Invoker: _invoke_command(cmd, cwd, timeout)
  Invoker->>SubProc: run(cmd, cwd, timeout=timeout)
  SubProc-->>Invoker: Completed process / Timeout
  alt Success
    Invoker-->>Runner: stdout
  else Timeout/Error
    Invoker-->>Runner: raise / TIMEOUT_ERROR (mentions env and setup_timeout)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • arikalon1

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch per-eval-timeouts

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@aantn
aantn enabled auto-merge (squash) August 25, 2025 17:30

@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: 1

🧹 Nitpick comments (3)
tests/llm/utils/commands.py (2)

113-120: Prefer explicit None-check; avoid truthiness filter for setup_timeout

Using a truthiness check will ignore a legitimate override if someone (incorrectly) sets 0, and could pass through negative integers if upstream validation is missing. After enforcing gt=0 in HolmesTestCase, use an explicit None-check here for clarity.

Apply this diff:

-        # Use per-test timeout if specified, otherwise use default
-        timeout = (
-            test_case.setup_timeout
-            if hasattr(test_case, "setup_timeout") and test_case.setup_timeout
-            else None
-        )
+        # Use per-test timeout if provided; otherwise use default at invocation
+        timeout = test_case.setup_timeout if test_case.setup_timeout is not None else None

143-143: Include working directory in timeout error details for faster triage

The message already shows the elapsed timeout and remediation. Adding the cwd helps correlate failures to the correct test folder, especially when multiple setups run in parallel.

Apply this diff:

-        error_details = f"TIMEOUT after {e.timeout}s\n\nYou can increase timeout with environment variable EVAL_SETUP_TIMEOUT=<seconds> or by setting 'setup_timeout' in test_case.yaml\n\nScript that timed out:\n$ {_truncate_script(script)}"
+        error_details = (
+            f"TIMEOUT after {e.timeout}s (cwd: {test_case.folder})\n\n"
+            "You can increase timeout with environment variable EVAL_SETUP_TIMEOUT=<seconds> "
+            "or by setting 'setup_timeout' in test_case.yaml\n\n"
+            f"Script that timed out:\n$ {_truncate_script(script)}"
+        )
tests/llm/utils/reporting/terminal_reporter.py (1)

913-918: Average cost denominator should exclude non-executed runs; update label accordingly

Using all rows (including skipped/setup-failed) underestimates the “average per test” since those runs typically have zero cost. Compute the denominator from executed runs (VALID_RUNS) or, even stricter, from runs that actually incurred cost. Also, the label should reflect “per run” to match the new semantics.

Apply this diff:

-        # Count total number of test runs (not unique test cases)
-        total_test_runs = len(sorted_results)
-        avg_cost_per_test = total_cost / total_test_runs if total_test_runs else 0
+        # Average over executed runs (exclude skipped/setup-failed)
+        valid_runs = count_results(sorted_results, ResultType.VALID_RUNS)
+        # Alternatively, to average only over runs that incurred cost, use:
+        # valid_runs = sum(1 for r in sorted_results if r.get("cost", 0) > 0)
+        avg_cost_per_test = total_cost / valid_runs if valid_runs else 0
-        console.print(
-            f"[cyan]Total evaluation cost: ${total_cost:.4f}, Average per test: ${avg_cost_per_test:.6f}[/cyan]"
-        )
+        console.print(
+            f"[cyan]Total evaluation cost: ${total_cost:.4f}, Average per run: ${avg_cost_per_test:.6f}[/cyan]"
+        )
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 73b63fa and 49b9073.

📒 Files selected for processing (3)
  • tests/llm/utils/commands.py (4 hunks)
  • tests/llm/utils/reporting/terminal_reporter.py (1 hunks)
  • tests/llm/utils/test_case_utils.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: Always place Python imports at the top of the file, not inside functions or methods
Type hints are required (mypy is configured in pyproject.toml)

Files:

  • tests/llm/utils/reporting/terminal_reporter.py
  • tests/llm/utils/commands.py
  • tests/llm/utils/test_case_utils.py
tests/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

Do not use invalid pytest markers; only use markers/tags declared in pyproject.toml

Files:

  • tests/llm/utils/reporting/terminal_reporter.py
  • tests/llm/utils/commands.py
  • tests/llm/utils/test_case_utils.py
tests/llm/**

📄 CodeRabbit inference engine (CLAUDE.md)

Resource and file naming in evals should be neutral and must not hint at the problem (avoid names like broken-pod or crashloop-app)

Files:

  • tests/llm/utils/reporting/terminal_reporter.py
  • tests/llm/utils/commands.py
  • tests/llm/utils/test_case_utils.py
⏰ 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). (5)
  • GitHub Check: llm_evals
  • GitHub Check: Pre-commit checks
  • GitHub Check: build (3.10)
  • GitHub Check: build (3.12)
  • GitHub Check: build (3.11)
🔇 Additional comments (1)
tests/llm/utils/commands.py (1)

57-61: LGTM: Per-call timeout plumbed correctly into subprocess.run

The optional timeout parameter with a safe fallback to EVAL_SETUP_TIMEOUT is clear, logged, and correctly passed to subprocess.run.

Also applies to: 69-69

Comment thread tests/llm/utils/test_case_utils.py
@github-actions

Copy link
Copy Markdown
Contributor

Results of HolmesGPT evals

  • ask_holmes: 33/38 test cases were successful, 1 regressions, 2 skipped, 2 setup failures
Test suite Test case Status
ask 01_how_many_pods ✅
ask 02_what_is_wrong_with_pod ✅
ask 03_what_is_the_command_to_port_forward ✅
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_crash_looping_v2 ✅
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 29_events_from_alert_manager ↪️
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
  • ↪️ 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 failed and should be fixed before merging the PR

@aantn
aantn disabled auto-merge August 26, 2025 06:24
@aantn
aantn enabled auto-merge (squash) August 26, 2025 06:24
@aantn
aantn merged commit 32f6a7e into master Aug 26, 2025
13 of 15 checks passed
@aantn
aantn deleted the per-eval-timeouts branch August 26, 2025 06:24
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