Skip to content

AI summary: stop flagging AnalysisRuns that the controller stopped - #2057

Merged
hisco merged 1 commit into
mainfrom
eyal/rad-344-analysisrun-terminated-summary
Oct 13, 2026
Merged

hisco merged 1 commit into
mainfrom
eyal/rad-344-analysisrun-terminated-summary

Conversation

@hisco

@hisco hisco commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

After ordinary rollout activity, the AI summary reports the Rollout's AnalysisRuns as issues. Reproduce on a kind cluster with Argo Rollouts v1.9.1: start a canary with a step analysis, promote it fully from Radar, then call list_resources for analysisruns. The run comes back as:

{"kind":"AnalysisRun","status":"Successful","issue":"Run Terminated","type":"Step"}

Argo stops an in-flight run once the Rollout no longer needs it: a canary that finishes while its background analysis is still running, a newer revision, an abort, a promote-full or a fast rollback (rollout/analysis.go upstream). The stopped run ends Successful with the message "Run Terminated". summarizeArgoAnalysisRun copied status.message into issue whenever no metric had failed. Any canary with background analysis that completes normally therefore leaves a run the summary flags.

The message now becomes the issue only when the run's phase is Failed, Error or Inconclusive. Those are the phases rolloutBlockReason already treats as a bad analysis verdict when it reads the Rollout's analysis run statuses.

Where to look hardest: the phase allowlist. Two cases decide whether it is right.

  • Error runs with no metric result. When Argo cannot resolve an argument it sets phase Error and puts the reason only in status.message. Error is in the list, so this still reaches issue. The repro includes such a run, and so does the new test.
  • Pending and Running runs no longer surface a message. Argo writes status.message only when a run finishes (analysis/analysis.go in v1.9.1: the error paths set phase Error, and the assessment returns an empty message while metrics are still running), so in practice these runs never carry one.

What this gives up: the summary no longer says that a Successful run was stopped early rather than run to completion. The detail view (get_resource) still returns spec.terminate: true and the message, and the summary has no neutral field to carry it without calling it an issue.

Evidence, same cluster and same three runs:

Run Phase issue before issue after
step run after promote-full Successful Run Terminated (none)
run with a missing secret argument Error Unable to resolve metric arguments: secrets "does-not-exist" not found unchanged
run whose metric job exits 1 Failed exits-nonzero failed unchanged

Tests, both passing:

cd pkg && go test ./ai/context/...
go test ./internal/mcp/...

pkg/ is its own Go module, so the first one runs from inside it. The new table test fails on main on the stopped-run case (issue = "Run Terminated", want empty).

Argo Rollouts stops an in-flight AnalysisRun once the Rollout no longer
needs it: a canary finishing with background analysis still running, a
newer revision, an abort, a promote-full or a fast rollback. The run then
ends Successful with the message "Run Terminated". The AI summary copied
status.message into the issue field whenever no metric had failed, so an
agent listing AnalysisRuns saw status "Successful" with issue
"Run Terminated" after ordinary rollout activity and could read it as a
problem.

The message now becomes the issue only when the run's own phase is
Failed, Error or Inconclusive. Those are the phases the Rollout summary
already treats as a bad analysis verdict. Argo writes status.message
only when a run finishes, so Pending and Running runs lose nothing. An
Error run whose only explanation is in status.message, such as an
argument that cannot be resolved, still reports it. The full object from
the detail view still carries spec.terminate and the message.
@hisco
hisco requested a review from nadaverell as a code owner October 10, 2026 20:32
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Stop treating controller-stopped AnalysisRuns as summary issues

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Show AnalysisRun messages as issues only for Failed, Error, or Inconclusive verdicts.
• Keep failing metric details and error messages available while avoiding false alarms after normal
 rollout activity.
• Add tests for each bad verdict and a controller-stopped Successful run.
Diagram

graph TD
  RUN["AnalysisRun status"] --> METRIC{"Problem metric?"} -->|Yes| METRIC_ISSUE["Metric issue"] --> OUT["Resource summary"]
  METRIC -->|No| VERDICT{"Bad run verdict?"} -->|Yes| MESSAGE["Message issue"] --> OUT
  VERDICT -->|No| CLEAR["No issue"] --> OUT
Loading
High-Level Assessment

The phase allowlist is the smallest fix consistent with the Rollout summary's bad-verdict handling. Adding a neutral field to retain termination context would expand the summary contract; the detail view already retains that information.

Files changed (2) +50 / -1

Bug fix (1) +6 / -1
summary_crd.goRestrict AnalysisRun message issues to bad verdicts +6/-1

Restrict AnalysisRun message issues to bad verdicts

• The summarizer now falls back to status.message only for Failed, Error, or Inconclusive runs when no scored metric supplies an issue. Successful controller-stopped runs therefore keep an empty issue, while error-only explanations remain visible.

pkg/ai/context/summary_crd.go

Tests (1) +44 / -0
summary_rollout_test.goCover AnalysisRun message fallback by phase +44/-0

Cover AnalysisRun message fallback by phase

• Adds table-driven cases for Failed, Error, and Inconclusive message fallback, plus a Successful run stopped by the controller. The latter asserts that “Run Terminated” is not reported as an issue.

pkg/ai/context/summary_rollout_test.go

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@hisco
hisco merged commit 6241756 into main Oct 13, 2026
9 checks passed
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.

1 participant