Skip to content

OLS-3811 Make confidence/risk optional and remove from LLM schemas - #422

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
vimalk78:OLS-3811-remove-confidence-risk
Aug 6, 2026
Merged

OLS-3811 Make confidence/risk optional and remove from LLM schemas#422
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
vimalk78:OLS-3811-remove-confidence-risk

Conversation

@vimalk78

@vimalk78 vimalk78 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make DiagnosisResult.Confidence and RemediationPlan.Risk CRD fields optional (remove +required markers)
  • Remove confidence/risk from LLM output schemas so the agent no longer produces these values
  • Remove confidence/risk from prompt templates (analysis_query.tmpl, revision_context.tmpl)
  • Update validation, stub agent, mock agent, and all test fixtures
  • Type definitions (ConfidenceLevel, RiskLevel) kept for backward compatibility

Legal requirement: AIA TG-03 prohibits displaying LLM-self-assessed confidence/risk scores to users.

Test plan

  • make manifests — CRD regenerated, confidence/risk no longer required
  • make test — all unit tests pass
  • make api-lint — passes
  • make fmt / make vet — clean
  • Deployed to cluster, verified AnalysisResult CRs no longer contain confidence/risk

Jira

https://redhat.atlassian.net/browse/OLS-3811

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0f09a683-4c99-48fa-a250-59e3ec7a1078

📥 Commits

Reviewing files that changed from the base of the PR and between 303f265 and 4b07712.

⛔ Files ignored due to path filters (1)
  • config/crd/bases/agentic.openshift.io_analysisresults.yaml is excluded by !config/crd/bases/**
📒 Files selected for processing (15)
  • api/v1alpha1/agenticrun_analysis_types.go
  • controller/agenticrun/agent.go
  • controller/agenticrun/audit.go
  • controller/agenticrun/audit_test.go
  • controller/agenticrun/handlers_test.go
  • controller/agenticrun/results.go
  • controller/agenticrun/results_test.go
  • controller/agenticrun/sandbox_agent.go
  • controller/agenticrun/sandbox_agent_test.go
  • controller/agenticrun/schemas.go
  • controller/agenticrun/schemas_test.go
  • controller/agenticrun/state_machine_test.go
  • controller/agenticrun/templates/analysis_query.tmpl
  • controller/agenticrun/templates/revision_context.tmpl
  • test/agent/main.go
🔗 Linked repositories identified

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

  • openshift/lightspeed-agentic-sandbox (manual)
💤 Files with no reviewable changes (2)
  • controller/agenticrun/audit.go
  • test/agent/main.go
🚧 Files skipped from review as they are similar to previous changes (13)
  • controller/agenticrun/results.go
  • controller/agenticrun/sandbox_agent.go
  • controller/agenticrun/templates/analysis_query.tmpl
  • api/v1alpha1/agenticrun_analysis_types.go
  • controller/agenticrun/templates/revision_context.tmpl
  • controller/agenticrun/schemas_test.go
  • controller/agenticrun/state_machine_test.go
  • controller/agenticrun/schemas.go
  • controller/agenticrun/agent.go
  • controller/agenticrun/results_test.go
  • controller/agenticrun/handlers_test.go
  • controller/agenticrun/audit_test.go
  • controller/agenticrun/sandbox_agent_test.go

📝 Walkthrough

Summary by CodeRabbit

  • Enhancements

    • Analysis results no longer require confidence scores for diagnoses or risk ratings for remediation plans.
    • Diagnoses are accepted when they include a summary and root cause.
    • Remediation plans now focus on descriptions, executable actions, and reversibility.
    • Updated analysis guidance, validation, and audit reporting to reflect the streamlined result format.
  • Tests

    • Updated analysis, sandbox, state-management, and audit coverage for the revised result format.

Walkthrough

The PR removes required diagnosis confidence and remediation risk fields from analysis types, schemas, prompts, runtime validation, audit events, stub responses, and test fixtures.

Changes

Analysis metadata changes

Layer / File(s) Summary
Update analysis contracts and generation
api/v1alpha1/agenticrun_analysis_types.go, controller/agenticrun/schemas.go, controller/agenticrun/templates/*, controller/agenticrun/agent.go, test/agent/main.go
Diagnosis confidence and remediation risk are optional or omitted from types, schemas, prompts, stub output, and canned responses.
Accept and record responses
controller/agenticrun/results.go, controller/agenticrun/sandbox_agent.go, controller/agenticrun/audit.go
Top-level diagnoses are retained when Summary and RootCause are present. Analysis-completion events no longer include remediation risk attributes.
Align tests and fixtures
controller/agenticrun/*_test.go
Fixtures and assertions remove confidence and risk values. Tests validate the revised diagnosis requirements and audit events.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes making confidence and risk optional and removing them from LLM schemas.
Description check ✅ Passed The description directly explains the schema, prompt, validation, compatibility, and test changes in the pull request.
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.

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

@openshift-ci
openshift-ci Bot requested review from JoaoFula and blublinsky August 6, 2026 10:45

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
controller/agenticrun/schemas.go (1)

21-29: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Reject deprecated metadata before persistence.

The schemas omit confidence and risk, but additionalProperties is absent. The response parser still stores these fields in DiagnosisResult and RemediationPlan, and createAnalysisResult copies them to status. Add additionalProperties: false to the affected diagnosis and remediation-plan objects, and reject or clear these fields before persistence. Add tests for schema rejection and status absence.

🤖 Prompt for 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.

In `@controller/agenticrun/schemas.go` around lines 21 - 29, Reject deprecated
confidence and risk metadata before persistence: add additionalProperties: false
to the affected diagnosis and remediation-plan objects in
controller/agenticrun/schemas.go at lines 21-29, 39-46, 47-75, and 154-162, then
update the response parsing and createAnalysisResult flow to reject or clear
these fields before storing DiagnosisResult, RemediationPlan, or status values.
Extend controller/agenticrun/schemas_test.go lines 394-398 with schema-rejection
and status-absence tests.
🤖 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/templates/analysis_query.tmpl`:
- Line 46: Replace the “Reversibility assessment.” template instruction with the
imperative “Assess reversibility.” so the agent is directed to emit the
reversible field. Keep this as a single active-voice instruction in the analysis
query template.

---

Outside diff comments:
In `@controller/agenticrun/schemas.go`:
- Around line 21-29: Reject deprecated confidence and risk metadata before
persistence: add additionalProperties: false to the affected diagnosis and
remediation-plan objects in controller/agenticrun/schemas.go at lines 21-29,
39-46, 47-75, and 154-162, then update the response parsing and
createAnalysisResult flow to reject or clear these fields before storing
DiagnosisResult, RemediationPlan, or status values. Extend
controller/agenticrun/schemas_test.go lines 394-398 with schema-rejection and
status-absence tests.
🪄 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: Enterprise

Run ID: 8476210a-7a75-479f-a8dc-e62fca429781

📥 Commits

Reviewing files that changed from the base of the PR and between 303f265 and cc15208.

⛔ Files ignored due to path filters (1)
  • config/crd/bases/agentic.openshift.io_analysisresults.yaml is excluded by !config/crd/bases/**
📒 Files selected for processing (13)
  • api/v1alpha1/agenticrun_analysis_types.go
  • controller/agenticrun/agent.go
  • controller/agenticrun/handlers_test.go
  • controller/agenticrun/results.go
  • controller/agenticrun/results_test.go
  • controller/agenticrun/sandbox_agent.go
  • controller/agenticrun/sandbox_agent_test.go
  • controller/agenticrun/schemas.go
  • controller/agenticrun/schemas_test.go
  • controller/agenticrun/state_machine_test.go
  • controller/agenticrun/templates/analysis_query.tmpl
  • controller/agenticrun/templates/revision_context.tmpl
  • test/agent/main.go
🔗 Linked repositories identified

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

  • openshift/lightspeed-agentic-sandbox (manual)
💤 Files with no reviewable changes (1)
  • test/agent/main.go

Comment thread controller/agenticrun/templates/analysis_query.tmpl
@vimalk78
vimalk78 force-pushed the OLS-3811-remove-confidence-risk branch from cc15208 to ef8f4c6 Compare August 6, 2026 10:54
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai 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.

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 `@controller/agenticrun/audit_test.go`:
- Around line 434-435: Update the audit test covering EmitAnalysisCompleted to
explicitly assert that option.0.risk and option.1.risk are absent from the
emitted attributes, while preserving the existing required-attribute assertions
and expected map.
🪄 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: Enterprise

Run ID: 2ffff749-055d-412f-bae2-add1ada74fd6

📥 Commits

Reviewing files that changed from the base of the PR and between 303f265 and ef8f4c6.

⛔ Files ignored due to path filters (1)
  • config/crd/bases/agentic.openshift.io_analysisresults.yaml is excluded by !config/crd/bases/**
📒 Files selected for processing (15)
  • api/v1alpha1/agenticrun_analysis_types.go
  • controller/agenticrun/agent.go
  • controller/agenticrun/audit.go
  • controller/agenticrun/audit_test.go
  • controller/agenticrun/handlers_test.go
  • controller/agenticrun/results.go
  • controller/agenticrun/results_test.go
  • controller/agenticrun/sandbox_agent.go
  • controller/agenticrun/sandbox_agent_test.go
  • controller/agenticrun/schemas.go
  • controller/agenticrun/schemas_test.go
  • controller/agenticrun/state_machine_test.go
  • controller/agenticrun/templates/analysis_query.tmpl
  • controller/agenticrun/templates/revision_context.tmpl
  • test/agent/main.go
🔗 Linked repositories identified

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

  • openshift/lightspeed-agentic-sandbox (manual)
💤 Files with no reviewable changes (2)
  • test/agent/main.go
  • controller/agenticrun/audit.go
🚧 Files skipped from review as they are similar to previous changes (12)
  • controller/agenticrun/agent.go
  • controller/agenticrun/schemas_test.go
  • api/v1alpha1/agenticrun_analysis_types.go
  • controller/agenticrun/templates/revision_context.tmpl
  • controller/agenticrun/sandbox_agent.go
  • controller/agenticrun/results.go
  • controller/agenticrun/results_test.go
  • controller/agenticrun/schemas.go
  • controller/agenticrun/templates/analysis_query.tmpl
  • controller/agenticrun/handlers_test.go
  • controller/agenticrun/state_machine_test.go
  • controller/agenticrun/sandbox_agent_test.go

Comment thread controller/agenticrun/audit_test.go

@vimalk78 vimalk78 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adversarial Review: OLS-3811 — PASS (100/100)

Mode: jira | Round: 1

Adherence

12/12 acceptance criteria met.

Code Quality

Original review found 1 must-fix issue:

  • audit.go:368 unconditionally emitted option.N.risk OTEL attribute (always empty after this PR)Fixed
  • audit_test.go fixtures still set and asserted on Risk valuesFixed

All findings resolved. PR is ready for human review.

🤖 Reviewed with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Vimal Kumar <vimal78@gmail.com>
@vimalk78
vimalk78 force-pushed the OLS-3811-remove-confidence-risk branch from ef8f4c6 to 4b07712 Compare August 6, 2026 11:07
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown

@vimalk78: 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.

@vimalk78

vimalk78 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai approve

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@blublinsky

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 6, 2026
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: blublinsky

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 6, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit e81d6df into openshift:main Aug 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants