Skip to content

Show evals AIC in generated footer metrics - #47260

Merged
pelikhan merged 3 commits into
mainfrom
copilot/update-generated-footer-evals-aic-cost
Jul 22, 2026
Merged

Show evals AIC in generated footer metrics#47260
pelikhan merged 3 commits into
mainfrom
copilot/update-generated-footer-evals-aic-cost

Conversation

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Generated footers previously reported agent and detection AIC but omitted evals cost, so total run cost could be understated. This change adds evals AIC to footer rendering using the same compact metric style and a dedicated Unicode marker.

  • Footer cost composition

    • Extend footer AIC aggregation to include GH_AW_EVALS_AIC.
    • Render evals as a distinct metric entry with icon , alongside existing entries (e.g., for detection).
  • Conclusion/no-op wiring

    • Pass evals AIC into conclusion-time footer generation via GH_AW_EVALS_AIC.
    • Include evals AIC in no-op footer total calculation so no-op comments reflect full run cost.
  • Workflow data flow

    • Expose evals job aic as a job output.
    • Consume needs.evals.outputs.aic in conclusion helpers to make evals cost available where footers are generated.
env:
  GH_AW_AIC: ${{ needs.agent.outputs.aic }}
  GH_AW_THREAT_DETECTION_AIC: ${{ needs.detection.outputs.aic }}
  GH_AW_EVALS_AIC: ${{ needs.evals.outputs.aic }}

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Display evals AIC cost in generated footers Show evals AIC in generated footer metrics Jul 22, 2026
Copilot AI requested a review from pelikhan July 22, 2026 09:52
@pelikhan
pelikhan marked this pull request as ready for review July 22, 2026 09:59
Copilot AI review requested due to automatic review settings July 22, 2026 09:59
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (13 additions in default business logic directories).

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds evals AI Credits to generated footer metrics and conclusion-time cost totals.

Changes:

  • Exposes and propagates evals AIC.
  • Adds evals metrics to standard and failure footers.
  • Extends no-op cost aggregation and tests.
Show a summary per file
File Description
pkg/workflow/notify_comment_conclusion_helpers.go Propagates evals AIC to conclusion handlers.
pkg/workflow/evals_job.go Declares the evals AIC output.
pkg/workflow/evals_job_test.go Tests the output mapping.
pkg/workflow/compiler_jobs_test.go Tests conclusion environment wiring.
actions/setup/js/messages.test.cjs Tests evals footer rendering.
actions/setup/js/messages_footer.cjs Aggregates and renders evals AIC.
actions/setup/js/handle_noop_message.test.cjs Tests no-op evals totals.
actions/setup/js/handle_noop_message.cjs Includes evals in no-op totals.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread pkg/workflow/evals_job.go
Comment on lines +101 to +103
Outputs: map[string]string{
"aic": fmt.Sprintf("${{ steps.%s.outputs.aic }}", constants.ParseMCPGatewayStepID),
},

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are correct and complete. Evals AIC is consistently wired through all footer-generating paths (getFooterMessage, getFooterAgentFailureIssueMessage, getFooterAgentFailureCommentMessage, and buildAICSuffix in the noop handler) with the icon. The useBreakdown logic, total AIC summation, and job output exposure are all handled correctly. Test coverage is thorough.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 15.7 AIC · ⌖ 5.1 AIC · ⊞ 5K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /tdd — one observation on test coverage; no blocking issues.

📋 Key Themes & Highlights

Key Theme

  • Missing combined test: The new tests each isolate evals AIC on its own, but none tests the scenario where both GH_AW_THREAT_DETECTION_AIC and GH_AW_EVALS_AIC are set together. This is the most likely production scenario and would catch any ordering or total-calculation bugs between the two breakdown entries.

Positive Highlights

  • ✅ Consistent pattern: evals follows the exact same shape as threat-detection (parse → entry → suffix → return)
  • ✅ Good use of the existing buildAICEntry abstraction — no duplication
  • ✅ Conditional guard (data.Evals != nil && data.Evals.HasEvals()) correctly mirrors the detection pattern
  • ✅ Go-side output wiring and compiler test are clean and complete

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 18.3 AIC · ⌖ 4.69 AIC · ⊞ 6.7K
Comment /matt to run again


it("should include ambient context in ai_credits_suffix for custom footer templates", async () => {
process.env.GH_AW_AGENT_AIC = "1.25";
process.env.GH_AW_THREAT_DETECTION_AIC = "0.25";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] No test covers the combined case where both GH_AW_THREAT_DETECTION_AIC and GH_AW_EVALS_AIC are set simultaneously — the ordering agent → detection → evals in the suffix and the combined total are untested together.

💡 Suggested test
it("should include both detection and evals AIC entries in correct order", async () => {
  process.env.GH_AW_AGENT_AIC = "1.00";
  process.env.GH_AW_THREAT_DETECTION_AIC = "0.10";
  process.env.GH_AW_EVALS_AIC = "0.05";
  const { getFooterMessage } = await import("./messages.cjs");
  const result = getFooterMessage({ workflowName: "W", runUrl: "(u/redacted)" });
  // total = 1.15, detection before evals
  expect(result).toContain("⌖ 0.1 AIC · ◇ 0.05 AIC");
});

@copilot please address this.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

🔶 Test Quality Score: 49/100 — Needs improvement

Analyzed 7 test(s): 6 design, 0 implementation, 2 violation(s).

📊 Metrics (7 tests)
Metric Value
Analyzed 7 (JS: 5, Go: 2)
✅ Design 6 (85.7%)
⚠️ Implementation 0 (0%)
Edge/error coverage 0 (0%)
Duplicate clusters 1
Inflation YES (2.02:1 overall)
🚨 Violations 2
Test File Classification Issues
should include evals AIC in the footer total when GH_AW_EVALS_AIC is set handle_noop_message.test.cjs Design Test inflation (12:1 ratio); missing error/edge cases
should include evals AI Credits with a Unicode icon in the default footer messages.test.cjs Design ✅ No issues
should expose evals AI Credits entry in custom footer templates messages.test.cjs Design ✅ No issues
should include evals AI Credits in the default footer when available (issue) messages.test.cjs Design ✅ No issues
should include evals AI Credits in the default comment footer when available messages.test.cjs Design ✅ No issues
compiler_jobs_test.go assertion compiler_jobs_test.go Design ✅ Descriptive message
evals_job_test.go assertions (2 variants) evals_job_test.go Design Duplicated assertion; no error cases
⚠️ Flagged Tests (2)

handle_noop_message.test.cjs "should include evals AIC..." — Test file inflation: 24 lines added vs 2 lines in production (+2 to handle_noop_message.cjs). Ratio 12:1 exceeds threshold. Root cause: full integration test with mocked GitHub API. Consider extracting unit tests for footer calculation or message formatting functions. Missing error scenarios (e.g., invalid GH_AW_EVALS_AIC format, missing env vars).

evals_job_test.go assertions — Same assertion job.Outputs["aic"] duplicated in TestBuildEvalsJobNeedsWithDetection and TestBuildEvalsJobNeedsWithoutDetection. Consolidate into shared helper or data-driven variant. No error cases tested (e.g., missing step output, malformed expressions).

Verdict

Failed. Test inflation detected: 2.02:1 ratio. handle_noop_message.test.cjs shows 12:1 inflation with single assertion per 12 test lines. No edge-case or error-path coverage across all 7 tests (0% edge coverage).

Recommendation: Add error-path tests for invalid/missing GH_AW_EVALS_AIC; reduce handle_noop_message integration test bloat by extracting unit-level helpers.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 13.5 AIC · ⌖ 7.85 AIC · ⊞ 7K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Test Quality Sentinel: 49/100. Test inflation detected (2.02:1 ratio). handle_noop_message.test.cjs shows 12:1 inflation. No edge-case or error-path coverage across all 7 tests (0% edge coverage). Review flagged tests in the comment above.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST_CHANGES — three blocking issues

This PR cannot achieve its stated goal as written: evals AIC will always be empty at runtime, the noop path diverges from the breakdown rendering, and a test masks the inconsistency through coincidental arithmetic.

🔍 Blocking findings (details in inline comments)

1. Evals job aic output is permanently empty (pkg/workflow/evals_job.go:102)
parse-mcp-gateway is only emitted for the main agent job; the evals job never creates that step. ${{ steps.parse-mcp-gateway.outputs.aic }} will always expand to empty, so GH_AW_EVALS_AIC is never set in conclusion steps. The entire PR is a no-op at runtime.

2. buildAICSuffix in handle_noop_message.cjs discards the icon (line 94)
messages_footer.cjs shows ◇ 0.025 AIC as a distinct labeled entry; noop collapses everything into one unlabeled total. Inconsistent UX.

3. New noop test passes by coincidental arithmetic (handle_noop_message.test.cjs:56)
0.100 + 0.025 = 0.125 satisfies the assertion, but there is no assertion for ◇ 0.025 AIC appearing separately, giving false coverage for the wrong behavior.

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 113.4 AIC · ⌖ 5.23 AIC · ⊞ 5.6K
Comment /review to run again

Comments that could not be inline-anchored

pkg/workflow/evals_job.go:102

Evals AIC output will always be empty: the parse-mcp-gateway step doesn't exist in the evals job, so GH_AW_EVALS_AIC will never be populated and footers will silently under-report evals cost.

<details>
<summary>💡 Details</summary>

constants.ParseMCPGatewayStepID (parse-mcp-gateway) is emitted only by compiler_yaml_ai_execution.go for the main agent job. The evals job builds all its steps via buildEvalsJobSteps and buildEvalsEngineSteps, neither of which ever emits a ste…

actions/setup/js/handle_noop_message.cjs:94

Noop footer omits evals breakdown icon: buildAICSuffix silently folds evalsAIC into the total with no marker, diverging from messages_footer.cjs which renders it as a distinct metric.

<details>
<summary>💡 Details</summary>

In messages_footer.cjs, when evalsAIC is present the suffix is rendered as agent + ⌖threat + ◇evals — each component labeled. In handle_noop_message.cjs buildAICSuffix, all three are summed into one totalAIC and shown as a single unlabeled number. A…

actions/setup/js/messages_footer.cjs:123

Potential double-count of evals/threat costs when GH_AW_AIC is the all-up total: if GH_AW_AGENT_AIC is absent, agentAIC falls back to totalAIC (which may already include evals). Adding evalsAIC again in breakdown mode inflates the displayed figure.

<details>
<summary>💡 Details</summary>

const agentAIC = typeof explicitAgentAIC === &quot;number&quot; ? explicitAgentAIC : totalAIC;
// ...
const aiCredits = useBreakdown
  ? (agentAIC || 0) + (threatDetectionAIC || 0) + (evalsAIC || 0)

</details>

<details><summary>actions/setup/js/handle_noop_message.test.cjs:56</summary>

**Test asserts wrong AIC value**: expects `0.125` but `GH_AW_AIC=0.100` + `GH_AW_EVALS_AIC=0.025` = `0.125`  the test only passes because both values happen to sum to the expected total, hiding the fact that evals is not shown separately with a `` icon.

&lt;details&gt;
&lt;summary&gt;💡 Details&lt;/summary&gt;

```js
process.env.GH_AW_AIC = &quot;0.100&quot;;
process.env.GH_AW_EVALS_AIC = &quot;0.025&quot;;
// ...
expect(commentCall.body).toContain(&quot;sonnet46 0.125 AIC&quot;);

This test verifies that buildAICSuffix produces the…

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Completed a PR-finisher pass and pushed fixes in 0e1b138.

Addressed the unresolved feedback by adding MCP gateway log parsing to the evals job (so needs.evals.outputs.aic is populated) and adding combined detection+evals footer coverage. Local validation and targeted CI log triage were run; CI on the new head still needs a maintainer re-trigger.

@pelikhan
pelikhan merged commit c1c4e6c into main Jul 22, 2026
31 checks passed
@pelikhan
pelikhan deleted the copilot/update-generated-footer-evals-aic-cost branch July 22, 2026 11:38
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the remaining unresolved review feedback, and rerun checks once the branch is up to date.

Unresolved reviews:

Generated by 👨‍🍳 PR Sous Chef · gpt54 14.4 AIC · ⌖ 7.63 AIC · ⊞ 7K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants