Skip to content

OLS-3666: Analysis and Execution phases show more specific error message when failing. - #415

Open
raptorsun wants to merge 1 commit into
openshift:mainfrom
raptorsun:OLS-3666
Open

OLS-3666: Analysis and Execution phases show more specific error message when failing.#415
raptorsun wants to merge 1 commit into
openshift:mainfrom
raptorsun:OLS-3666

Conversation

@raptorsun

@raptorsun raptorsun commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

When an agent phase (analysis or execution) fails, the operator now surfaces a specific error message instead of the generic "execution agent reported failure".

  • Read the summary field from the sandbox response (already present but ignored for analysis/execution)
  • Fall back through existing response fields (diagnosis, failed actions, verification summary)
  • Fall back to a properly-cased generic message ("Analysis agent reported failure")
  • Fixes incorrect casing (was all-lowercase)

Before: execution agent reported failure
After: Execution failed: Agent timed out after 5000ms

Changes

  • controller/agenticrun/sandbox_agent.go — added Summary field to analysisResponse and executionResponse structs; propagated to output structs
  • controller/agenticrun/agent.go — added Summary field to AnalysisOutput and ExecutionOutput
  • controller/agenticrun/handlers.go — added analysisFailureMessage() and executionFailureMessage() helpers with fallback chain; replaced three hardcoded error strings
  • controller/agenticrun/handlers_test.go — unit tests for both failure message functions

Operator-only change — no schema changes, no sandbox modifications, no spec update.

Test plan

  • make test passes (all unit tests)
  • New unit tests for analysisFailureMessage and executionFailureMessage cover: summary present, diagnosis fallback, action error fallback, no-details fallback
  • make test-e2e with mock agent configured to return success: false

Jira: OLS-3666

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 4, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 4, 2026

Copy link
Copy Markdown

@raptorsun: This pull request references OLS-3666 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@raptorsun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d914657-9b54-467c-9ea7-baf1531e055a

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad343d and 858c06a.

📒 Files selected for processing (6)
  • .ai/spec/how/reconciler.md
  • .ai/spec/what/run-lifecycle.md
  • controller/agenticrun/agent.go
  • controller/agenticrun/handlers.go
  • controller/agenticrun/handlers_test.go
  • controller/agenticrun/sandbox_agent.go
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added concise summaries to analysis and execution results.
    • Failure messages now include the most relevant available details from results and verification steps.
  • Bug Fixes

    • Improved fallback behavior when detailed failure information is unavailable or unusable.
    • Prevented raw technical response data from appearing as failure messages.
  • Tests

    • Added coverage for failure-message prioritization, formatting, and fallback scenarios.

Walkthrough

The change parses optional analysis and execution summaries, propagates them through agent outputs, and uses them to generate contextual failure messages. Tests verify message precedence and generic fallbacks.

Changes

Agentic run failure context

Layer / File(s) Summary
Summary contract and propagation
controller/agenticrun/agent.go, controller/agenticrun/sandbox_agent.go
AnalysisOutput and ExecutionOutput now include Summary. Sandbox responses parse and propagate the optional value.
Failure message selection and wiring
controller/agenticrun/handlers.go
Analysis failures use validated summaries, diagnoses, and option diagnoses. Execution failures use validated summaries, failed action details, and verification details. Revision analysis failures use the analysis helper. Generic fallback messages remain available.
Failure precedence validation and lifecycle specification
controller/agenticrun/handlers_test.go, .ai/spec/how/reconciler.md, .ai/spec/what/run-lifecycle.md
Table-driven tests verify analysis and execution message precedence, raw JSON exclusion, action errors, verification details, and generic fallbacks. Specifications document the helpers and the lifecycle requirement for agent-response context.

Sequence Diagram(s)

sequenceDiagram
  participant SandboxResponse
  participant AgentOutputs
  participant FailureHandlers
  participant FailureMessageHelpers
  SandboxResponse->>AgentOutputs: parse and propagate optional summaries
  FailureHandlers->>FailureMessageHelpers: request contextual failure message
  FailureMessageHelpers->>AgentOutputs: inspect summaries and failure details
  FailureMessageHelpers-->>FailureHandlers: return selected or generic message
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: more specific failure messages for Analysis and Execution phases.
Description check ✅ Passed The description directly explains the failure-message changes, fallback logic, affected files, and test status.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci
openshift-ci Bot requested review from JoaoFula and joshuawilson August 4, 2026 16:19
@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign onmete for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@controller/agenticrun/handlers.go`:
- Around line 775-782: Update the failed-action formatting in the
result.ActionsTaken loop so that when action.Description is empty but
action.Error is present, it returns the error alone without the empty
description prefix. Preserve the existing combined message when both fields are
populated and the description-only behavior when no error is available.

In `@controller/agenticrun/sandbox_agent.go`:
- Around line 34-42: Add top-level summary properties to AnalysisOutputSchema
and ExecutionOutputSchema, and ensure MinimalAnalysisOutputSchema retains its
option-item summary field. Align each schema with the top-level resp.Summary
decoding so AnalysisOutput.Summary and ExecutionOutput.Summary are populated
without removing nested option summaries.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d19ed15-8619-4bf3-9b1d-477eabd2957e

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad343d and 7f93968.

📒 Files selected for processing (4)
  • controller/agenticrun/agent.go
  • controller/agenticrun/handlers.go
  • controller/agenticrun/handlers_test.go
  • controller/agenticrun/sandbox_agent.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/lightspeed-agentic-sandbox (manual)

Comment thread controller/agenticrun/handlers.go
Comment thread controller/agenticrun/sandbox_agent.go
@xrajesh

xrajesh commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@raptorsun Do we not need this for Verification Agent ?

@onmete

onmete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Primary path can dump full LLM JSON into condition messages because schemas omit top-level summary and the sandbox falls back to summary=text. Also needs a .ai/spec update for the new failure-message behavior - "no spec update" is incorrect here.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.ai/spec/what/run-lifecycle.md:
- Line 53: Update rule 16a in the run-lifecycle specification to explicitly
target the top-level status.conditions field and retain reason "Failed",
distinguishing it from status.steps.*.conditions and the AgentFailed step-result
reason defined in rule 14a. Do not alter the failure-message fallback
requirements.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a8d1e4c9-2914-4ef5-9519-4c91c77508ae

📥 Commits

Reviewing files that changed from the base of the PR and between 7f93968 and 78f7be0.

📒 Files selected for processing (4)
  • .ai/spec/how/reconciler.md
  • .ai/spec/what/run-lifecycle.md
  • controller/agenticrun/handlers.go
  • controller/agenticrun/handlers_test.go
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift/lightspeed-agentic-sandbox (manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • controller/agenticrun/handlers_test.go
  • controller/agenticrun/handlers.go

Comment thread .ai/spec/what/run-lifecycle.md Outdated
…age when failing.

Surface the sandbox response summary in failure condition messages
instead of hardcoded generic strings. Add Summary field to
analysisResponse/executionResponse structs so the operator reads
the summary the sandbox already returns. Build descriptive messages
via analysisFailureMessage/executionFailureMessage with a fallback
chain: summary, diagnosis/action details, properly-cased generic.
Also fixes incorrect all-lowercase casing.

Add spec rule 16a documenting the failure message fallback chain.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@raptorsun

Copy link
Copy Markdown
Contributor Author

Do we not need this for Verification Agent ?

Verification phase has already the summary field used in error message.

Primary path can dump full LLM JSON into condition messages because schemas omit top-level summary and the sandbox falls back to summary=text. Also needs a .ai/spec update for the new failure-message behavior - "no spec update" is incorrect here.

good catch, spec has been update, too :)

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown

@raptorsun: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants