Skip to content

Include detection AIC in no-op comment footer totals#37446

Merged
pelikhan merged 2 commits into
mainfrom
copilot/fix-footer-no-op-comments
Jun 7, 2026
Merged

Include detection AIC in no-op comment footer totals#37446
pelikhan merged 2 commits into
mainfrom
copilot/fix-footer-no-op-comments

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 7, 2026

No-op tracking comments were only showing agent AIC, so workflows with threat detection underreported total detection cost in the footer. This change makes the no-op footer report combined AIC when detection is enabled.

  • Footer cost aggregation

    • handle_noop_message.cjs now computes footer AIC as: agent AIC + threat-detection AIC (using positive numeric values only).
    • Footer output remains unchanged in shape (· {value} AIC), but now reflects full no-op run cost.
  • Workflow env wiring for no-op step

    • The conclusion no-op step now receives GH_AW_THREAT_DETECTION_AIC from needs.detection.outputs.aic when detection is enabled.
    • This ensures the footer renderer has both cost inputs at comment-generation time.
  • Regression coverage

    • Added test coverage for combined AIC rendering in no-op comments and for compiler emission of the detection AIC env var in the no-op conclusion step.
const totalAIC =
  (Number.isFinite(agentAIC) && agentAIC > 0 ? agentAIC : 0) +
  (Number.isFinite(detectionAIC) && detectionAIC > 0 ? detectionAIC : 0);

return totalAIC > 0 ? ` · ${formatAIC(totalAIC)} AIC` : "";

Copilot AI and others added 2 commits June 7, 2026 00:09
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Fix no-op comment footer to include detection AIC cost Include detection AIC in no-op comment footer totals Jun 7, 2026
Copilot AI requested a review from pelikhan June 7, 2026 00:12
@pelikhan pelikhan marked this pull request as ready for review June 7, 2026 00:42
Copilot AI review requested due to automatic review settings June 7, 2026 00:42
@pelikhan pelikhan merged commit 0cd7489 into main Jun 7, 2026
@pelikhan pelikhan deleted the copilot/fix-footer-no-op-comments branch June 7, 2026 00:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes underreporting of AI Credits (AIC) in no-op tracking comment footers by including threat-detection AIC in the total when threat detection is enabled, ensuring no-op runs reflect the full cost of the workflow’s agent + detection phases.

Changes:

  • Updated the no-op footer renderer to compute totalAIC = agentAIC + threatDetectionAIC (positive finite values only) and render that combined total.
  • Wired GH_AW_THREAT_DETECTION_AIC into the conclusion job’s “Process no-op messages” step when the detection job is enabled.
  • Added regression tests covering both the JS footer total rendering and the Go compiler’s env-var emission.
Show a summary per file
File Description
pkg/workflow/notify_comment.go Passes detection AIC into the no-op conclusion step via GH_AW_THREAT_DETECTION_AIC when detection is enabled.
pkg/workflow/detection_success_test.go Verifies compiled YAML includes the detection AIC env var for the no-op step in the conclusion job.
actions/setup/js/handle_noop_message.cjs Updates footer AIC suffix computation to sum agent + detection AIC.
actions/setup/js/handle_noop_message.test.cjs Adds a test asserting combined AIC appears in the rendered no-op footer and ensures env cleanup.

Copilot's findings

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 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.

3 participants