From 8774a0b5baa6ff5f8d73f358b386d8060543f465 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 12:46:22 +0000 Subject: [PATCH 01/18] Fix eval regression marker default for manual triggers - Remove 'regression' as default marker for /eval comments and workflow_dispatch triggers - they now run all LLM tests by default - Keep 'regression' as default only for automatic triggers (PR/push) - Add details section with list of valid markers and example test names - Update marker_expr to handle empty markers (just 'llm' instead of 'llm and ()') Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 67c518d1d5..3c75c755d6 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -16,9 +16,9 @@ on: required: false default: '' markers: - description: 'Pytest markers (e.g., regression, easy, logs). Combined with "llm and"' + description: 'Pytest markers (e.g., regression, easy, logs). Combined with "llm and". Leave empty for all LLM tests.' required: false - default: 'regression' + default: '' filter: description: 'Pytest -k filter (e.g., 09_crashpod, checkout)' required: false @@ -108,7 +108,7 @@ jobs: } function parseComment(body) { - const params = { model: '', markers: 'regression', filter: '', iterations: '1' }; + const params = { model: '', markers: '', filter: '', iterations: '1' }; const validKeys = new Set(Object.keys(params)); for (const line of body.split('\n').slice(1)) { const colonIdx = line.indexOf(':'); @@ -155,7 +155,8 @@ jobs: // Apply defaults if (!model) model = ${{ toJSON(vars.MODEL) }} || ''; - if (!markers) markers = 'regression'; + // Only apply regression default for automatic triggers, not for manual /eval or workflow_dispatch + if (!markers && !isManual) markers = 'regression'; let iterNum = Math.min(Math.max(parseInt(iterations, 10) || 1, 1), 10); core.setOutput('model', model); @@ -165,7 +166,7 @@ jobs: core.setOutput('is_manual', isManual.toString()); core.setOutput('trigger_source', triggerSource); core.setOutput('pr_number', prNumber ? prNumber.toString() : ''); - core.setOutput('marker_expr', `llm and (${markers})`); + core.setOutput('marker_expr', markers ? `llm and (${markers})` : 'llm'); core.setOutput('run_url', `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`); - name: Check if tests should run @@ -316,10 +317,20 @@ jobs: '```\n/eval\nmodel: gpt-4o\nfilter: 09_crashpod\niterations: 5\n```\n\n' + '| Option | Description |\n|--------|-------------|\n' + '| `model` | Model(s) to test (default: same as automatic runs) |\n' + - '| `markers` | Pytest markers (default: regression) |\n' + + '| `markers` | Pytest markers (default: all LLM tests) |\n' + '| `filter` | Pytest -k filter |\n' + '| `iterations` | Number of runs, max 10 |\n\n' + - `**Option 2: [Trigger via GitHub Actions UI](${workflowUrl})** โ†’ "Run workflow"\n\n`; + `**Option 2: [Trigger via GitHub Actions UI](${workflowUrl})** โ†’ "Run workflow"\n\n` + + '\n
\n๐Ÿ“‹ Valid eval names and markers\n\n' + + '**Valid markers:**\n' + + '`regression`, `easy`, `medium`, `hard`, `logs`, `metrics`, `kubernetes`, `prometheus`, `loki`, `grafana-dashboard`, ' + + '`traces`, `datadog`, `newrelic`, `coralogix`, `runbooks`, `transparency`, `question-answer`, `counting`, ' + + '`database`, `storage`, `kafka`, `chain-of-causation`, `compaction`, `network`, `port-forward`\n\n' + + '**Example test names (use with `filter`):**\n' + + '`09_crashpod`, `17_oom_kill`, `10_image_pull_backoff`, `22_high_latency_dbi_down`, `35_tempo`, ' + + '`100a_loki_historical_logs`, `114_checkout_latency_tracing_rebuild`, `177_grafana_home_dashboard`\n\n' + + 'Full list: Run `ls tests/llm/fixtures/test_ask_holmes/` or `ls tests/llm/fixtures/test_investigate/`\n' + + '
\n'; } if (p.commentId) { From ac63a82528088cf081afc9081724a4710f202dfc Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 12:53:07 +0000 Subject: [PATCH 02/18] Add test preview and warning for manual eval triggers - Add test preview step that runs pytest --collect-only to show which tests will run before actually running them - Update initial comment with test count and expandable test list - Add warning that manual re-runs have no default markers and will run all LLM tests (~100+) which can take 1+ hours - Update example /eval command to include markers: regression - Update markers description to emphasize no default Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 84 ++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 3c75c755d6..7f20e0a706 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -232,6 +232,80 @@ jobs: python-version: '3.12' install-kubectl: 'true' + - name: Preview tests to run + if: steps.check-tests.outputs.should-run == 'true' && steps.eval-params.outputs.pr_number != '' + id: test-preview + shell: bash + env: + EVAL_MARKER_EXPR: ${{ steps.eval-params.outputs.marker_expr }} + EVAL_FILTER: ${{ steps.eval-params.outputs.filter }} + run: | + PYTEST_ARGS=(--collect-only -q tests/llm/test_ask_holmes.py tests/llm/test_investigate.py -m "$EVAL_MARKER_EXPR") + [[ -n "$EVAL_FILTER" ]] && PYTEST_ARGS+=(-k "$EVAL_FILTER") + + # Collect test names + TEST_LIST=$(poetry run pytest "${PYTEST_ARGS[@]}" 2>/dev/null | grep -E "^tests/llm/" | head -50 || echo "") + TEST_COUNT=$(echo "$TEST_LIST" | grep -c "^tests/llm/" || echo "0") + + # Truncate if too many + if [[ $TEST_COUNT -gt 20 ]]; then + PREVIEW=$(echo "$TEST_LIST" | head -20) + PREVIEW="${PREVIEW}"$'\n'"... and $((TEST_COUNT - 20)) more tests" + else + PREVIEW="$TEST_LIST" + fi + + # Output for next step (escape for JSON) + echo "test_count=$TEST_COUNT" >> $GITHUB_OUTPUT + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "test_preview<<$EOF" >> $GITHUB_OUTPUT + echo "$PREVIEW" >> $GITHUB_OUTPUT + echo "$EOF" >> $GITHUB_OUTPUT + + - name: Update comment with test preview + if: steps.check-tests.outputs.should-run == 'true' && steps.eval-params.outputs.pr_number != '' && steps.initial-comment.outputs.comment_id != '' + uses: actions/github-script@v7 + with: + script: | + const p = { + isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', + trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, + model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', + markers: ${{ toJSON(steps.eval-params.outputs.markers) }} || 'all LLM tests', + filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, + iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, + runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + commentId: parseInt(${{ toJSON(steps.initial-comment.outputs.comment_id) }}, 10), + testCount: ${{ toJSON(steps.test-preview.outputs.test_count) }} || '0', + testPreview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} || '' + }; + + let body = p.isManual + ? `## ๐Ÿš€ Manual Eval Running...\n\n` + + `| Parameter | Value |\n|-----------|-------|\n` + + `| **Triggered via** | ${p.trigger} |\n` + + `| **Model** | \`${p.model}\` |\n` + + `| **Markers** | \`${p.markers}\` |\n` + + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + + `| **Iterations** | ${p.iterations} |\n` + + `| **Tests to run** | ${p.testCount} |\n` + + `| **Status** | โณ Running... |\n` + + `| **Workflow** | [View logs](${p.runUrl}) |\n` + : `## โณ HolmesGPT evals running...\n\n` + + `**Tests to run:** ${p.testCount}\n\n` + + `[View workflow logs](${p.runUrl})\n\n_Results will appear here when complete._\n`; + + if (p.testPreview && p.testCount !== '0') { + body += `\n
\n๐Ÿ“‹ Test preview\n\n\`\`\`\n${p.testPreview}\n\`\`\`\n
\n`; + } + + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: p.commentId, + body + }); + - name: Run tests if: steps.check-tests.outputs.should-run == 'true' id: evals @@ -311,13 +385,15 @@ jobs: if (!p.isManual) { const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/eval-regression.yaml`; body += '\n---\n
\n๐Ÿ”„ Re-run evals manually\n\n' + + '> โš ๏ธ **Warning:** Manual re-runs have NO default markers and will run ALL LLM tests (~100+), which can take 1+ hours. ' + + 'Use `markers: regression` or `filter: test_name` to limit scope.\n\n' + '**Option 1: Comment on this PR** with `/eval`:\n\n' + - '```\n/eval\n```\n\n' + - 'Or with options (one per line):\n\n' + - '```\n/eval\nmodel: gpt-4o\nfilter: 09_crashpod\niterations: 5\n```\n\n' + + '```\n/eval\nmarkers: regression\n```\n\n' + + 'Or with more options (one per line):\n\n' + + '```\n/eval\nmodel: gpt-4o\nmarkers: regression\nfilter: 09_crashpod\niterations: 5\n```\n\n' + '| Option | Description |\n|--------|-------------|\n' + '| `model` | Model(s) to test (default: same as automatic runs) |\n' + - '| `markers` | Pytest markers (default: all LLM tests) |\n' + + '| `markers` | Pytest markers (**no default - runs all tests!**) |\n' + '| `filter` | Pytest -k filter |\n' + '| `iterations` | Number of runs, max 10 |\n\n' + `**Option 2: [Trigger via GitHub Actions UI](${workflowUrl})** โ†’ "Run workflow"\n
\n` + From 12db5cbc005519f345126917df7e61b7cf11cf4d Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 12:56:52 +0000 Subject: [PATCH 03/18] Add notification comment for manual eval triggers When a user triggers evals manually via /eval comment or workflow_dispatch, they now receive a notification when the run completes. The notification: - @mentions the user who triggered the eval - Shows success or regression count status - Points to the updated results comment above This ensures users get a GitHub notification instead of having to poll the PR for the updated comment. Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 7f20e0a706..9f19c28b76 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -120,7 +120,7 @@ jobs: return params; } - let model, markers, filter, iterations, isManual, triggerSource, prNumber; + let model, markers, filter, iterations, isManual, triggerSource, prNumber, triggeredBy; const event = context.eventName; if (event === 'issue_comment') { @@ -133,6 +133,7 @@ jobs: isManual = true; triggerSource = '/eval comment'; prNumber = context.issue.number; + triggeredBy = context.payload.comment.user.login; } else if (event === 'workflow_dispatch') { model = validate(${{ toJSON(github.event.inputs.model) }} || '', 'model'); markers = validate(${{ toJSON(github.event.inputs.markers) }} || '', 'markers'); @@ -143,6 +144,7 @@ jobs: isManual = true; triggerSource = 'workflow_dispatch'; prNumber = prNum ? parseInt(prNum, 10) : null; + triggeredBy = context.actor; } else { model = ''; markers = 'regression'; @@ -151,6 +153,7 @@ jobs: isManual = false; triggerSource = 'automatic'; prNumber = event === 'pull_request' ? context.payload.pull_request.number : null; + triggeredBy = ''; } // Apply defaults @@ -166,6 +169,7 @@ jobs: core.setOutput('is_manual', isManual.toString()); core.setOutput('trigger_source', triggerSource); core.setOutput('pr_number', prNumber ? prNumber.toString() : ''); + core.setOutput('triggered_by', triggeredBy); core.setOutput('marker_expr', markers ? `llm and (${markers})` : 'llm'); core.setOutput('run_url', `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`); @@ -421,6 +425,28 @@ jobs: }); } + - name: Notify user of completion + if: always() && steps.eval-params.outputs.is_manual == 'true' && steps.eval-params.outputs.pr_number != '' && steps.eval-params.outputs.triggered_by != '' + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const triggeredBy = ${{ toJSON(steps.eval-params.outputs.triggered_by) }}; + const prNumber = parseInt(${{ toJSON(steps.eval-params.outputs.pr_number) }}, 10); + const regressions = fs.existsSync('regressions.txt') ? fs.readFileSync('regressions.txt', 'utf8').trim() : ''; + const hasRegressions = regressions && regressions !== '0'; + + const status = hasRegressions + ? `โš ๏ธ Completed with ${regressions} regression${regressions === '1' ? '' : 's'}` + : 'โœ… Completed successfully'; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: `@${triggeredBy} Your eval run has finished. ${status}\n\n๐Ÿ‘† See updated results above.` + }); + - name: Add completion reaction if: always() && github.event_name == 'issue_comment' && steps.eval-comment.outcome == 'success' uses: actions/github-script@v7 From 7b43d8af509375801dbacdd8c5b7ee9d8d07f03c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 13:00:34 +0000 Subject: [PATCH 04/18] Rename Test preview to Evals to run and remove limit - Rename step names and summary text from "Test preview" to "Evals to run" - Remove the 20 test limit to show all evals that will run Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 9f19c28b76..e356ef6ab1 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -236,7 +236,7 @@ jobs: python-version: '3.12' install-kubectl: 'true' - - name: Preview tests to run + - name: Collect evals to run if: steps.check-tests.outputs.should-run == 'true' && steps.eval-params.outputs.pr_number != '' id: test-preview shell: bash @@ -248,25 +248,17 @@ jobs: [[ -n "$EVAL_FILTER" ]] && PYTEST_ARGS+=(-k "$EVAL_FILTER") # Collect test names - TEST_LIST=$(poetry run pytest "${PYTEST_ARGS[@]}" 2>/dev/null | grep -E "^tests/llm/" | head -50 || echo "") + TEST_LIST=$(poetry run pytest "${PYTEST_ARGS[@]}" 2>/dev/null | grep -E "^tests/llm/" || echo "") TEST_COUNT=$(echo "$TEST_LIST" | grep -c "^tests/llm/" || echo "0") - # Truncate if too many - if [[ $TEST_COUNT -gt 20 ]]; then - PREVIEW=$(echo "$TEST_LIST" | head -20) - PREVIEW="${PREVIEW}"$'\n'"... and $((TEST_COUNT - 20)) more tests" - else - PREVIEW="$TEST_LIST" - fi - - # Output for next step (escape for JSON) + # Output for next step echo "test_count=$TEST_COUNT" >> $GITHUB_OUTPUT EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) echo "test_preview<<$EOF" >> $GITHUB_OUTPUT - echo "$PREVIEW" >> $GITHUB_OUTPUT + echo "$TEST_LIST" >> $GITHUB_OUTPUT echo "$EOF" >> $GITHUB_OUTPUT - - name: Update comment with test preview + - name: Update comment with evals list if: steps.check-tests.outputs.should-run == 'true' && steps.eval-params.outputs.pr_number != '' && steps.initial-comment.outputs.comment_id != '' uses: actions/github-script@v7 with: @@ -300,7 +292,7 @@ jobs: `[View workflow logs](${p.runUrl})\n\n_Results will appear here when complete._\n`; if (p.testPreview && p.testCount !== '0') { - body += `\n
\n๐Ÿ“‹ Test preview\n\n\`\`\`\n${p.testPreview}\n\`\`\`\n
\n`; + body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${p.testPreview}\n\`\`\`\n
\n`; } await github.rest.issues.updateComment({ From 682a68655588a7148004ee97e38057ac325d7206 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 13:15:55 +0000 Subject: [PATCH 05/18] Fix duplicate comment issue and remove placeholder text - Remove "Results will appear here when complete." text from both initial and running status comments since it's confusing - For manual triggers, don't create a new comment if comment_id is missing - the initial comment should always exist for manual runs Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index e356ef6ab1..b2d66cd6d6 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -212,7 +212,7 @@ jobs: `| **Iterations** | ${p.iterations} |\n` + `| **Status** | โณ Running... |\n` + `| **Workflow** | [View logs](${p.runUrl}) |\n` - : `## โณ HolmesGPT evals running...\n\n[View workflow logs](${p.runUrl})\n\n_Results will appear here when complete._\n`; + : `## โณ HolmesGPT evals running...\n\n[View workflow logs](${p.runUrl})\n`; const comment = await github.rest.issues.createComment({ owner: context.repo.owner, @@ -289,7 +289,7 @@ jobs: `| **Workflow** | [View logs](${p.runUrl}) |\n` : `## โณ HolmesGPT evals running...\n\n` + `**Tests to run:** ${p.testCount}\n\n` + - `[View workflow logs](${p.runUrl})\n\n_Results will appear here when complete._\n`; + `[View workflow logs](${p.runUrl})\n`; if (p.testPreview && p.testCount !== '0') { body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${p.testPreview}\n\`\`\`\n
\n`; @@ -410,7 +410,9 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, comment_id: parseInt(p.commentId, 10), body }); - } else { + } else if (!p.isManual) { + // For automatic triggers without an initial comment (e.g., fork PRs without secrets), + // create a new comment with results. For manual triggers, initial comment always exists. await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: p.prNumber, body From 044ec3564b4140f30ec2df578eb44842d281f718 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 13:34:11 +0000 Subject: [PATCH 06/18] Split markers and eval names into separate details sections - Split into two separate
sections: Valid markers and Valid eval names - List each marker and eval name on its own line - Include the complete list of all 140+ ask_holmes evals and 17 investigate evals Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 223 ++++++++++++++++++++++++- 1 file changed, 214 insertions(+), 9 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index b2d66cd6d6..2e11068f22 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -393,15 +393,220 @@ jobs: '| `filter` | Pytest -k filter |\n' + '| `iterations` | Number of runs, max 10 |\n\n' + `**Option 2: [Trigger via GitHub Actions UI](${workflowUrl})** โ†’ "Run workflow"\n
\n` + - '\n
\n๐Ÿ“‹ Valid eval names and markers\n\n' + - '**Valid markers:**\n' + - '`regression`, `easy`, `medium`, `hard`, `logs`, `metrics`, `kubernetes`, `prometheus`, `loki`, `grafana-dashboard`, ' + - '`traces`, `datadog`, `newrelic`, `coralogix`, `runbooks`, `transparency`, `question-answer`, `counting`, ' + - '`database`, `storage`, `kafka`, `chain-of-causation`, `compaction`, `network`, `port-forward`\n\n' + - '**Example test names (use with `filter`):**\n' + - '`09_crashpod`, `17_oom_kill`, `10_image_pull_backoff`, `22_high_latency_dbi_down`, `35_tempo`, ' + - '`100a_loki_historical_logs`, `114_checkout_latency_tracing_rebuild`, `177_grafana_home_dashboard`\n\n' + - 'Full list: Run `ls tests/llm/fixtures/test_ask_holmes/` or `ls tests/llm/fixtures/test_investigate/`\n' + + '\n
\n๐Ÿท๏ธ Valid markers\n\n' + + '- `regression`\n' + + '- `easy`\n' + + '- `medium`\n' + + '- `hard`\n' + + '- `logs`\n' + + '- `metrics`\n' + + '- `kubernetes`\n' + + '- `prometheus`\n' + + '- `loki`\n' + + '- `grafana-dashboard`\n' + + '- `traces`\n' + + '- `datadog`\n' + + '- `newrelic`\n' + + '- `coralogix`\n' + + '- `runbooks`\n' + + '- `transparency`\n' + + '- `question-answer`\n' + + '- `counting`\n' + + '- `database`\n' + + '- `storage`\n' + + '- `kafka`\n' + + '- `chain-of-causation`\n' + + '- `compaction`\n' + + '- `network`\n' + + '- `port-forward`\n' + + '
\n' + + '\n
\n๐Ÿ“‹ Valid eval names (use with filter)\n\n' + + '**test_ask_holmes:**\n' + + '- `01_how_many_pods`\n' + + '- `02_what_is_wrong_with_pod`\n' + + '- `03_what_is_the_command_to_port_forward`\n' + + '- `04_related_k8s_events`\n' + + '- `05_image_version`\n' + + '- `06_explain_issue`\n' + + '- `07_high_latency`\n' + + '- `08_sock_shop_frontend`\n' + + '- `09_crashpod`\n' + + '- `10_image_pull_backoff`\n' + + '- `11_init_containers`\n' + + '- `12_job_crashing`\n' + + '- `13a_pending_node_selector_basic`\n' + + '- `13b_pending_node_selector_detailed`\n' + + '- `14_pending_resources`\n' + + '- `15_failed_readiness_probe`\n' + + '- `16_failed_no_toolset_found`\n' + + '- `17_oom_kill`\n' + + '- `18_oom_kill_from_issues_history`\n' + + '- `19_detect_missing_app_details`\n' + + '- `20_long_log_file_search`\n' + + '- `21_job_fail_curl_no_svc_account`\n' + + '- `22_high_latency_dbi_down`\n' + + '- `23_app_error_in_current_logs`\n' + + '- `24_misconfigured_pvc`\n' + + '- `25_misconfigured_ingress_class`\n' + + '- `26_page_render_times`\n' + + '- `27a_multi_container_logs`\n' + + '- `27b_multi_container_logs`\n' + + '- `28_permissions_error`\n' + + '- `30_basic_promql_graph_cluster_memory`\n' + + '- `32_basic_promql_graph_pod_cpu`\n' + + '- `33_cpu_metrics_discovery`\n' + + '- `34_memory_graph`\n' + + '- `35_tempo`\n' + + '- `36_argocd_find_resource`\n' + + '- `37_argocd_wrong_namespace`\n' + + '- `38_rabbitmq_split_head`\n' + + '- `39_failed_toolset`\n' + + '- `41_setup_argo`\n' + + '- `42_dns_issues_result_all_tools`\n' + + '- `42_dns_issues_result_new_tools`\n' + + '- `42_dns_issues_result_new_tools_no_runbook`\n' + + '- `42_dns_issues_result_old_tools`\n' + + '- `42_dns_issues_steps_new_all_tools`\n' + + '- `42_dns_issues_steps_new_tools`\n' + + '- `42_dns_issues_steps_old_tools`\n' + + '- `43_current_datetime_from_prompt`\n' + + '- `43_slack_deployment_logs`\n' + + '- `44_slack_statefulset_logs`\n' + + '- `45_fetch_deployment_logs_simple`\n' + + '- `46_job_crashing_no_longer_exists`\n' + + '- `47_truncated_logs_context_window`\n' + + '- `48_logs_since_thursday`\n' + + '- `49_logs_since_last_week`\n' + + '- `50_logs_since_specific_date`\n' + + '- `50a_logs_since_last_specific_month`\n' + + '- `51_logs_summarize_errors`\n' + + '- `52_logs_login_issues`\n' + + '- `53_logs_find_term`\n' + + '- `54_azure_sql`\n' + + '- `54_not_truncated_when_getting_pods`\n' + + '- `55_kafka_runbook`\n' + + '- `57_cluster_name_confusion`\n' + + '- `57_wrong_namespace`\n' + + '- `58_counting_pods_by_status`\n' + + '- `59_label_based_counting`\n' + + '- `60_count_less_than`\n' + + '- `61_exact_match_counting`\n' + + '- `62_fetch_error_logs_with_errors`\n' + + '- `63_fetch_error_logs_no_errors`\n' + + '- `64_keda_vs_hpa_confusion`\n' + + '- `65_health_check_followup`\n' + + '- `66_http_error_needle`\n' + + '- `67_performance_degradation`\n' + + '- `68_cascading_failures`\n' + + '- `69_rate_limit_exhaustion`\n' + + '- `70_memory_leak_detection`\n' + + '- `71_connection_pool_starvation`\n' + + '- `73a_time_window_anomaly`\n' + + '- `73b_time_window_anomaly`\n' + + '- `74_config_change_impact`\n' + + '- `75_network_flapping`\n' + + '- `76_service_discovery_issue`\n' + + '- `77_liveness_probe_misconfiguration`\n' + + '- `78a_missing_cpu_limits`\n' + + '- `78b_cpu_quota_exceeded`\n' + + '- `79_configmap_mount_issue`\n' + + '- `80_pvc_storage_class_mismatch`\n' + + '- `81_service_account_permission_denied`\n' + + '- `82_pod_anti_affinity_conflict`\n' + + '- `83_secret_not_found`\n' + + '- `84_network_policy_blocking_traffic`\n' + + '- `85_hpa_not_scaling`\n' + + '- `86_configmap_like_but_secret`\n' + + '- `89_runbook_missing_cloudwatch`\n' + + '- `90_runbook_basic_selection`\n' + + '- `91a_datadog_metrics_missing_namespace`\n' + + '- `91b_datadog_metrics_pod_exists`\n' + + '- `91c_datadog_metrics_deployment`\n' + + '- `91d_datadog_metrics_historical_pod`\n' + + '- `91e_datadog_custom_metrics`\n' + + '- `91f_datadog_logs_historical_pod`\n' + + '- `91g_datadog_metrics_mismatched_pod`\n' + + '- `91h_datadog_logs_empty_query_with_url`\n' + + '- `91i_datadog_metrics_empty_query_with_url`\n' + + '- `92_cpu_graph_conversation`\n' + + '- `93_calling_datadog`\n' + + '- `93_events_since_specific_date`\n' + + '- `94_runbook_transparency`\n' + + '- `95_runbook_memory_leak_detection`\n' + + '- `96_no_matching_runbook`\n' + + '- `97_logs_clarification_needed`\n' + + '- `99_logs_transparency_custom_time`\n' + + '- `100a_loki_historical_logs`\n' + + '- `100b_loki_historical_logs_nonstandard_label`\n' + + '- `101_loki_historical_logs_pod_deleted`\n' + + '- `102_loki_label_discovery`\n' + + '- `102a_loki_logs_transparency`\n' + + '- `102b_loki_multiple_pods`\n' + + '- `103_logs_transparency_default_limit`\n' + + '- `104a_postgres_root_issue`\n' + + '- `104b_postgres_missing_index_pgstat`\n' + + '- `104c_postgres_minimal_missing_index`\n' + + '- `105_redis_wrong_data_structure`\n' + + '- `107_log_filter_http_status_code`\n' + + '- `108_logs_nearby_lines`\n' + + '- `109_logs_transparency_not_found`\n' + + '- `110_cpu_graph_robusta_runner`\n' + + '- `110_k8s_events_image_pull`\n' + + '- `111_disabled_datadog_traces`\n' + + '- `111_pod_names_contain_service`\n' + + '- `111_tool_hallucination`\n' + + '- `112_find_pvcs_by_uuid`\n' + + '- `114_checkout_latency_tracing_rebuild`\n' + + '- `115_checkout_errors_tracing`\n' + + '- `117_new_relic_tracing`\n' + + '- `117b_new_relic_block_embed`\n' + + '- `118_new_relic_logs`\n' + + '- `119_new_relic_metrics`\n' + + '- `120_new_relic_traces2`\n' + + '- `121_new_relic_checkout_errors_tracing`\n' + + '- `122_new_relic_checkout_latency_tracing_rebuild`\n' + + '- `123_new_relic_checkout_errors_tracing`\n' + + '- `124_checkout_latency_prometheus`\n' + + '- `151_disabled_toolsets_fallback_only`\n' + + '- `156_kafka_opensearch_latency`\n' + + '- `157_disk_full_statefulset`\n' + + '- `158_slack_chat_correct_date`\n' + + '- `159_prometheus_high_cardinality_cpu`\n' + + '- `160_electricity_market_bidding_bug`\n' + + '- `160a_cpu_per_namespace_graph`\n' + + '- `160b_cpu_per_namespace_graph_with_prom_truncation`\n' + + '- `160c_cpu_per_namespace_graph_with_global_truncation`\n' + + '- `161_bidding_version_performance`\n' + + '- `161_conversation_compaction`\n' + + '- `162_get_runbooks`\n' + + '- `163_compaction_follow_up`\n' + + '- `164_datadog_traces_coupon_code`\n' + + '- `165_alert_with_multiple_runbooks`\n' + + '- `173_coralogix_logs`\n' + + '- `174_coralogix_traces_ad`\n' + + '- `175_coralogix_metrics_frontend`\n' + + '- `176_network_policy_blocking_traffic_no_runbooks`\n' + + '- `177_grafana_home_dashboard`\n' + + '- `178_grafana_search_dashboard_query`\n' + + '- `179_grafana_big_dashboard_query`\n\n' + + '**test_investigate:**\n' + + '- `01_oom_kill`\n' + + '- `02_crashloop_backoff`\n' + + '- `03_cpu_throttling`\n' + + '- `04_image_pull_backoff`\n' + + '- `05_crashpod`\n' + + '- `06_job_failure`\n' + + '- `07_job_syntax_error`\n' + + '- `08_memory_pressure`\n' + + '- `09_high_latency`\n' + + '- `10_KubeDeploymentReplicasMismatch`\n' + + '- `11_KubePodCrashLooping`\n' + + '- `12_KubePodNotReady`\n' + + '- `13_Watchdog`\n' + + '- `14_tempo`\n' + + '- `15_dns_resolution`\n' + + '- `16_dns_resolution_no_tool`\n' + + '- `17_investigate_correct_date`\n' + '
\n'; } From 0d133f522b341c49751793fd245572daa689fcca Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 13:54:02 +0000 Subject: [PATCH 07/18] Fix grep -c exit code issue in test collection grep -c returns exit code 1 when no matches found, even though it outputs "0". Using || echo "0" would result in "0\n0" being captured. Changed to || true which prevents failure without adding extra output. Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 2e11068f22..5e3799c819 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -248,8 +248,8 @@ jobs: [[ -n "$EVAL_FILTER" ]] && PYTEST_ARGS+=(-k "$EVAL_FILTER") # Collect test names - TEST_LIST=$(poetry run pytest "${PYTEST_ARGS[@]}" 2>/dev/null | grep -E "^tests/llm/" || echo "") - TEST_COUNT=$(echo "$TEST_LIST" | grep -c "^tests/llm/" || echo "0") + TEST_LIST=$(poetry run pytest "${PYTEST_ARGS[@]}" 2>/dev/null | grep -E "^tests/llm/" || true) + TEST_COUNT=$(echo "$TEST_LIST" | grep -c "^tests/llm/" || true) # Output for next step echo "test_count=$TEST_COUNT" >> $GITHUB_OUTPUT From b41b283df8d5358309cbb531974dc72d08b1f0db Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 13:57:23 +0000 Subject: [PATCH 08/18] Add trigger context for automatic eval runs - For PR triggers: show "PR #123 (abc1234)" - For push triggers: show "push to branch-name (abc1234)" - Include trigger info in both initial and updated comments Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 5e3799c819..71a1e0db84 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -151,9 +151,19 @@ jobs: filter = ''; iterations = '1'; isManual = false; - triggerSource = 'automatic'; prNumber = event === 'pull_request' ? context.payload.pull_request.number : null; triggeredBy = ''; + // Build descriptive trigger source for automatic runs + if (event === 'pull_request') { + const sha = context.payload.pull_request.head.sha.substring(0, 7); + triggerSource = `PR #${prNumber} (${sha})`; + } else if (event === 'push') { + const sha = context.sha.substring(0, 7); + const branch = context.ref.replace('refs/heads/', ''); + triggerSource = `push to ${branch} (${sha})`; + } else { + triggerSource = 'automatic'; + } } // Apply defaults @@ -212,7 +222,9 @@ jobs: `| **Iterations** | ${p.iterations} |\n` + `| **Status** | โณ Running... |\n` + `| **Workflow** | [View logs](${p.runUrl}) |\n` - : `## โณ HolmesGPT evals running...\n\n[View workflow logs](${p.runUrl})\n`; + : `## โณ HolmesGPT evals running...\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + + `[View workflow logs](${p.runUrl})\n`; const comment = await github.rest.issues.createComment({ owner: context.repo.owner, @@ -288,6 +300,7 @@ jobs: `| **Status** | โณ Running... |\n` + `| **Workflow** | [View logs](${p.runUrl}) |\n` : `## โณ HolmesGPT evals running...\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + `**Tests to run:** ${p.testCount}\n\n` + `[View workflow logs](${p.runUrl})\n`; From 2e9f10d60d94e462fc499f3e31ce0714d09abd57 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 14:03:13 +0000 Subject: [PATCH 09/18] Add progress checklist to eval workflow - Add progress checklist showing completion status of each step - Update comment after each major step (HolmesGPT setup, collect evals, KIND ready) - Reorder steps: HolmesGPT env -> Collect evals -> KIND cluster for optimization - Show completed checklist in final results comment Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 174 ++++++++++++++++++++++--- 1 file changed, 156 insertions(+), 18 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 71a1e0db84..c5c72c05c1 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -212,6 +212,18 @@ jobs: prNumber: parseInt(${{ toJSON(steps.eval-params.outputs.pr_number) }}, 10) }; + // Progress checklist helper + const progress = (steps) => steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); + + const progressSteps = [ + [false, 'Setup HolmesGPT environment'], + [false, 'Collect evals to run'], + [false, 'Setup KIND cluster'], + [false, 'Run evals'] + ]; + let body = p.isManual ? `## ๐Ÿš€ Manual Eval Running...\n\n` + `| Parameter | Value |\n|-----------|-------|\n` + @@ -220,11 +232,12 @@ jobs: `| **Markers** | \`${p.markers}\` |\n` + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + `| **Iterations** | ${p.iterations} |\n` + - `| **Status** | โณ Running... |\n` + - `| **Workflow** | [View logs](${p.runUrl}) |\n` + `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + + `**Progress:**\n${progress(progressSteps)}\n` : `## โณ HolmesGPT evals running...\n\n` + `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n`; + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progress(progressSteps)}\n`; const comment = await github.rest.issues.createComment({ owner: context.repo.owner, @@ -234,13 +247,7 @@ jobs: }); core.setOutput('comment_id', comment.data.id.toString()); - - name: Setup KIND cluster - if: steps.check-tests.outputs.should-run == 'true' - uses: ./.github/actions/setup-kind-cluster - with: - cluster-name: 'kind' - wait-for-ready: 'true' - + # Reordered: Setup HolmesGPT first (needed for pytest), then collect evals, then KIND - name: Setup HolmesGPT environment if: steps.check-tests.outputs.should-run == 'true' uses: ./.github/actions/setup-holmes-env @@ -248,6 +255,55 @@ jobs: python-version: '3.12' install-kubectl: 'true' + - name: Update progress - HolmesGPT setup done + if: steps.check-tests.outputs.should-run == 'true' && steps.eval-params.outputs.pr_number != '' && steps.initial-comment.outputs.comment_id != '' + uses: actions/github-script@v7 + with: + script: | + const p = { + isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', + trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, + model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', + markers: ${{ toJSON(steps.eval-params.outputs.markers) }} || 'all LLM tests', + filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, + iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, + runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + commentId: parseInt(${{ toJSON(steps.initial-comment.outputs.comment_id) }}, 10) + }; + + const progress = (steps) => steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); + + const progressSteps = [ + [true, 'Setup HolmesGPT environment'], + [false, 'Collect evals to run โณ'], + [false, 'Setup KIND cluster'], + [false, 'Run evals'] + ]; + + let body = p.isManual + ? `## ๐Ÿš€ Manual Eval Running...\n\n` + + `| Parameter | Value |\n|-----------|-------|\n` + + `| **Triggered via** | ${p.trigger} |\n` + + `| **Model** | \`${p.model}\` |\n` + + `| **Markers** | \`${p.markers}\` |\n` + + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + + `| **Iterations** | ${p.iterations} |\n` + + `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + + `**Progress:**\n${progress(progressSteps)}\n` + : `## โณ HolmesGPT evals running...\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progress(progressSteps)}\n`; + + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: p.commentId, + body + }); + - name: Collect evals to run if: steps.check-tests.outputs.should-run == 'true' && steps.eval-params.outputs.pr_number != '' id: test-preview @@ -270,7 +326,7 @@ jobs: echo "$TEST_LIST" >> $GITHUB_OUTPUT echo "$EOF" >> $GITHUB_OUTPUT - - name: Update comment with evals list + - name: Update progress - evals collected if: steps.check-tests.outputs.should-run == 'true' && steps.eval-params.outputs.pr_number != '' && steps.initial-comment.outputs.comment_id != '' uses: actions/github-script@v7 with: @@ -288,6 +344,17 @@ jobs: testPreview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} || '' }; + const progress = (steps) => steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); + + const progressSteps = [ + [true, 'Setup HolmesGPT environment'], + [true, `Collect evals to run (${p.testCount} tests)`], + [false, 'Setup KIND cluster โณ'], + [false, 'Run evals'] + ]; + let body = p.isManual ? `## ๐Ÿš€ Manual Eval Running...\n\n` + `| Parameter | Value |\n|-----------|-------|\n` + @@ -296,13 +363,74 @@ jobs: `| **Markers** | \`${p.markers}\` |\n` + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + `| **Iterations** | ${p.iterations} |\n` + - `| **Tests to run** | ${p.testCount} |\n` + - `| **Status** | โณ Running... |\n` + - `| **Workflow** | [View logs](${p.runUrl}) |\n` + `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + + `**Progress:**\n${progress(progressSteps)}\n` : `## โณ HolmesGPT evals running...\n\n` + `Automatically triggered by ${p.trigger}\n\n` + - `**Tests to run:** ${p.testCount}\n\n` + - `[View workflow logs](${p.runUrl})\n`; + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progress(progressSteps)}\n`; + + if (p.testPreview && p.testCount !== '0') { + body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${p.testPreview}\n\`\`\`\n
\n`; + } + + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: p.commentId, + body + }); + + - name: Setup KIND cluster + if: steps.check-tests.outputs.should-run == 'true' + uses: ./.github/actions/setup-kind-cluster + with: + cluster-name: 'kind' + wait-for-ready: 'true' + + - name: Update progress - KIND ready, starting evals + if: steps.check-tests.outputs.should-run == 'true' && steps.eval-params.outputs.pr_number != '' && steps.initial-comment.outputs.comment_id != '' + uses: actions/github-script@v7 + with: + script: | + const p = { + isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', + trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, + model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', + markers: ${{ toJSON(steps.eval-params.outputs.markers) }} || 'all LLM tests', + filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, + iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, + runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + commentId: parseInt(${{ toJSON(steps.initial-comment.outputs.comment_id) }}, 10), + testCount: ${{ toJSON(steps.test-preview.outputs.test_count) }} || '0', + testPreview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} || '' + }; + + const progress = (steps) => steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); + + const progressSteps = [ + [true, 'Setup HolmesGPT environment'], + [true, `Collect evals to run (${p.testCount} tests)`], + [true, 'Setup KIND cluster'], + [false, 'Run evals โณ'] + ]; + + let body = p.isManual + ? `## ๐Ÿš€ Manual Eval Running...\n\n` + + `| Parameter | Value |\n|-----------|-------|\n` + + `| **Triggered via** | ${p.trigger} |\n` + + `| **Model** | \`${p.model}\` |\n` + + `| **Markers** | \`${p.markers}\` |\n` + + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + + `| **Iterations** | ${p.iterations} |\n` + + `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + + `**Progress:**\n${progress(progressSteps)}\n` + : `## โณ HolmesGPT evals running...\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progress(progressSteps)}\n`; if (p.testPreview && p.testCount !== '0') { body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${p.testPreview}\n\`\`\`\n
\n`; @@ -376,6 +504,14 @@ jobs: const report = fs.existsSync('evals_report.md') ? fs.readFileSync('evals_report.md', 'utf8') : ''; const regressions = fs.existsSync('regressions.txt') ? fs.readFileSync('regressions.txt', 'utf8').trim() : ''; + // Completed progress checklist + const completedProgress = [ + '- [x] Setup HolmesGPT environment', + '- [x] Collect evals to run', + '- [x] Setup KIND cluster', + '- [x] Run evals โœ…' + ].join('\n'); + let body = p.isManual ? `## ๐Ÿงช Manual Eval Results\n\n` + `| Parameter | Value |\n|-----------|-------|\n` + @@ -385,8 +521,10 @@ jobs: (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + `| **Iterations** | ${p.iterations} |\n` + `| **Duration** | ${p.duration} |\n` + - `| **Workflow** | [View logs](${p.runUrl}) |\n\n` - : `## Results of HolmesGPT evals\n\n**Duration:** ${p.duration} | [View workflow logs](${p.runUrl})\n\n`; + `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + + `**Progress:**\n${completedProgress}\n\n` + : `## Results of HolmesGPT evals\n\n**Duration:** ${p.duration} | [View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${completedProgress}\n\n`; body += report || 'โš ๏ธ No eval report was generated.\n\n'; if (regressions) body += `\n### โš ๏ธ ${regressions} Regression${regressions === '1' ? '' : 's'} Detected\n\n`; From 8bcefd7e33915dfada5010d36093bda138612d12 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 14:11:16 +0000 Subject: [PATCH 10/18] Fix empty MODEL causing 0 tests to be collected When no model is specified in /eval comment, MODEL env var was set to empty string instead of being unset. This caused get_models() to return an empty list (since it only uses DEFAULT_MODEL when MODEL is unset, not when it's empty string), resulting in 0 tests being collected. Fix: Unset MODEL in bash if it's empty so Python uses DEFAULT_MODEL. Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index c5c72c05c1..7884eb9e99 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -309,9 +309,13 @@ jobs: id: test-preview shell: bash env: + MODEL: ${{ steps.eval-params.outputs.model }} EVAL_MARKER_EXPR: ${{ steps.eval-params.outputs.marker_expr }} EVAL_FILTER: ${{ steps.eval-params.outputs.filter }} run: | + # Unset MODEL if empty so get_models() uses DEFAULT_MODEL + [[ -z "$MODEL" ]] && unset MODEL + PYTEST_ARGS=(--collect-only -q tests/llm/test_ask_holmes.py tests/llm/test_investigate.py -m "$EVAL_MARKER_EXPR") [[ -n "$EVAL_FILTER" ]] && PYTEST_ARGS+=(-k "$EVAL_FILTER") @@ -467,6 +471,9 @@ jobs: EVAL_MARKER_EXPR: ${{ steps.eval-params.outputs.marker_expr }} EVAL_FILTER: ${{ steps.eval-params.outputs.filter }} run: | + # Unset MODEL if empty so get_models() uses DEFAULT_MODEL + [[ -z "$MODEL" ]] && unset MODEL + START_TIME=$(date +%s) PYTEST_ARGS=(--no-cov tests/llm/test_ask_holmes.py tests/llm/test_investigate.py -s -n10 -m "$EVAL_MARKER_EXPR") From 9ea15017ab3c75eea9ec6375be0f09c827e2b69c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 14:17:14 +0000 Subject: [PATCH 11/18] Dynamically collect markers and eval names instead of hardcoding Replace hardcoded lists of valid markers and eval names with dynamic collection at runtime: - Markers: extracted from pyproject.toml [tool.pytest.ini_options] section - Eval names: listed from tests/llm/fixtures/test_ask_holmes/ and test_investigate/ This ensures the comment always shows the current list of available markers and tests without manual updates when new tests are added. Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 250 ++++--------------------- 1 file changed, 36 insertions(+), 214 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 7884eb9e99..db390b3479 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -323,13 +323,37 @@ jobs: TEST_LIST=$(poetry run pytest "${PYTEST_ARGS[@]}" 2>/dev/null | grep -E "^tests/llm/" || true) TEST_COUNT=$(echo "$TEST_LIST" | grep -c "^tests/llm/" || true) - # Output for next step + # Collect valid markers from pyproject.toml (excluding 'llm' which is internal) + # Uses sed to extract just the markers section, then grep to find marker definitions + VALID_MARKERS=$(sed -n '/^\[tool\.pytest\.ini_options\]/,/^\[/p' pyproject.toml | grep -E '"[a-zA-Z]' | sed 's/.*"\([^:]*\):.*/\1/' | grep -v '^llm$' | sort | awk '{print "- \x60" $0 "\x60"}') + + # Collect valid eval names from fixture directories + ASK_HOLMES_EVALS=$(ls -1 tests/llm/fixtures/test_ask_holmes/ 2>/dev/null | grep -v '^\.' | sort | awk '{print "- \x60" $0 "\x60"}') + INVESTIGATE_EVALS=$(ls -1 tests/llm/fixtures/test_investigate/ 2>/dev/null | grep -v '^\.' | sort | awk '{print "- \x60" $0 "\x60"}') + + # Output for next steps echo "test_count=$TEST_COUNT" >> $GITHUB_OUTPUT + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) echo "test_preview<<$EOF" >> $GITHUB_OUTPUT echo "$TEST_LIST" >> $GITHUB_OUTPUT echo "$EOF" >> $GITHUB_OUTPUT + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "valid_markers<<$EOF" >> $GITHUB_OUTPUT + echo "$VALID_MARKERS" >> $GITHUB_OUTPUT + echo "$EOF" >> $GITHUB_OUTPUT + + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "ask_holmes_evals<<$EOF" >> $GITHUB_OUTPUT + echo "$ASK_HOLMES_EVALS" >> $GITHUB_OUTPUT + echo "$EOF" >> $GITHUB_OUTPUT + + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "investigate_evals<<$EOF" >> $GITHUB_OUTPUT + echo "$INVESTIGATE_EVALS" >> $GITHUB_OUTPUT + echo "$EOF" >> $GITHUB_OUTPUT + - name: Update progress - evals collected if: steps.check-tests.outputs.should-run == 'true' && steps.eval-params.outputs.pr_number != '' && steps.initial-comment.outputs.comment_id != '' uses: actions/github-script@v7 @@ -505,7 +529,11 @@ jobs: duration: ${{ toJSON(steps.evals.outputs.duration) }} || 'N/A', runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, prNumber: parseInt(${{ toJSON(steps.eval-params.outputs.pr_number) }}, 10), - commentId: ${{ toJSON(steps.initial-comment.outputs.comment_id) }} + commentId: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, + // Dynamic lists collected from the codebase + validMarkers: ${{ toJSON(steps.test-preview.outputs.valid_markers) }} || '', + askHolmesEvals: ${{ toJSON(steps.test-preview.outputs.ask_holmes_evals) }} || '', + investigateEvals: ${{ toJSON(steps.test-preview.outputs.investigate_evals) }} || '' }; const report = fs.existsSync('evals_report.md') ? fs.readFileSync('evals_report.md', 'utf8') : ''; @@ -552,220 +580,14 @@ jobs: '| `iterations` | Number of runs, max 10 |\n\n' + `**Option 2: [Trigger via GitHub Actions UI](${workflowUrl})** โ†’ "Run workflow"\n
\n` + '\n
\n๐Ÿท๏ธ Valid markers\n\n' + - '- `regression`\n' + - '- `easy`\n' + - '- `medium`\n' + - '- `hard`\n' + - '- `logs`\n' + - '- `metrics`\n' + - '- `kubernetes`\n' + - '- `prometheus`\n' + - '- `loki`\n' + - '- `grafana-dashboard`\n' + - '- `traces`\n' + - '- `datadog`\n' + - '- `newrelic`\n' + - '- `coralogix`\n' + - '- `runbooks`\n' + - '- `transparency`\n' + - '- `question-answer`\n' + - '- `counting`\n' + - '- `database`\n' + - '- `storage`\n' + - '- `kafka`\n' + - '- `chain-of-causation`\n' + - '- `compaction`\n' + - '- `network`\n' + - '- `port-forward`\n' + - '
\n' + + (p.validMarkers || '_(No markers found)_') + + '\n\n' + '\n
\n๐Ÿ“‹ Valid eval names (use with filter)\n\n' + '**test_ask_holmes:**\n' + - '- `01_how_many_pods`\n' + - '- `02_what_is_wrong_with_pod`\n' + - '- `03_what_is_the_command_to_port_forward`\n' + - '- `04_related_k8s_events`\n' + - '- `05_image_version`\n' + - '- `06_explain_issue`\n' + - '- `07_high_latency`\n' + - '- `08_sock_shop_frontend`\n' + - '- `09_crashpod`\n' + - '- `10_image_pull_backoff`\n' + - '- `11_init_containers`\n' + - '- `12_job_crashing`\n' + - '- `13a_pending_node_selector_basic`\n' + - '- `13b_pending_node_selector_detailed`\n' + - '- `14_pending_resources`\n' + - '- `15_failed_readiness_probe`\n' + - '- `16_failed_no_toolset_found`\n' + - '- `17_oom_kill`\n' + - '- `18_oom_kill_from_issues_history`\n' + - '- `19_detect_missing_app_details`\n' + - '- `20_long_log_file_search`\n' + - '- `21_job_fail_curl_no_svc_account`\n' + - '- `22_high_latency_dbi_down`\n' + - '- `23_app_error_in_current_logs`\n' + - '- `24_misconfigured_pvc`\n' + - '- `25_misconfigured_ingress_class`\n' + - '- `26_page_render_times`\n' + - '- `27a_multi_container_logs`\n' + - '- `27b_multi_container_logs`\n' + - '- `28_permissions_error`\n' + - '- `30_basic_promql_graph_cluster_memory`\n' + - '- `32_basic_promql_graph_pod_cpu`\n' + - '- `33_cpu_metrics_discovery`\n' + - '- `34_memory_graph`\n' + - '- `35_tempo`\n' + - '- `36_argocd_find_resource`\n' + - '- `37_argocd_wrong_namespace`\n' + - '- `38_rabbitmq_split_head`\n' + - '- `39_failed_toolset`\n' + - '- `41_setup_argo`\n' + - '- `42_dns_issues_result_all_tools`\n' + - '- `42_dns_issues_result_new_tools`\n' + - '- `42_dns_issues_result_new_tools_no_runbook`\n' + - '- `42_dns_issues_result_old_tools`\n' + - '- `42_dns_issues_steps_new_all_tools`\n' + - '- `42_dns_issues_steps_new_tools`\n' + - '- `42_dns_issues_steps_old_tools`\n' + - '- `43_current_datetime_from_prompt`\n' + - '- `43_slack_deployment_logs`\n' + - '- `44_slack_statefulset_logs`\n' + - '- `45_fetch_deployment_logs_simple`\n' + - '- `46_job_crashing_no_longer_exists`\n' + - '- `47_truncated_logs_context_window`\n' + - '- `48_logs_since_thursday`\n' + - '- `49_logs_since_last_week`\n' + - '- `50_logs_since_specific_date`\n' + - '- `50a_logs_since_last_specific_month`\n' + - '- `51_logs_summarize_errors`\n' + - '- `52_logs_login_issues`\n' + - '- `53_logs_find_term`\n' + - '- `54_azure_sql`\n' + - '- `54_not_truncated_when_getting_pods`\n' + - '- `55_kafka_runbook`\n' + - '- `57_cluster_name_confusion`\n' + - '- `57_wrong_namespace`\n' + - '- `58_counting_pods_by_status`\n' + - '- `59_label_based_counting`\n' + - '- `60_count_less_than`\n' + - '- `61_exact_match_counting`\n' + - '- `62_fetch_error_logs_with_errors`\n' + - '- `63_fetch_error_logs_no_errors`\n' + - '- `64_keda_vs_hpa_confusion`\n' + - '- `65_health_check_followup`\n' + - '- `66_http_error_needle`\n' + - '- `67_performance_degradation`\n' + - '- `68_cascading_failures`\n' + - '- `69_rate_limit_exhaustion`\n' + - '- `70_memory_leak_detection`\n' + - '- `71_connection_pool_starvation`\n' + - '- `73a_time_window_anomaly`\n' + - '- `73b_time_window_anomaly`\n' + - '- `74_config_change_impact`\n' + - '- `75_network_flapping`\n' + - '- `76_service_discovery_issue`\n' + - '- `77_liveness_probe_misconfiguration`\n' + - '- `78a_missing_cpu_limits`\n' + - '- `78b_cpu_quota_exceeded`\n' + - '- `79_configmap_mount_issue`\n' + - '- `80_pvc_storage_class_mismatch`\n' + - '- `81_service_account_permission_denied`\n' + - '- `82_pod_anti_affinity_conflict`\n' + - '- `83_secret_not_found`\n' + - '- `84_network_policy_blocking_traffic`\n' + - '- `85_hpa_not_scaling`\n' + - '- `86_configmap_like_but_secret`\n' + - '- `89_runbook_missing_cloudwatch`\n' + - '- `90_runbook_basic_selection`\n' + - '- `91a_datadog_metrics_missing_namespace`\n' + - '- `91b_datadog_metrics_pod_exists`\n' + - '- `91c_datadog_metrics_deployment`\n' + - '- `91d_datadog_metrics_historical_pod`\n' + - '- `91e_datadog_custom_metrics`\n' + - '- `91f_datadog_logs_historical_pod`\n' + - '- `91g_datadog_metrics_mismatched_pod`\n' + - '- `91h_datadog_logs_empty_query_with_url`\n' + - '- `91i_datadog_metrics_empty_query_with_url`\n' + - '- `92_cpu_graph_conversation`\n' + - '- `93_calling_datadog`\n' + - '- `93_events_since_specific_date`\n' + - '- `94_runbook_transparency`\n' + - '- `95_runbook_memory_leak_detection`\n' + - '- `96_no_matching_runbook`\n' + - '- `97_logs_clarification_needed`\n' + - '- `99_logs_transparency_custom_time`\n' + - '- `100a_loki_historical_logs`\n' + - '- `100b_loki_historical_logs_nonstandard_label`\n' + - '- `101_loki_historical_logs_pod_deleted`\n' + - '- `102_loki_label_discovery`\n' + - '- `102a_loki_logs_transparency`\n' + - '- `102b_loki_multiple_pods`\n' + - '- `103_logs_transparency_default_limit`\n' + - '- `104a_postgres_root_issue`\n' + - '- `104b_postgres_missing_index_pgstat`\n' + - '- `104c_postgres_minimal_missing_index`\n' + - '- `105_redis_wrong_data_structure`\n' + - '- `107_log_filter_http_status_code`\n' + - '- `108_logs_nearby_lines`\n' + - '- `109_logs_transparency_not_found`\n' + - '- `110_cpu_graph_robusta_runner`\n' + - '- `110_k8s_events_image_pull`\n' + - '- `111_disabled_datadog_traces`\n' + - '- `111_pod_names_contain_service`\n' + - '- `111_tool_hallucination`\n' + - '- `112_find_pvcs_by_uuid`\n' + - '- `114_checkout_latency_tracing_rebuild`\n' + - '- `115_checkout_errors_tracing`\n' + - '- `117_new_relic_tracing`\n' + - '- `117b_new_relic_block_embed`\n' + - '- `118_new_relic_logs`\n' + - '- `119_new_relic_metrics`\n' + - '- `120_new_relic_traces2`\n' + - '- `121_new_relic_checkout_errors_tracing`\n' + - '- `122_new_relic_checkout_latency_tracing_rebuild`\n' + - '- `123_new_relic_checkout_errors_tracing`\n' + - '- `124_checkout_latency_prometheus`\n' + - '- `151_disabled_toolsets_fallback_only`\n' + - '- `156_kafka_opensearch_latency`\n' + - '- `157_disk_full_statefulset`\n' + - '- `158_slack_chat_correct_date`\n' + - '- `159_prometheus_high_cardinality_cpu`\n' + - '- `160_electricity_market_bidding_bug`\n' + - '- `160a_cpu_per_namespace_graph`\n' + - '- `160b_cpu_per_namespace_graph_with_prom_truncation`\n' + - '- `160c_cpu_per_namespace_graph_with_global_truncation`\n' + - '- `161_bidding_version_performance`\n' + - '- `161_conversation_compaction`\n' + - '- `162_get_runbooks`\n' + - '- `163_compaction_follow_up`\n' + - '- `164_datadog_traces_coupon_code`\n' + - '- `165_alert_with_multiple_runbooks`\n' + - '- `173_coralogix_logs`\n' + - '- `174_coralogix_traces_ad`\n' + - '- `175_coralogix_metrics_frontend`\n' + - '- `176_network_policy_blocking_traffic_no_runbooks`\n' + - '- `177_grafana_home_dashboard`\n' + - '- `178_grafana_search_dashboard_query`\n' + - '- `179_grafana_big_dashboard_query`\n\n' + - '**test_investigate:**\n' + - '- `01_oom_kill`\n' + - '- `02_crashloop_backoff`\n' + - '- `03_cpu_throttling`\n' + - '- `04_image_pull_backoff`\n' + - '- `05_crashpod`\n' + - '- `06_job_failure`\n' + - '- `07_job_syntax_error`\n' + - '- `08_memory_pressure`\n' + - '- `09_high_latency`\n' + - '- `10_KubeDeploymentReplicasMismatch`\n' + - '- `11_KubePodCrashLooping`\n' + - '- `12_KubePodNotReady`\n' + - '- `13_Watchdog`\n' + - '- `14_tempo`\n' + - '- `15_dns_resolution`\n' + - '- `16_dns_resolution_no_tool`\n' + - '- `17_investigate_correct_date`\n' + - '
\n'; + (p.askHolmesEvals || '_(No evals found)_') + + '\n\n**test_investigate:**\n' + + (p.investigateEvals || '_(No evals found)_') + + '\n\n'; } if (p.commentId) { From efee49abc64d47c67437f49661fc86da5fff29d5 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 14:41:18 +0000 Subject: [PATCH 12/18] Unify comment generation with shared helper functions Refactor the 5 comment-generating steps to use consistent helper functions: - renderProgress(): Progress checklist renderer - renderParamsTable(): Parameters table for manual runs - buildBody(): Main comment body builder with icon/title customization - buildRerunFooter(): Re-run instructions for automatic runs (results only) This ensures consistent styling between manual and automatic eval runs, and between initial/progress/results comments. The helpers are defined inline in each step (GitHub Actions limitation) but follow the same pattern. Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 342 +++++++++++++++---------- 1 file changed, 206 insertions(+), 136 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index db390b3479..2ad86d0ef1 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -201,6 +201,45 @@ jobs: uses: actions/github-script@v7 with: script: | + // ========== SHARED HELPER FUNCTIONS ========== + // These are defined once and reused via copy in subsequent steps + + // Progress checklist renderer + const renderProgress = (steps) => steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); + + // Parameters table for manual runs + const renderParamsTable = (p) => + `| Parameter | Value |\n|-----------|-------|\n` + + `| **Triggered via** | ${p.trigger} |\n` + + `| **Model** | \`${p.model}\` |\n` + + `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + + `| **Iterations** | ${p.iterations} |\n` + + (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + + `| **Workflow** | [View logs](${p.runUrl}) |\n`; + + // Build comment body based on state + const buildBody = (p, progressSteps, extras = {}) => { + const progressText = renderProgress(progressSteps); + + let body = p.isManual + ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + + renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` + : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progressText}\n`; + + if (extras.testPreview) { + body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; + } + + return body; + }; + // ========== END SHARED HELPERS ========== + const p = { isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, @@ -212,11 +251,6 @@ jobs: prNumber: parseInt(${{ toJSON(steps.eval-params.outputs.pr_number) }}, 10) }; - // Progress checklist helper - const progress = (steps) => steps.map(([done, text]) => - done ? `- [x] ${text}` : `- [ ] ${text}` - ).join('\n'); - const progressSteps = [ [false, 'Setup HolmesGPT environment'], [false, 'Collect evals to run'], @@ -224,20 +258,7 @@ jobs: [false, 'Run evals'] ]; - let body = p.isManual - ? `## ๐Ÿš€ Manual Eval Running...\n\n` + - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + - `**Progress:**\n${progress(progressSteps)}\n` - : `## โณ HolmesGPT evals running...\n\n` + - `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progress(progressSteps)}\n`; + const body = buildBody(p, progressSteps); const comment = await github.rest.issues.createComment({ owner: context.repo.owner, @@ -260,21 +281,47 @@ jobs: uses: actions/github-script@v7 with: script: | + // Shared helpers (same as initial-comment step) + const renderProgress = (steps) => steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); + + const renderParamsTable = (p) => + `| Parameter | Value |\n|-----------|-------|\n` + + `| **Triggered via** | ${p.trigger} |\n` + + `| **Model** | \`${p.model}\` |\n` + + `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + + `| **Iterations** | ${p.iterations} |\n` + + (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + + `| **Workflow** | [View logs](${p.runUrl}) |\n`; + + const buildBody = (p, progressSteps, extras = {}) => { + const progressText = renderProgress(progressSteps); + let body = p.isManual + ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + + renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` + : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progressText}\n`; + if (extras.testPreview) { + body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; + } + return body; + }; + const p = { isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', - markers: ${{ toJSON(steps.eval-params.outputs.markers) }} || 'all LLM tests', + markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, commentId: parseInt(${{ toJSON(steps.initial-comment.outputs.comment_id) }}, 10) }; - const progress = (steps) => steps.map(([done, text]) => - done ? `- [x] ${text}` : `- [ ] ${text}` - ).join('\n'); - const progressSteps = [ [true, 'Setup HolmesGPT environment'], [false, 'Collect evals to run โณ'], @@ -282,26 +329,11 @@ jobs: [false, 'Run evals'] ]; - let body = p.isManual - ? `## ๐Ÿš€ Manual Eval Running...\n\n` + - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + - `**Progress:**\n${progress(progressSteps)}\n` - : `## โณ HolmesGPT evals running...\n\n` + - `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progress(progressSteps)}\n`; - await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: p.commentId, - body + body: buildBody(p, progressSteps) }); - name: Collect evals to run @@ -359,11 +391,41 @@ jobs: uses: actions/github-script@v7 with: script: | + // Shared helpers (same as initial-comment step) + const renderProgress = (steps) => steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); + + const renderParamsTable = (p) => + `| Parameter | Value |\n|-----------|-------|\n` + + `| **Triggered via** | ${p.trigger} |\n` + + `| **Model** | \`${p.model}\` |\n` + + `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + + `| **Iterations** | ${p.iterations} |\n` + + (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + + `| **Workflow** | [View logs](${p.runUrl}) |\n`; + + const buildBody = (p, progressSteps, extras = {}) => { + const progressText = renderProgress(progressSteps); + let body = p.isManual + ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + + renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` + : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progressText}\n`; + if (extras.testPreview) { + body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; + } + return body; + }; + const p = { isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', - markers: ${{ toJSON(steps.eval-params.outputs.markers) }} || 'all LLM tests', + markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, @@ -372,10 +434,6 @@ jobs: testPreview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} || '' }; - const progress = (steps) => steps.map(([done, text]) => - done ? `- [x] ${text}` : `- [ ] ${text}` - ).join('\n'); - const progressSteps = [ [true, 'Setup HolmesGPT environment'], [true, `Collect evals to run (${p.testCount} tests)`], @@ -383,30 +441,11 @@ jobs: [false, 'Run evals'] ]; - let body = p.isManual - ? `## ๐Ÿš€ Manual Eval Running...\n\n` + - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + - `**Progress:**\n${progress(progressSteps)}\n` - : `## โณ HolmesGPT evals running...\n\n` + - `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progress(progressSteps)}\n`; - - if (p.testPreview && p.testCount !== '0') { - body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${p.testPreview}\n\`\`\`\n
\n`; - } - await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: p.commentId, - body + body: buildBody(p, progressSteps, { testPreview: p.testCount !== '0' ? p.testPreview : null }) }); - name: Setup KIND cluster @@ -421,11 +460,41 @@ jobs: uses: actions/github-script@v7 with: script: | + // Shared helpers (same as initial-comment step) + const renderProgress = (steps) => steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); + + const renderParamsTable = (p) => + `| Parameter | Value |\n|-----------|-------|\n` + + `| **Triggered via** | ${p.trigger} |\n` + + `| **Model** | \`${p.model}\` |\n` + + `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + + `| **Iterations** | ${p.iterations} |\n` + + (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + + `| **Workflow** | [View logs](${p.runUrl}) |\n`; + + const buildBody = (p, progressSteps, extras = {}) => { + const progressText = renderProgress(progressSteps); + let body = p.isManual + ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + + renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` + : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progressText}\n`; + if (extras.testPreview) { + body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; + } + return body; + }; + const p = { isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', - markers: ${{ toJSON(steps.eval-params.outputs.markers) }} || 'all LLM tests', + markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, @@ -434,10 +503,6 @@ jobs: testPreview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} || '' }; - const progress = (steps) => steps.map(([done, text]) => - done ? `- [x] ${text}` : `- [ ] ${text}` - ).join('\n'); - const progressSteps = [ [true, 'Setup HolmesGPT environment'], [true, `Collect evals to run (${p.testCount} tests)`], @@ -445,30 +510,11 @@ jobs: [false, 'Run evals โณ'] ]; - let body = p.isManual - ? `## ๐Ÿš€ Manual Eval Running...\n\n` + - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + - `**Progress:**\n${progress(progressSteps)}\n` - : `## โณ HolmesGPT evals running...\n\n` + - `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progress(progressSteps)}\n`; - - if (p.testPreview && p.testCount !== '0') { - body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${p.testPreview}\n\`\`\`\n
\n`; - } - await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: p.commentId, - body + body: buildBody(p, progressSteps, { testPreview: p.testCount !== '0' ? p.testPreview : null }) }); - name: Run tests @@ -519,54 +565,41 @@ jobs: with: script: | const fs = require('fs'); - const p = { - isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', - trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', - markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, - filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, - iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - duration: ${{ toJSON(steps.evals.outputs.duration) }} || 'N/A', - runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, - prNumber: parseInt(${{ toJSON(steps.eval-params.outputs.pr_number) }}, 10), - commentId: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, - // Dynamic lists collected from the codebase - validMarkers: ${{ toJSON(steps.test-preview.outputs.valid_markers) }} || '', - askHolmesEvals: ${{ toJSON(steps.test-preview.outputs.ask_holmes_evals) }} || '', - investigateEvals: ${{ toJSON(steps.test-preview.outputs.investigate_evals) }} || '' - }; - const report = fs.existsSync('evals_report.md') ? fs.readFileSync('evals_report.md', 'utf8') : ''; - const regressions = fs.existsSync('regressions.txt') ? fs.readFileSync('regressions.txt', 'utf8').trim() : ''; + // Shared helpers (same as initial-comment step) + const renderProgress = (steps) => steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); - // Completed progress checklist - const completedProgress = [ - '- [x] Setup HolmesGPT environment', - '- [x] Collect evals to run', - '- [x] Setup KIND cluster', - '- [x] Run evals โœ…' - ].join('\n'); - - let body = p.isManual - ? `## ๐Ÿงช Manual Eval Results\n\n` + - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - `| **Duration** | ${p.duration} |\n` + - `| **Workflow** | [View logs](${p.runUrl}) |\n\n` + - `**Progress:**\n${completedProgress}\n\n` - : `## Results of HolmesGPT evals\n\n**Duration:** ${p.duration} | [View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${completedProgress}\n\n`; - - body += report || 'โš ๏ธ No eval report was generated.\n\n'; - if (regressions) body += `\n### โš ๏ธ ${regressions} Regression${regressions === '1' ? '' : 's'} Detected\n\n`; + const renderParamsTable = (p) => + `| Parameter | Value |\n|-----------|-------|\n` + + `| **Triggered via** | ${p.trigger} |\n` + + `| **Model** | \`${p.model}\` |\n` + + `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + + `| **Iterations** | ${p.iterations} |\n` + + (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + + `| **Workflow** | [View logs](${p.runUrl}) |\n`; + + const buildBody = (p, progressSteps, extras = {}) => { + const progressText = renderProgress(progressSteps); + let body = p.isManual + ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + + renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` + : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progressText}\n`; + if (extras.testPreview) { + body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; + } + return body; + }; - if (!p.isManual) { + // Results-specific: re-run instructions footer + const buildRerunFooter = (p) => { const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/eval-regression.yaml`; - body += '\n---\n
\n๐Ÿ”„ Re-run evals manually\n\n' + + return '\n---\n
\n๐Ÿ”„ Re-run evals manually\n\n' + '> โš ๏ธ **Warning:** Manual re-runs have NO default markers and will run ALL LLM tests (~100+), which can take 1+ hours. ' + 'Use `markers: regression` or `filter: test_name` to limit scope.\n\n' + '**Option 1: Comment on this PR** with `/eval`:\n\n' + @@ -588,6 +621,45 @@ jobs: '\n\n**test_investigate:**\n' + (p.investigateEvals || '_(No evals found)_') + '\n
\n'; + }; + + const p = { + isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', + trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, + model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', + markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, + filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, + iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, + duration: ${{ toJSON(steps.evals.outputs.duration) }} || 'N/A', + runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + prNumber: parseInt(${{ toJSON(steps.eval-params.outputs.pr_number) }}, 10), + commentId: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, + validMarkers: ${{ toJSON(steps.test-preview.outputs.valid_markers) }} || '', + askHolmesEvals: ${{ toJSON(steps.test-preview.outputs.ask_holmes_evals) }} || '', + investigateEvals: ${{ toJSON(steps.test-preview.outputs.investigate_evals) }} || '' + }; + + const report = fs.existsSync('evals_report.md') ? fs.readFileSync('evals_report.md', 'utf8') : ''; + const regressions = fs.existsSync('regressions.txt') ? fs.readFileSync('regressions.txt', 'utf8').trim() : ''; + + const progressSteps = [ + [true, 'Setup HolmesGPT environment'], + [true, 'Collect evals to run'], + [true, 'Setup KIND cluster'], + [true, 'Run evals โœ…'] + ]; + + let body = buildBody(p, progressSteps, { + icon: p.isManual ? '๐Ÿงช' : 'โœ…', + title: p.isManual ? 'Manual Eval Results' : 'Results of HolmesGPT evals' + }); + + body += '\n' + (report || 'โš ๏ธ No eval report was generated.\n\n'); + if (regressions) body += `\n### โš ๏ธ ${regressions} Regression${regressions === '1' ? '' : 's'} Detected\n\n`; + + // Add re-run footer for automatic runs only + if (!p.isManual) { + body += buildRerunFooter(p); } if (p.commentId) { @@ -596,8 +668,6 @@ jobs: comment_id: parseInt(p.commentId, 10), body }); } else if (!p.isManual) { - // For automatic triggers without an initial comment (e.g., fork PRs without secrets), - // create a new comment with results. For manual triggers, initial comment always exists. await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: p.prNumber, body From 1536571a105936b2eb29285230d34e30ca0890aa Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 15:51:17 +0000 Subject: [PATCH 13/18] Extract eval comment helpers to shared JS file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create .github/scripts/eval-comment-helpers.js with reusable functions - Update all 5 workflow steps to require() the helpers instead of copy-paste - Remove redundant emoji from progress checklist items (โณ and โœ… were redundant since checkbox state already indicates completion) Signed-off-by: Claude --- .github/scripts/eval-comment-helpers.js | 95 ++++++++++++ .github/workflows/eval-regression.yaml | 197 ++---------------------- 2 files changed, 105 insertions(+), 187 deletions(-) create mode 100644 .github/scripts/eval-comment-helpers.js diff --git a/.github/scripts/eval-comment-helpers.js b/.github/scripts/eval-comment-helpers.js new file mode 100644 index 0000000000..b439104447 --- /dev/null +++ b/.github/scripts/eval-comment-helpers.js @@ -0,0 +1,95 @@ +/** + * Shared helper functions for eval workflow PR comments. + * Used by multiple steps in .github/workflows/eval-regression.yaml + */ + +/** + * Render a progress checklist + * @param {Array<[boolean, string]>} steps - Array of [completed, text] tuples + * @returns {string} Markdown checklist + */ +function renderProgress(steps) { + return steps.map(([done, text]) => + done ? `- [x] ${text}` : `- [ ] ${text}` + ).join('\n'); +} + +/** + * Render parameters table for manual runs + * @param {Object} p - Parameters object + * @returns {string} Markdown table + */ +function renderParamsTable(p) { + return `| Parameter | Value |\n|-----------|-------|\n` + + `| **Triggered via** | ${p.trigger} |\n` + + `| **Model** | \`${p.model}\` |\n` + + `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + + (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + + `| **Iterations** | ${p.iterations} |\n` + + (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + + `| **Workflow** | [View logs](${p.runUrl}) |\n`; +} + +/** + * Build comment body based on state + * @param {Object} p - Parameters object + * @param {Array<[boolean, string]>} progressSteps - Progress steps + * @param {Object} extras - Extra options (icon, title, testPreview) + * @returns {string} Markdown body + */ +function buildBody(p, progressSteps, extras = {}) { + const progressText = renderProgress(progressSteps); + + let body = p.isManual + ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + + renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` + : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + + `Automatically triggered by ${p.trigger}\n\n` + + `[View workflow logs](${p.runUrl})\n\n` + + `**Progress:**\n${progressText}\n`; + + if (extras.testPreview) { + body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; + } + + return body; +} + +/** + * Build re-run instructions footer for automatic runs + * @param {Object} p - Parameters object with validMarkers, askHolmesEvals, investigateEvals + * @param {Object} context - GitHub context object + * @returns {string} Markdown footer + */ +function buildRerunFooter(p, context) { + const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/eval-regression.yaml`; + return '\n---\n
\n๐Ÿ”„ Re-run evals manually\n\n' + + '> โš ๏ธ **Warning:** Manual re-runs have NO default markers and will run ALL LLM tests (~100+), which can take 1+ hours. ' + + 'Use `markers: regression` or `filter: test_name` to limit scope.\n\n' + + '**Option 1: Comment on this PR** with `/eval`:\n\n' + + '```\n/eval\nmarkers: regression\n```\n\n' + + 'Or with more options (one per line):\n\n' + + '```\n/eval\nmodel: gpt-4o\nmarkers: regression\nfilter: 09_crashpod\niterations: 5\n```\n\n' + + '| Option | Description |\n|--------|-------------|\n' + + '| `model` | Model(s) to test (default: same as automatic runs) |\n' + + '| `markers` | Pytest markers (**no default - runs all tests!**) |\n' + + '| `filter` | Pytest -k filter |\n' + + '| `iterations` | Number of runs, max 10 |\n\n' + + `**Option 2: [Trigger via GitHub Actions UI](${workflowUrl})** โ†’ "Run workflow"\n
\n` + + '\n
\n๐Ÿท๏ธ Valid markers\n\n' + + (p.validMarkers || '_(No markers found)_') + + '\n
\n' + + '\n
\n๐Ÿ“‹ Valid eval names (use with filter)\n\n' + + '**test_ask_holmes:**\n' + + (p.askHolmesEvals || '_(No evals found)_') + + '\n\n**test_investigate:**\n' + + (p.investigateEvals || '_(No evals found)_') + + '\n
\n'; +} + +module.exports = { + renderProgress, + renderParamsTable, + buildBody, + buildRerunFooter +}; diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 2ad86d0ef1..0937cc772d 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -201,44 +201,7 @@ jobs: uses: actions/github-script@v7 with: script: | - // ========== SHARED HELPER FUNCTIONS ========== - // These are defined once and reused via copy in subsequent steps - - // Progress checklist renderer - const renderProgress = (steps) => steps.map(([done, text]) => - done ? `- [x] ${text}` : `- [ ] ${text}` - ).join('\n'); - - // Parameters table for manual runs - const renderParamsTable = (p) => - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + - `| **Workflow** | [View logs](${p.runUrl}) |\n`; - - // Build comment body based on state - const buildBody = (p, progressSteps, extras = {}) => { - const progressText = renderProgress(progressSteps); - - let body = p.isManual - ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + - renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` - : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + - `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progressText}\n`; - - if (extras.testPreview) { - body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; - } - - return body; - }; - // ========== END SHARED HELPERS ========== + const { buildBody } = require('./.github/scripts/eval-comment-helpers.js'); const p = { isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', @@ -281,35 +244,7 @@ jobs: uses: actions/github-script@v7 with: script: | - // Shared helpers (same as initial-comment step) - const renderProgress = (steps) => steps.map(([done, text]) => - done ? `- [x] ${text}` : `- [ ] ${text}` - ).join('\n'); - - const renderParamsTable = (p) => - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + - `| **Workflow** | [View logs](${p.runUrl}) |\n`; - - const buildBody = (p, progressSteps, extras = {}) => { - const progressText = renderProgress(progressSteps); - let body = p.isManual - ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + - renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` - : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + - `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progressText}\n`; - if (extras.testPreview) { - body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; - } - return body; - }; + const { buildBody } = require('./.github/scripts/eval-comment-helpers.js'); const p = { isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', @@ -324,7 +259,7 @@ jobs: const progressSteps = [ [true, 'Setup HolmesGPT environment'], - [false, 'Collect evals to run โณ'], + [false, 'Collect evals to run'], [false, 'Setup KIND cluster'], [false, 'Run evals'] ]; @@ -391,35 +326,7 @@ jobs: uses: actions/github-script@v7 with: script: | - // Shared helpers (same as initial-comment step) - const renderProgress = (steps) => steps.map(([done, text]) => - done ? `- [x] ${text}` : `- [ ] ${text}` - ).join('\n'); - - const renderParamsTable = (p) => - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + - `| **Workflow** | [View logs](${p.runUrl}) |\n`; - - const buildBody = (p, progressSteps, extras = {}) => { - const progressText = renderProgress(progressSteps); - let body = p.isManual - ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + - renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` - : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + - `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progressText}\n`; - if (extras.testPreview) { - body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; - } - return body; - }; + const { buildBody } = require('./.github/scripts/eval-comment-helpers.js'); const p = { isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', @@ -437,7 +344,7 @@ jobs: const progressSteps = [ [true, 'Setup HolmesGPT environment'], [true, `Collect evals to run (${p.testCount} tests)`], - [false, 'Setup KIND cluster โณ'], + [false, 'Setup KIND cluster'], [false, 'Run evals'] ]; @@ -460,35 +367,7 @@ jobs: uses: actions/github-script@v7 with: script: | - // Shared helpers (same as initial-comment step) - const renderProgress = (steps) => steps.map(([done, text]) => - done ? `- [x] ${text}` : `- [ ] ${text}` - ).join('\n'); - - const renderParamsTable = (p) => - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + - `| **Workflow** | [View logs](${p.runUrl}) |\n`; - - const buildBody = (p, progressSteps, extras = {}) => { - const progressText = renderProgress(progressSteps); - let body = p.isManual - ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + - renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` - : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + - `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progressText}\n`; - if (extras.testPreview) { - body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; - } - return body; - }; + const { buildBody } = require('./.github/scripts/eval-comment-helpers.js'); const p = { isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', @@ -507,7 +386,7 @@ jobs: [true, 'Setup HolmesGPT environment'], [true, `Collect evals to run (${p.testCount} tests)`], [true, 'Setup KIND cluster'], - [false, 'Run evals โณ'] + [false, 'Run evals'] ]; await github.rest.issues.updateComment({ @@ -565,63 +444,7 @@ jobs: with: script: | const fs = require('fs'); - - // Shared helpers (same as initial-comment step) - const renderProgress = (steps) => steps.map(([done, text]) => - done ? `- [x] ${text}` : `- [ ] ${text}` - ).join('\n'); - - const renderParamsTable = (p) => - `| Parameter | Value |\n|-----------|-------|\n` + - `| **Triggered via** | ${p.trigger} |\n` + - `| **Model** | \`${p.model}\` |\n` + - `| **Markers** | \`${p.markers || 'all LLM tests'}\` |\n` + - (p.filter ? `| **Filter (-k)** | \`${p.filter}\` |\n` : '') + - `| **Iterations** | ${p.iterations} |\n` + - (p.duration ? `| **Duration** | ${p.duration} |\n` : '') + - `| **Workflow** | [View logs](${p.runUrl}) |\n`; - - const buildBody = (p, progressSteps, extras = {}) => { - const progressText = renderProgress(progressSteps); - let body = p.isManual - ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + - renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` - : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + - `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progressText}\n`; - if (extras.testPreview) { - body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; - } - return body; - }; - - // Results-specific: re-run instructions footer - const buildRerunFooter = (p) => { - const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/eval-regression.yaml`; - return '\n---\n
\n๐Ÿ”„ Re-run evals manually\n\n' + - '> โš ๏ธ **Warning:** Manual re-runs have NO default markers and will run ALL LLM tests (~100+), which can take 1+ hours. ' + - 'Use `markers: regression` or `filter: test_name` to limit scope.\n\n' + - '**Option 1: Comment on this PR** with `/eval`:\n\n' + - '```\n/eval\nmarkers: regression\n```\n\n' + - 'Or with more options (one per line):\n\n' + - '```\n/eval\nmodel: gpt-4o\nmarkers: regression\nfilter: 09_crashpod\niterations: 5\n```\n\n' + - '| Option | Description |\n|--------|-------------|\n' + - '| `model` | Model(s) to test (default: same as automatic runs) |\n' + - '| `markers` | Pytest markers (**no default - runs all tests!**) |\n' + - '| `filter` | Pytest -k filter |\n' + - '| `iterations` | Number of runs, max 10 |\n\n' + - `**Option 2: [Trigger via GitHub Actions UI](${workflowUrl})** โ†’ "Run workflow"\n
\n` + - '\n
\n๐Ÿท๏ธ Valid markers\n\n' + - (p.validMarkers || '_(No markers found)_') + - '\n
\n' + - '\n
\n๐Ÿ“‹ Valid eval names (use with filter)\n\n' + - '**test_ask_holmes:**\n' + - (p.askHolmesEvals || '_(No evals found)_') + - '\n\n**test_investigate:**\n' + - (p.investigateEvals || '_(No evals found)_') + - '\n
\n'; - }; + const { buildBody, buildRerunFooter } = require('./.github/scripts/eval-comment-helpers.js'); const p = { isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', @@ -646,7 +469,7 @@ jobs: [true, 'Setup HolmesGPT environment'], [true, 'Collect evals to run'], [true, 'Setup KIND cluster'], - [true, 'Run evals โœ…'] + [true, 'Run evals'] ]; let body = buildBody(p, progressSteps, { @@ -659,7 +482,7 @@ jobs: // Add re-run footer for automatic runs only if (!p.isManual) { - body += buildRerunFooter(p); + body += buildRerunFooter(p, context); } if (p.commentId) { From 7bc70b37678792d04cb10b8d5835d5c7853ebdc7 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 15:53:04 +0000 Subject: [PATCH 14/18] Fix trigger source text and remove eyes reaction on completion - Change PR trigger source from "PR #N (sha)" to just "commit sha" (PR number is redundant since comment is on the PR) - Remove eyes reaction when workflow completes, leaving only hooray Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 0937cc772d..03794247e3 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -156,7 +156,7 @@ jobs: // Build descriptive trigger source for automatic runs if (event === 'pull_request') { const sha = context.payload.pull_request.head.sha.substring(0, 7); - triggerSource = `PR #${prNumber} (${sha})`; + triggerSource = `commit ${sha}`; } else if (event === 'push') { const sha = context.sha.substring(0, 7); const branch = context.ref.replace('refs/heads/', ''); @@ -524,6 +524,19 @@ jobs: uses: actions/github-script@v7 with: script: | + // Remove eyes reaction (was added to indicate processing started) + const reactions = await github.rest.reactions.listForIssueComment({ + owner: context.repo.owner, repo: context.repo.repo, + comment_id: context.payload.comment.id + }); + const eyesReaction = reactions.data.find(r => r.content === 'eyes' && r.user.login === 'github-actions[bot]'); + if (eyesReaction) { + await github.rest.reactions.deleteForIssueComment({ + owner: context.repo.owner, repo: context.repo.repo, + comment_id: context.payload.comment.id, reaction_id: eyesReaction.id + }); + } + // Add hooray reaction to indicate completion await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, content: 'hooray' From ecfe41e6eff118d366b17adfaa9e0ea737273ee9 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 16:18:00 +0000 Subject: [PATCH 15/18] Unify comment generation with shared helper functions - Add buildParams() helper to centralize type conversions and defaults - Update all 5 workflow steps to use buildParams() for cleaner code - All transformations (=== 'true', || 'default', parseInt) in one place Signed-off-by: Claude --- .github/scripts/eval-comment-helpers.js | 27 ++++++ .github/workflows/eval-regression.yaml | 123 ++++++++++-------------- 2 files changed, 78 insertions(+), 72 deletions(-) diff --git a/.github/scripts/eval-comment-helpers.js b/.github/scripts/eval-comment-helpers.js index b439104447..793ce083b8 100644 --- a/.github/scripts/eval-comment-helpers.js +++ b/.github/scripts/eval-comment-helpers.js @@ -3,6 +3,32 @@ * Used by multiple steps in .github/workflows/eval-regression.yaml */ +/** + * Build params object from raw step outputs + * Handles all type conversions and defaults in one place + * @param {Object} raw - Raw outputs from GitHub Actions steps + * @returns {Object} Normalized params object + */ +function buildParams(raw) { + return { + isManual: raw.is_manual === 'true', + trigger: raw.trigger_source, + model: raw.model || 'default', + markers: raw.markers, + filter: raw.filter, + iterations: raw.iterations, + runUrl: raw.run_url, + prNumber: raw.pr_number ? parseInt(raw.pr_number, 10) : null, + commentId: raw.comment_id ? parseInt(raw.comment_id, 10) : null, + testCount: raw.test_count || '0', + testPreview: raw.test_preview || '', + duration: raw.duration || 'N/A', + validMarkers: raw.valid_markers || '', + askHolmesEvals: raw.ask_holmes_evals || '', + investigateEvals: raw.investigate_evals || '' + }; +} + /** * Render a progress checklist * @param {Array<[boolean, string]>} steps - Array of [completed, text] tuples @@ -88,6 +114,7 @@ function buildRerunFooter(p, context) { } module.exports = { + buildParams, renderProgress, renderParamsTable, buildBody, diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 03794247e3..da44b53962 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -201,33 +201,28 @@ jobs: uses: actions/github-script@v7 with: script: | - const { buildBody } = require('./.github/scripts/eval-comment-helpers.js'); - - const p = { - isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', - trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', + const { buildParams, buildBody } = require('./.github/scripts/eval-comment-helpers.js'); + const p = buildParams({ + is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, + trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, + model: ${{ toJSON(steps.eval-params.outputs.model) }}, markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, - prNumber: parseInt(${{ toJSON(steps.eval-params.outputs.pr_number) }}, 10) - }; - + run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + pr_number: ${{ toJSON(steps.eval-params.outputs.pr_number) }} + }); const progressSteps = [ [false, 'Setup HolmesGPT environment'], [false, 'Collect evals to run'], [false, 'Setup KIND cluster'], [false, 'Run evals'] ]; - - const body = buildBody(p, progressSteps); - const comment = await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: p.prNumber, - body + body: buildBody(p, progressSteps) }); core.setOutput('comment_id', comment.data.id.toString()); @@ -244,26 +239,23 @@ jobs: uses: actions/github-script@v7 with: script: | - const { buildBody } = require('./.github/scripts/eval-comment-helpers.js'); - - const p = { - isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', - trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', + const { buildParams, buildBody } = require('./.github/scripts/eval-comment-helpers.js'); + const p = buildParams({ + is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, + trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, + model: ${{ toJSON(steps.eval-params.outputs.model) }}, markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, - commentId: parseInt(${{ toJSON(steps.initial-comment.outputs.comment_id) }}, 10) - }; - + run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + comment_id: ${{ toJSON(steps.initial-comment.outputs.comment_id) }} + }); const progressSteps = [ [true, 'Setup HolmesGPT environment'], [false, 'Collect evals to run'], [false, 'Setup KIND cluster'], [false, 'Run evals'] ]; - await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, @@ -326,28 +318,25 @@ jobs: uses: actions/github-script@v7 with: script: | - const { buildBody } = require('./.github/scripts/eval-comment-helpers.js'); - - const p = { - isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', - trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', + const { buildParams, buildBody } = require('./.github/scripts/eval-comment-helpers.js'); + const p = buildParams({ + is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, + trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, + model: ${{ toJSON(steps.eval-params.outputs.model) }}, markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, - commentId: parseInt(${{ toJSON(steps.initial-comment.outputs.comment_id) }}, 10), - testCount: ${{ toJSON(steps.test-preview.outputs.test_count) }} || '0', - testPreview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} || '' - }; - + run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + comment_id: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, + test_count: ${{ toJSON(steps.test-preview.outputs.test_count) }}, + test_preview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} + }); const progressSteps = [ [true, 'Setup HolmesGPT environment'], [true, `Collect evals to run (${p.testCount} tests)`], [false, 'Setup KIND cluster'], [false, 'Run evals'] ]; - await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, @@ -367,28 +356,25 @@ jobs: uses: actions/github-script@v7 with: script: | - const { buildBody } = require('./.github/scripts/eval-comment-helpers.js'); - - const p = { - isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', - trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', + const { buildParams, buildBody } = require('./.github/scripts/eval-comment-helpers.js'); + const p = buildParams({ + is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, + trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, + model: ${{ toJSON(steps.eval-params.outputs.model) }}, markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, - commentId: parseInt(${{ toJSON(steps.initial-comment.outputs.comment_id) }}, 10), - testCount: ${{ toJSON(steps.test-preview.outputs.test_count) }} || '0', - testPreview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} || '' - }; - + run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + comment_id: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, + test_count: ${{ toJSON(steps.test-preview.outputs.test_count) }}, + test_preview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} + }); const progressSteps = [ [true, 'Setup HolmesGPT environment'], [true, `Collect evals to run (${p.testCount} tests)`], [true, 'Setup KIND cluster'], [false, 'Run evals'] ]; - await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, @@ -444,51 +430,44 @@ jobs: with: script: | const fs = require('fs'); - const { buildBody, buildRerunFooter } = require('./.github/scripts/eval-comment-helpers.js'); - - const p = { - isManual: ${{ toJSON(steps.eval-params.outputs.is_manual) }} === 'true', - trigger: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }} || 'default', + const { buildParams, buildBody, buildRerunFooter } = require('./.github/scripts/eval-comment-helpers.js'); + const p = buildParams({ + is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, + trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, + model: ${{ toJSON(steps.eval-params.outputs.model) }}, markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - duration: ${{ toJSON(steps.evals.outputs.duration) }} || 'N/A', - runUrl: ${{ toJSON(steps.eval-params.outputs.run_url) }}, - prNumber: parseInt(${{ toJSON(steps.eval-params.outputs.pr_number) }}, 10), - commentId: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, - validMarkers: ${{ toJSON(steps.test-preview.outputs.valid_markers) }} || '', - askHolmesEvals: ${{ toJSON(steps.test-preview.outputs.ask_holmes_evals) }} || '', - investigateEvals: ${{ toJSON(steps.test-preview.outputs.investigate_evals) }} || '' - }; - + run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + pr_number: ${{ toJSON(steps.eval-params.outputs.pr_number) }}, + comment_id: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, + duration: ${{ toJSON(steps.evals.outputs.duration) }}, + valid_markers: ${{ toJSON(steps.test-preview.outputs.valid_markers) }}, + ask_holmes_evals: ${{ toJSON(steps.test-preview.outputs.ask_holmes_evals) }}, + investigate_evals: ${{ toJSON(steps.test-preview.outputs.investigate_evals) }} + }); const report = fs.existsSync('evals_report.md') ? fs.readFileSync('evals_report.md', 'utf8') : ''; const regressions = fs.existsSync('regressions.txt') ? fs.readFileSync('regressions.txt', 'utf8').trim() : ''; - const progressSteps = [ [true, 'Setup HolmesGPT environment'], [true, 'Collect evals to run'], [true, 'Setup KIND cluster'], [true, 'Run evals'] ]; - let body = buildBody(p, progressSteps, { icon: p.isManual ? '๐Ÿงช' : 'โœ…', title: p.isManual ? 'Manual Eval Results' : 'Results of HolmesGPT evals' }); - body += '\n' + (report || 'โš ๏ธ No eval report was generated.\n\n'); if (regressions) body += `\n### โš ๏ธ ${regressions} Regression${regressions === '1' ? '' : 's'} Detected\n\n`; - // Add re-run footer for automatic runs only if (!p.isManual) { body += buildRerunFooter(p, context); } - if (p.commentId) { await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, - comment_id: parseInt(p.commentId, 10), body + comment_id: p.commentId, body }); } else if (!p.isManual) { await github.rest.issues.createComment({ From 452b2834f805d40440d372314bed8f90b62de73c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 16:26:09 +0000 Subject: [PATCH 16/18] DRY: Use base_params JSON to reduce repetition in workflow steps - Output base_params JSON from eval-params step containing common params - Each step now spreads base_params and only adds step-specific extras - Reduces ~7 lines of repeated parameter passing per step Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 56 ++++++++------------------ 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index da44b53962..6a22aeaf72 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -183,6 +183,18 @@ jobs: core.setOutput('marker_expr', markers ? `llm and (${markers})` : 'llm'); core.setOutput('run_url', `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`); + // Output all common params as JSON for DRY usage in subsequent steps + core.setOutput('base_params', JSON.stringify({ + is_manual: isManual.toString(), + trigger_source: triggerSource, + model, + markers, + filter, + iterations: iterNum.toString(), + run_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, + pr_number: prNumber ? prNumber.toString() : '' + })); + - name: Check if tests should run id: check-tests if: github.event_name != 'issue_comment' || steps.eval-comment.outcome == 'success' @@ -202,16 +214,7 @@ jobs: with: script: | const { buildParams, buildBody } = require('./.github/scripts/eval-comment-helpers.js'); - const p = buildParams({ - is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, - trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }}, - markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, - filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, - iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, - pr_number: ${{ toJSON(steps.eval-params.outputs.pr_number) }} - }); + const p = buildParams(JSON.parse(${{ toJSON(steps.eval-params.outputs.base_params) }})); const progressSteps = [ [false, 'Setup HolmesGPT environment'], [false, 'Collect evals to run'], @@ -241,13 +244,7 @@ jobs: script: | const { buildParams, buildBody } = require('./.github/scripts/eval-comment-helpers.js'); const p = buildParams({ - is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, - trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }}, - markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, - filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, - iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + ...JSON.parse(${{ toJSON(steps.eval-params.outputs.base_params) }}), comment_id: ${{ toJSON(steps.initial-comment.outputs.comment_id) }} }); const progressSteps = [ @@ -320,13 +317,7 @@ jobs: script: | const { buildParams, buildBody } = require('./.github/scripts/eval-comment-helpers.js'); const p = buildParams({ - is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, - trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }}, - markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, - filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, - iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + ...JSON.parse(${{ toJSON(steps.eval-params.outputs.base_params) }}), comment_id: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, test_count: ${{ toJSON(steps.test-preview.outputs.test_count) }}, test_preview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} @@ -358,13 +349,7 @@ jobs: script: | const { buildParams, buildBody } = require('./.github/scripts/eval-comment-helpers.js'); const p = buildParams({ - is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, - trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }}, - markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, - filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, - iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, + ...JSON.parse(${{ toJSON(steps.eval-params.outputs.base_params) }}), comment_id: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, test_count: ${{ toJSON(steps.test-preview.outputs.test_count) }}, test_preview: ${{ toJSON(steps.test-preview.outputs.test_preview) }} @@ -432,14 +417,7 @@ jobs: const fs = require('fs'); const { buildParams, buildBody, buildRerunFooter } = require('./.github/scripts/eval-comment-helpers.js'); const p = buildParams({ - is_manual: ${{ toJSON(steps.eval-params.outputs.is_manual) }}, - trigger_source: ${{ toJSON(steps.eval-params.outputs.trigger_source) }}, - model: ${{ toJSON(steps.eval-params.outputs.model) }}, - markers: ${{ toJSON(steps.eval-params.outputs.markers) }}, - filter: ${{ toJSON(steps.eval-params.outputs.filter) }}, - iterations: ${{ toJSON(steps.eval-params.outputs.iterations) }}, - run_url: ${{ toJSON(steps.eval-params.outputs.run_url) }}, - pr_number: ${{ toJSON(steps.eval-params.outputs.pr_number) }}, + ...JSON.parse(${{ toJSON(steps.eval-params.outputs.base_params) }}), comment_id: ${{ toJSON(steps.initial-comment.outputs.comment_id) }}, duration: ${{ toJSON(steps.evals.outputs.duration) }}, valid_markers: ${{ toJSON(steps.test-preview.outputs.valid_markers) }}, From 9b8a50110fa9e4492717392e6e5d44a2469e031a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 16:59:21 +0000 Subject: [PATCH 17/18] Auto-detect PR from branch in workflow_dispatch When triggering via GitHub Actions UI without specifying a PR number, automatically find the open PR associated with the selected branch. This makes it easier to run evals - just select the branch and go. Signed-off-by: Claude --- .github/workflows/eval-regression.yaml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index 6a22aeaf72..e8d3cac5be 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -8,7 +8,7 @@ on: workflow_dispatch: inputs: pr_number: - description: 'PR number to run evals on (leave empty for current branch)' + description: 'PR number to comment on (auto-detects from branch if empty)' required: false default: '' model: @@ -143,8 +143,30 @@ jobs: if ([model, markers, filter, iterations, prNum].includes(null)) return; isManual = true; triggerSource = 'workflow_dispatch'; - prNumber = prNum ? parseInt(prNum, 10) : null; triggeredBy = context.actor; + + // Auto-detect PR from branch if pr_number not provided + if (prNum) { + prNumber = parseInt(prNum, 10); + } else { + const branch = context.ref.replace('refs/heads/', ''); + const prs = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + head: `${context.repo.owner}:${branch}`, + state: 'open' + }); + if (prs.data.length === 1) { + prNumber = prs.data[0].number; + core.info(`Auto-detected PR #${prNumber} from branch ${branch}`); + } else if (prs.data.length > 1) { + core.warning(`Multiple open PRs found for branch ${branch}, please specify pr_number`); + prNumber = null; + } else { + core.info(`No open PR found for branch ${branch}`); + prNumber = null; + } + } } else { model = ''; markers = 'regression'; From 959f7409a73f5953690ce58a7247193df96946c2 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 19:46:55 +0000 Subject: [PATCH 18/18] Improve eval results comment formatting - Hide Progress section once run is complete (pass null to buildBody) - Consolidate legend into single collapsible
section - Change "Regression" to "Failure" throughout for clarity Signed-off-by: Claude --- .github/scripts/eval-comment-helpers.js | 24 +++++++++++++----------- .github/workflows/eval-regression.yaml | 24 +++++++++--------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/.github/scripts/eval-comment-helpers.js b/.github/scripts/eval-comment-helpers.js index 793ce083b8..b9ee9fdca7 100644 --- a/.github/scripts/eval-comment-helpers.js +++ b/.github/scripts/eval-comment-helpers.js @@ -59,20 +59,22 @@ function renderParamsTable(p) { /** * Build comment body based on state * @param {Object} p - Parameters object - * @param {Array<[boolean, string]>} progressSteps - Progress steps + * @param {Array<[boolean, string]>} progressSteps - Progress steps (null to hide) * @param {Object} extras - Extra options (icon, title, testPreview) * @returns {string} Markdown body */ function buildBody(p, progressSteps, extras = {}) { - const progressText = renderProgress(progressSteps); - let body = p.isManual ? `## ${extras.icon || '๐Ÿš€'} ${extras.title || 'Manual Eval Running...'}\n\n` + - renderParamsTable(p) + `\n**Progress:**\n${progressText}\n` + renderParamsTable(p) : `## ${extras.icon || 'โณ'} ${extras.title || 'HolmesGPT evals running...'}\n\n` + `Automatically triggered by ${p.trigger}\n\n` + - `[View workflow logs](${p.runUrl})\n\n` + - `**Progress:**\n${progressText}\n`; + `[View workflow logs](${p.runUrl})\n`; + + // Only show progress if steps provided (null = hide for completed runs) + if (progressSteps) { + body += `\n**Progress:**\n${renderProgress(progressSteps)}\n`; + } if (extras.testPreview) { body += `\n
\n๐Ÿ“‹ Evals to run\n\n\`\`\`\n${extras.testPreview}\n\`\`\`\n
\n`; @@ -89,7 +91,8 @@ function buildBody(p, progressSteps, extras = {}) { */ function buildRerunFooter(p, context) { const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/eval-regression.yaml`; - return '\n---\n
\n๐Ÿ”„ Re-run evals manually\n\n' + + return '\n---\n
\n๐Ÿ“– Legend\n\n' + + '### ๐Ÿ”„ Re-run evals manually\n\n' + '> โš ๏ธ **Warning:** Manual re-runs have NO default markers and will run ALL LLM tests (~100+), which can take 1+ hours. ' + 'Use `markers: regression` or `filter: test_name` to limit scope.\n\n' + '**Option 1: Comment on this PR** with `/eval`:\n\n' + @@ -101,11 +104,10 @@ function buildRerunFooter(p, context) { '| `markers` | Pytest markers (**no default - runs all tests!**) |\n' + '| `filter` | Pytest -k filter |\n' + '| `iterations` | Number of runs, max 10 |\n\n' + - `**Option 2: [Trigger via GitHub Actions UI](${workflowUrl})** โ†’ "Run workflow"\n
\n` + - '\n
\n๐Ÿท๏ธ Valid markers\n\n' + + `**Option 2: [Trigger via GitHub Actions UI](${workflowUrl})** โ†’ "Run workflow"\n\n` + + '### ๐Ÿท๏ธ Valid markers\n\n' + (p.validMarkers || '_(No markers found)_') + - '\n
\n' + - '\n
\n๐Ÿ“‹ Valid eval names (use with filter)\n\n' + + '\n\n### ๐Ÿ“‹ Valid eval names (use with filter)\n\n' + '**test_ask_holmes:**\n' + (p.askHolmesEvals || '_(No evals found)_') + '\n\n**test_investigate:**\n' + diff --git a/.github/workflows/eval-regression.yaml b/.github/workflows/eval-regression.yaml index e8d3cac5be..bf3396efe3 100644 --- a/.github/workflows/eval-regression.yaml +++ b/.github/workflows/eval-regression.yaml @@ -447,19 +447,13 @@ jobs: investigate_evals: ${{ toJSON(steps.test-preview.outputs.investigate_evals) }} }); const report = fs.existsSync('evals_report.md') ? fs.readFileSync('evals_report.md', 'utf8') : ''; - const regressions = fs.existsSync('regressions.txt') ? fs.readFileSync('regressions.txt', 'utf8').trim() : ''; - const progressSteps = [ - [true, 'Setup HolmesGPT environment'], - [true, 'Collect evals to run'], - [true, 'Setup KIND cluster'], - [true, 'Run evals'] - ]; - let body = buildBody(p, progressSteps, { + const failures = fs.existsSync('regressions.txt') ? fs.readFileSync('regressions.txt', 'utf8').trim() : ''; + let body = buildBody(p, null, { icon: p.isManual ? '๐Ÿงช' : 'โœ…', title: p.isManual ? 'Manual Eval Results' : 'Results of HolmesGPT evals' }); body += '\n' + (report || 'โš ๏ธ No eval report was generated.\n\n'); - if (regressions) body += `\n### โš ๏ธ ${regressions} Regression${regressions === '1' ? '' : 's'} Detected\n\n`; + if (failures) body += `\n### โš ๏ธ ${failures} Failure${failures === '1' ? '' : 's'} Detected\n\n`; // Add re-run footer for automatic runs only if (!p.isManual) { body += buildRerunFooter(p, context); @@ -484,11 +478,11 @@ jobs: const fs = require('fs'); const triggeredBy = ${{ toJSON(steps.eval-params.outputs.triggered_by) }}; const prNumber = parseInt(${{ toJSON(steps.eval-params.outputs.pr_number) }}, 10); - const regressions = fs.existsSync('regressions.txt') ? fs.readFileSync('regressions.txt', 'utf8').trim() : ''; - const hasRegressions = regressions && regressions !== '0'; + const failures = fs.existsSync('regressions.txt') ? fs.readFileSync('regressions.txt', 'utf8').trim() : ''; + const hasFailures = failures && failures !== '0'; - const status = hasRegressions - ? `โš ๏ธ Completed with ${regressions} regression${regressions === '1' ? '' : 's'}` + const status = hasFailures + ? `โš ๏ธ Completed with ${failures} failure${failures === '1' ? '' : 's'}` : 'โœ… Completed successfully'; await github.rest.issues.createComment({ @@ -525,8 +519,8 @@ jobs: if: always() run: | if [[ -f "regressions.txt" ]]; then - echo "โš ๏ธ There are regressions in the evals. Please check the evals file for details." + echo "โš ๏ธ There are failures in the evals. Please check the file for details." cat regressions.txt else - echo "โœ… All tests passed without regressions." + echo "โœ… All tests passed." fi