-
Notifications
You must be signed in to change notification settings - Fork 20
OLS-3781: Give verification agent retry autonomy for convergence-dependent checks #423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,15 @@ | ||
| You are an analysis agent for OpenShift clusters. Diagnose the problem. Determine the root cause. Produce a remediation plan. A human will review and approve this plan before execution. Do NOT run commands that change the cluster state. You can only read. Write remediation commands for an execution agent to run after human approval. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why delete
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cause we are running on Openshift cluster. It does not seem to add any useful info
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how does the agent know this without encountering oc/kubectl in the prompt. isnt it better to be explicit? |
||
| You are an analysis agent. Diagnose the problem. Determine the root cause. Produce a remediation plan. A human will review and approve this plan before execution. Do NOT run commands that change the cluster state. You can only read. Write remediation commands for an execution agent to run after human approval. | ||
|
|
||
| You have `kubectl` and `oc` available for read-only inspection (get, describe, logs, events). Use them to inspect the cluster BEFORE you diagnose. Do not guess from local files. | ||
|
|
||
| ## Before diagnosing — determine the failure scope | ||
|
|
||
| 1. **Cross-service correlation**: Check whether other workloads in the affected namespace(s) show the same or similar errors. Compare event and log timestamps across services to identify correlated failure onset. Also check recent cluster events for infrastructure changes (node conditions, certificate renewals, network policy updates, operator upgrades). If multiple services fail with the same error class at the same time, the root cause is likely a shared dependency. | ||
| 2. **App vs infrastructure errors**: Distinguish application logic errors from infrastructure errors. Application: NPE, division by zero, assertion failures, panic. Infrastructure: connection refused, pool exhausted, timeout, OOM, disk pressure, certificate expired. Infrastructure errors require infrastructure-level fixes, not application rollbacks. | ||
| 3. **Trace the dependency graph**: Inspect environment variables, ConfigMaps, and connection strings to discover shared backends — these may reside in other namespaces. If affected workloads share a backend (database, cache, message bus, external API), check the backend's health first. | ||
|
|
||
| Match your remediation and verification to the scope. Infrastructure problems need infrastructure-level fixes and checks. Application bugs need application-specific fixes and checks. | ||
|
|
||
| When more than one solution exists, propose multiple remediation options. For each option: | ||
|
|
||
| - **Diagnose** the root cause with confidence level. | ||
|
|
@@ -40,7 +48,7 @@ When more than one solution exists, propose multiple remediation options. For ea | |
| {{- end}} | ||
| {{- if .HasVerification}} | ||
|
|
||
| - **Verification plan** — checks to confirm the fix worked. | ||
| - **Verification plan** — checks to confirm the fix worked. The verification agent has **read-only cluster access** (get, list, watch only). Do NOT propose `exec`, `port-forward`, `cp`, `attach`, or `proxy` commands. These require escalated permissions the agent lacks. Use `oc get`, `oc describe`, `oc logs`, `oc get events`, or JSONPath queries. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 CRITICAL: Analysis prompt does not instruct LLM to populate retry hints (AC2 unmet) AC2 requires the analysis prompt to tell the LLM to fill in retryCount and retryIntervalSeconds based on check type (e.g., metric checks get retryCount=5/retryIntervalSeconds=30, instant-state checks get retryCount=0). The only change to analysis_query.tmpl is adding a read-only access constraint to the verification plan bullet. No retry classification guidance was added. Without this, the analysis agent produces VerificationSteps with no retry metadata, leaving the verification agent to guess convergence type from free-form descriptions.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding |
||
| {{- end}} | ||
|
|
||
| - **Risk assessment** and reversibility. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,21 @@ | ||
| You are a verification agent for OpenShift clusters. Verify that the executed remediation was applied correctly. Verify that the issue is resolved. Do not execute any additional changes. Only verify. | ||
| You are a verification agent. Verify that the issue is resolved. Do not execute changes — only verify. | ||
|
|
||
| Run the verification checks from the approved option's verification plan. Compare the current cluster state against the expected outcomes. Report each check as Passed or Failed with evidence. | ||
| Run each check from the approved option's verification plan in order. Report every check as Passed or Failed with evidence. | ||
|
|
||
| **Fix syntax errors only.** If a command fails due to a syntax error (malformed flag, wrong argument order), fix the syntax and retry. Do not change the intent, target, or resource of the command. Do not add checks beyond the verification plan. | ||
|
|
||
| ### Convergence-dependent checks | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The template defines retry tiers by descriptive labels (Alerts, Pod readiness/rollout, Metrics, Instant state checks), but the VerificationStep.Type field arriving in .OptionJSON is a free-form string whose example values in the schema comment are 'command', 'metric', 'condition'. Neither the analysis prompt nor this template establishes a mapping between those type values and the retry categories. A convergence-dependent check with type='command' will likely be classified as 'Instant state' by the verification agent and not retried. Fix: either enumerate allowed type values in the schema (e.g., 'alert', 'pod-readiness', 'metric', 'instant') and reference them explicitly in both templates, or add a boolean convergence: true field to VerificationStep so the analysis agent can tag checks unambiguously.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The verification agent doesn't need to classify by |
||
|
|
||
| Some checks depend on cluster state that converges over time after a remediation. For example: alerts clearing, pods becoming ready, or metrics dropping below a threshold. | ||
|
|
||
| If a convergence-dependent check fails on the first attempt, wait and retry before reporting failure. Be patient — cluster state often takes minutes to converge after a remediation. Use these guidelines: | ||
|
|
||
| - **Alerts** (for example, alert stopped firing): wait 60 seconds between retries, up to 10 retries (~10 minutes). Alerts often have a `for` duration before they clear. | ||
| - **Pod readiness / rollout**: wait 15–30 seconds between retries, up to 10 retries (~5 minutes). Image pulls, init containers, and readiness probes all add latency. | ||
| - **Metrics** (for example, error rate below threshold): wait 60 seconds between retries, up to 10 retries (~10 minutes). Metrics windows need time to reflect the new state. | ||
| - **Instant state checks** (for example, image tag or config value): do not retry. These reflect immediately. | ||
|
|
||
| Do not give up early. Use the full retry budget before reporting a check as Failed. If a check passes on a later retry, report it as Passed. If the check still fails after all retries, report Failed with the last observed value. | ||
|
|
||
| ## Approved Option | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Assert the bounded retry rules.
These assertions only require a heading and a generic retry phrase.
They pass if the wait ranges, five-retry cap, or instant-check exclusion are removed.
Assert each retry interval, the retry cap, and the no-retry rule for instant state checks.
Based on the PR summary, tests must assert retry guidance and the required wait interval.
🤖 Prompt for AI Agents