Skip to content

[wip] Fix payload analysis to detect merged reverts not yet in payload - #580

Closed
stbenjam wants to merge 1 commit into
openshift-eng:mainfrom
redhat-chai-bot:fix/detect-merged-reverts-not-in-payload
Closed

stbenjam wants to merge 1 commit into
openshift-eng:mainfrom
redhat-chai-bot:fix/detect-merged-reverts-not-in-payload

Conversation

@stbenjam

@stbenjam stbenjam commented Jun 26, 2026

Copy link
Copy Markdown
Member

The payload analysis skill's Step 6.3 previously only checked revert candidates (score >= 85) for existing revert PRs. This missed a critical scenario: when a breaking PR has already been reverted and the revert is merged, but hasn't been included in the current payload yet.

Changes:

  • Expand Step 6.3 to check ALL scored candidate PRs for existing reverts
  • Add logic to verify whether a merged revert appears in the current payload's PR list (summary.json → payloads[].prs[])
  • Add new "merged_not_in_payload" status and revert_in_payload field to the payload-results-yaml schema
  • Add "Merged Reverts Pending Inclusion" report section (Step 7.4b)
  • Add revert-pending line to executive summary
  • Update Read Candidates operation to exclude merged_not_in_payload
  • Bump CI plugin version to 0.0.55

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.

Summary by CodeRabbit

  • Documentation

    • Updated payload analysis guidance to better handle merged revert PRs that are not yet included in the current payload.
    • Added clearer reporting for pending reverts, including a new summary line and a dedicated report section.
    • Refreshed plugin documentation to reflect the latest version number.
  • Chores

    • Bumped the ci plugin version to 0.0.55.

The payload analysis skill's Step 6.3 previously only checked revert
candidates (score >= 85) for existing revert PRs. This missed a critical
scenario: when a breaking PR has already been reverted and the revert is
merged, but hasn't been included in the current payload yet.

Changes:
- Expand Step 6.3 to check ALL scored candidate PRs for existing reverts
- Add logic to verify whether a merged revert appears in the current
  payload's PR list (summary.json → payloads[].prs[])
- Add new "merged_not_in_payload" status and revert_in_payload field to
  the payload-results-yaml schema
- Add "Merged Reverts Pending Inclusion" report section (Step 7.4b)
- Add revert-pending line to executive summary
- Update Read Candidates operation to exclude merged_not_in_payload
- Bump CI plugin version to 0.0.55

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 26, 2026
@openshift-ci
openshift-ci Bot requested review from cblecker and mrunalp June 26, 2026 12:30
@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: stbenjam

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 Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Updates the ci plugin version metadata from 0.0.54 to 0.0.55 and revises payload-analysis and payload-results-yaml documentation to describe merged reverts not yet included in the current payload.

Changes

CI plugin version sync

Layer / File(s) Summary
Version bump
.claude-plugin/marketplace.json, docs/index.html, plugins/ci/.claude-plugin/plugin.json
ci plugin version changes from 0.0.54 to 0.0.55 in the marketplace manifest, embedded plugin data, and plugin manifest.

Payload revert reporting docs

Layer / File(s) Summary
Results YAML contract
plugins/ci/skills/payload-results-yaml/SKILL.md
candidates[].actions[] adds revert_in_payload, the revert status list includes merged_not_in_payload, and the examples and operation docs are updated to match.
Analysis and report output
plugins/ci/skills/payload-analysis/SKILL.md
Step 6.3 records merged reverts not yet in the payload, Step 7 adds the pending-revert summary, and the report adds section 7.4b for those candidates.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

lgtm

Suggested reviewers

  • bryan-cox
  • LuboTerifaj
🚥 Pre-merge checks | ✅ 10
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: payload analysis now detects merged reverts not yet included in the payload.
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.
No Real People Names In Style References ✅ Passed Touched prose uses only generic terms; no real-person style references or named examples appear in the changed lines.
No Assumed Git Remote Names ✅ Passed The PR only bumps plugin versions and adds payload-analysis docs; the new/changed ci entries contain no hardcoded git remote names.
Git Push Safety Rules ✅ Passed The PR only bumps versions and updates payload docs; the touched files contain no git push, force-push, or main/master push instructions.
No Untrusted Mcp Servers ✅ Passed Changed files only bump ci versions/docs; no new npx/claude mcp add/npm install patterns or MCP server deps were introduced.
Ai-Helpers Overlap Detection ✅ Passed Only other open payload PR is #579 with different functionality/path set; this PR adds unique revert-status/schema updates, not a duplicate skill.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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: 2

Caution

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

⚠️ Outside diff range comments (1)
plugins/ci/skills/payload-results-yaml/SKILL.md (1)

70-75: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Omit revert_in_payload from the staged example.

The field is documented as only being set for merged revert PRs, but this example shows it on an open/staged action. That makes the contract look valid on states that should not carry the field.

Suggested fix
       - type: "revert"
         status: "staged"
         revert_pr_url: "https://github.com/openshift/cno/pull/2038"
         revert_pr_state: "open"
-        revert_in_payload: false
         result_summary: "Revert PR opened and payload jobs triggered"
🤖 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 `@plugins/ci/skills/payload-results-yaml/SKILL.md` around lines 70 - 75, The
staged revert example in SKILL.md incorrectly includes revert_in_payload, which
should only appear for merged revert PRs. Update the example under the payload
results YAML documentation to remove that field from the staged revert entry,
keeping the rest of the revert_pr_url, revert_pr_state, and result_summary
example intact.
🤖 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 `@plugins/ci/skills/payload-analysis/SKILL.md`:
- Around line 351-366: Step 6.3 now marks some candidates as status
"merged_not_in_payload", but the later revert-candidate logic still treats them
as eligible for the >= 85 revert path. Update the scoring/reporting flow in
payload-analysis SKILL.md so the revert recommendation branch explicitly
excludes candidates with status "merged_not_in_payload"; use the existing status
handling around the Step 6.3 merged-revert check and the revert-candidate
decision path to ensure these PRs are reported as pending next payload, not
recommended for a duplicate revert.

In `@plugins/ci/skills/payload-results-yaml/SKILL.md`:
- Around line 217-221: The Read Candidates flow in the payload-results YAML
skill currently filters out only candidates with pre-existing revert actions in
the open/merged/merged_not_in_payload states, but it still allows candidates
already staged for revert to be returned. Update the filtering logic in the Read
Candidates section so it also excludes any candidate that has a staged revert
action, or more generally any existing revert action that should prevent
duplicate downstream processing. Use the candidate action handling and the
existing status checks in this same YAML spec as the place to make the change.

---

Outside diff comments:
In `@plugins/ci/skills/payload-results-yaml/SKILL.md`:
- Around line 70-75: The staged revert example in SKILL.md incorrectly includes
revert_in_payload, which should only appear for merged revert PRs. Update the
example under the payload results YAML documentation to remove that field from
the staged revert entry, keeping the rest of the revert_pr_url, revert_pr_state,
and result_summary example intact.
🪄 Autofix (Beta)

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: 8b3642a6-7fa5-4a64-a76f-c3cae1b6cdaf

📥 Commits

Reviewing files that changed from the base of the PR and between 8bdd8bb and 0107a2b.

📒 Files selected for processing (5)
  • .claude-plugin/marketplace.json
  • docs/index.html
  • plugins/ci/.claude-plugin/plugin.json
  • plugins/ci/skills/payload-analysis/SKILL.md
  • plugins/ci/skills/payload-results-yaml/SKILL.md

Comment on lines +351 to +366
#### 6.3: Check if Candidate PRs Were Already Reverted

For each revert candidate:
For **every scored candidate PR** (not just revert candidates with score >= 85), check whether a revert PR already exists:

```bash
gh pr list --repo <org>/<repo> --search "revert <pr_number>" --json number,title,url,state,mergedAt --limit 5
```

If a revert PR is found:
- **Merged**: Note when it merged relative to the payload. If after the payload was cut, the fix is expected in the next payload. Do not recommend reverting again.
- **Open**: Mention the existing revert PR and link to it.
- **Open**: Record the existing revert PR URL and link to it. For revert candidates (score >= 85), do not open a duplicate revert.
- **Closed (not merged)**: Ignore.
- **Merged**: Determine whether the merged revert has been **included in the current payload**. Check the target payload's PR list in `summary.json` → `payloads[0].prs[]` for a matching PR number and repository. Also check subsequent payloads in the chain (`payloads[1]`, `payloads[2]`, etc.) in case the revert landed in a later payload that was also rejected.
- **Revert in payload** (`revert_in_payload: true`): The revert is already included in this payload. The failure must have a different root cause, or the revert was insufficient. Note this and continue scoring — the revert did not fix the problem.
- **Revert NOT in payload** (`revert_in_payload: false`): The revert was merged after the payload was cut (or has not yet been picked up by the build system). Record this as `status: "merged_not_in_payload"`. Do **not** recommend opening a new revert for this candidate. Instead, surface this prominently in the report: the fix exists and is expected in the next payload build.

This check is critical for avoiding redundant work: when a revert has already been merged but simply hasn't been included in the current payload yet, the analysis should clearly communicate that the fix is pending rather than recommending a duplicate revert.

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Exclude merged_not_in_payload from the revert-recommendation path.

Step 6.3 records the new status, but this block still leaves the candidate eligible for the >= 85 revert-candidate path. Without an explicit exclusion later, the report can tell operators both to avoid opening a duplicate revert and to recommend a revert for the same PR.

Suggested fix
-For each candidate PR with a rubric score of **>= 85**, mark it as a **revert candidate**.
+For each candidate PR with a rubric score of **>= 85**, mark it as a **revert candidate**, unless Step 6.3 recorded `status: "merged_not_in_payload"` for that PR.
🧰 Tools
🪛 LanguageTool

[style] ~363-~363: Consider using a different verb for a more formal wording.
Context: ...d continue scoring — the revert did not fix the problem. - **Revert NOT in payloa...

(FIX_RESOLVE)

🪛 SkillSpector (2.2.3)

[error] 403: [P2] Hidden Instructions: Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Remediation: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.

(Prompt Injection (P2))


[error] 482: [P2] Hidden Instructions: Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Remediation: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.

(Prompt Injection (P2))


[warning] 68: [RA2] Session Persistence: Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Remediation: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.

(Rogue Agent (RA2))

🤖 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 `@plugins/ci/skills/payload-analysis/SKILL.md` around lines 351 - 366, Step 6.3
now marks some candidates as status "merged_not_in_payload", but the later
revert-candidate logic still treats them as eligible for the >= 85 revert path.
Update the scoring/reporting flow in payload-analysis SKILL.md so the revert
recommendation branch explicitly excludes candidates with status
"merged_not_in_payload"; use the existing status handling around the Step 6.3
merged-revert check and the revert-candidate decision path to ensure these PRs
are reported as pending next payload, not recommended for a duplicate revert.

Comment on lines +217 to +221
Write a new `payload-results-{tag}.yaml` with `metadata`, `failing_jobs`, `candidates`, and optionally `rhcos_suspects` populated. All failed blocking jobs are recorded in `failing_jobs`. Candidates with no pre-existing revert start with `actions: []`. If a pre-existing revert PR is discovered during analysis, append an action with `type: "revert"` and the appropriate status: `"open"` (revert PR is open), `"merged"` (revert PR merged and included in the current payload), or `"merged_not_in_payload"` (revert PR merged but not yet included in the current payload). When the status is `"merged"` or `"merged_not_in_payload"`, set `revert_in_payload` to `true` or `false` respectively. If RHCOS RPM suspects were identified, include them in `rhcos_suspects[]`.

### Read Candidates (used by `payload-revert`, `payload-experiment`)

Read the file. Filter candidates by `confidence_score` range. Exclude candidates that already have an action with `status` of `"open"` or `"merged"` (pre-existing revert). Return matching candidates. Use the top-level `failing_jobs[]` to look up full job details for each candidate's `failing_jobs` references.
Read the file. Filter candidates by `confidence_score` range. Exclude candidates that already have an action with `status` of `"open"`, `"merged"`, or `"merged_not_in_payload"` (pre-existing revert). Return matching candidates. Use the top-level `failing_jobs[]` to look up full job details for each candidate's `failing_jobs` references.

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Exclude staged revert actions here as well.

Read Candidates can still return a candidate that has already been staged for revert, which makes it eligible for duplicate processing by downstream revert/experiment commands. Add staged to the exclusion set, or filter more broadly by any existing revert action.

Suggested fix
-Exclude candidates that already have an action with status of "open", "merged", or "merged_not_in_payload" (pre-existing revert).
+Exclude candidates that already have an action with status of "open", "merged", "merged_not_in_payload", or "staged" (any revert already in flight or completed).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Write a new `payload-results-{tag}.yaml` with `metadata`, `failing_jobs`, `candidates`, and optionally `rhcos_suspects` populated. All failed blocking jobs are recorded in `failing_jobs`. Candidates with no pre-existing revert start with `actions: []`. If a pre-existing revert PR is discovered during analysis, append an action with `type: "revert"` and the appropriate status: `"open"` (revert PR is open), `"merged"` (revert PR merged and included in the current payload), or `"merged_not_in_payload"` (revert PR merged but not yet included in the current payload). When the status is `"merged"` or `"merged_not_in_payload"`, set `revert_in_payload` to `true` or `false` respectively. If RHCOS RPM suspects were identified, include them in `rhcos_suspects[]`.
### Read Candidates (used by `payload-revert`, `payload-experiment`)
Read the file. Filter candidates by `confidence_score` range. Exclude candidates that already have an action with `status` of `"open"` or `"merged"` (pre-existing revert). Return matching candidates. Use the top-level `failing_jobs[]` to look up full job details for each candidate's `failing_jobs` references.
Read the file. Filter candidates by `confidence_score` range. Exclude candidates that already have an action with `status` of `"open"`, `"merged"`, or `"merged_not_in_payload"` (pre-existing revert). Return matching candidates. Use the top-level `failing_jobs[]` to look up full job details for each candidate's `failing_jobs` references.
Write a new `payload-results-{tag}.yaml` with `metadata`, `failing_jobs`, `candidates`, and optionally `rhcos_suspects` populated. All failed blocking jobs are recorded in `failing_jobs`. Candidates with no pre-existing revert start with `actions: []`. If a pre-existing revert PR is discovered during analysis, append an action with `type: "revert"` and the appropriate status: `"open"` (revert PR is open), `"merged"` (revert PR merged and included in the current payload), or `"merged_not_in_payload"` (revert PR merged but not yet included in the current payload). When the status is `"merged"` or `"merged_not_in_payload"`, set `revert_in_payload` to `true` or `false` respectively. If RHCOS RPM suspects were identified, include them in `rhcos_suspects[]`.
### Read Candidates (used by `payload-revert`, `payload-experiment`)
Read the file. Filter candidates by `confidence_score` range. Exclude candidates that already have an action with status of `"open"`, `"merged"`, `"merged_not_in_payload"`, or `"staged"` (any revert already in flight or completed). Return matching candidates. Use the top-level `failing_jobs[]` to look up full job details for each candidate's `failing_jobs` references.
🤖 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 `@plugins/ci/skills/payload-results-yaml/SKILL.md` around lines 217 - 221, The
Read Candidates flow in the payload-results YAML skill currently filters out
only candidates with pre-existing revert actions in the
open/merged/merged_not_in_payload states, but it still allows candidates already
staged for revert to be returned. Update the filtering logic in the Read
Candidates section so it also excludes any candidate that has a staged revert
action, or more generally any existing revert action that should prevent
duplicate downstream processing. Use the candidate action handling and the
existing status checks in this same YAML spec as the place to make the change.

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 9, 2026
@openshift-ci

openshift-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

PR needs rebase.

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.

@stbenjam

Copy link
Copy Markdown
Member Author

Closing this — the payload-related plugins have been massively refactored since this was opened, so I don't think this change is needed anymore.

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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants