Skip to content

Fix revert-pr to amend commit message for UPSTREAM convention#336

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift-eng:mainfrom
petr-muller:fix-revert-pr-upstream-commit-message
Feb 26, 2026
Merged

Fix revert-pr to amend commit message for UPSTREAM convention#336
openshift-merge-bot[bot] merged 1 commit intoopenshift-eng:mainfrom
petr-muller:fix-revert-pr-upstream-commit-message

Conversation

@petr-muller
Copy link
Copy Markdown
Member

@petr-muller petr-muller commented Feb 26, 2026

Summary

  • The revert-pr skill creates revert commits with git revert -m1 --no-edit, producing a default Revert "..." message. In repos enforcing the UPSTREAM: <tag>: commit convention via commitchecker (e.g., openshift/operator-framework-operator-controller), this causes verify-commits CI to fail.
  • Adds an explicit step to amend the revert commit message with the appropriate UPSTREAM: <tag>: prefix when the convention is detected.
  • Emphasizes that commit convention detection must always be performed, fixes a stale step reference, and generalizes the documentation beyond openshift/kubernetes.

Context: openshift/operator-framework-operator-controller#647 failed verify-commits because the revert commit lacked the UPSTREAM: <carry>: prefix.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Enhanced revert-pr command documentation with clearer UPSTREAM convention guidance and expanded scope for upstream-patching repositories.
    • Improved revert-pr workflow with mandatory commit convention detection steps and automatic UPSTREAM commit message formatting.
  • Chores

    • Updated CI plugin to version 0.0.8.

@openshift-ci openshift-ci Bot requested review from rvanderp3 and stbenjam February 26, 2026 13:20
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 5a3c4c5 and 0d64154.

📒 Files selected for processing (5)
  • .claude-plugin/marketplace.json
  • docs/data.json
  • plugins/ci/.claude-plugin/plugin.json
  • plugins/ci/commands/revert-pr.md
  • plugins/ci/skills/revert-pr/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • plugins/ci/skills/revert-pr/SKILL.md
  • .claude-plugin/marketplace.json
  • plugins/ci/commands/revert-pr.md

Walkthrough

This PR updates documentation for the revert-pr skill and command with expanded guidance on UPSTREAM convention detection and commit message amendments. Version bumps from 0.0.7 to 0.0.8 across plugin manifests accompany these documentation changes.

Changes

Cohort / File(s) Summary
Documentation Updates
plugins/ci/commands/revert-pr.md, plugins/ci/skills/revert-pr/SKILL.md
Clarified UPSTREAM commit convention scope, added mandatory warning about verify-commits CI job failures, introduced "Amend Commit Message for UPSTREAM Convention" subsection with shell commands and examples, updated PR title and body templates to reflect simplified UPSTREAM convention format.
Version Bumps
.claude-plugin/marketplace.json, docs/data.json, plugins/ci/.claude-plugin/plugin.json
Incremented ci plugin version from 0.0.7 to 0.0.8 across all plugin manifest and metadata files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (2 errors)

Check name Status Explanation Resolution
No Assumed Git Remote Names ❌ Error Code uses hardcoded 'upstream' remote in lines 144, 167, 171, and 239 without discovering or creating it first. Add discovery logic to identify the upstream remote name or explicitly create 'upstream' remote if missing, then use the discovered name in all subsequent commands.
Git Push Safety Rules ❌ Error Pull request adds git push command at line 264 without explicit user confirmation requirement before execution. Modify Step 7 in SKILL.md to add explicit user confirmation language or conditional logic before the push command executes.
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding functionality to amend commit messages for the UPSTREAM convention in the revert-pr skill.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
No Real People Names In Style References ✅ Passed Pull request properly attributes the external Revertomatic tool and cites its template format without using real person names to describe desired qualities.
No Untrusted Mcp Servers ✅ Passed The PR contains only documentation updates and version bumps with no MCP server installations from untrusted sources or external package dependencies.
Ai-Helpers Overlap Detection ✅ Passed PR modifies existing revert-pr files with targeted UPSTREAM commit message handling enhancement; no duplicate functionality found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@stbenjam
Copy link
Copy Markdown
Member

/lgtm

Needs a plugin version bump

@openshift-ci openshift-ci Bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed lgtm Indicates that a PR is ready to be merged. labels Feb 26, 2026
@petr-muller petr-muller force-pushed the fix-revert-pr-upstream-commit-message branch from 8c6dcce to cbd21d1 Compare February 26, 2026 13:24
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

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

⚠️ Outside diff range comments (2)
plugins/ci/commands/revert-pr.md (1)

62-62: ⚠️ Potential issue | 🟡 Minor

Inconsistent UPSTREAM convention terminology.

Line 62 still uses the old specific format UPSTREAM: <carry>: while line 122 uses the generalized UPSTREAM: <tag>: format. For consistency with the PR's objective to generalize the documentation, this should use the same terminology.

📝 Proposed fix for consistency
-  - Detecting commit message conventions (e.g., `UPSTREAM: <carry>:` prefix)
+  - Detecting commit message conventions (e.g., `UPSTREAM: <tag>:` prefix)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/ci/commands/revert-pr.md` at line 62, Replace the legacy specific
term in the commit convention example: change the string "UPSTREAM: <carry>:" to
the generalized "UPSTREAM: <tag>:" in the revert-pr.md documentation (the commit
message conventions line currently using UPSTREAM: <carry>: should be updated to
match the other occurrence that uses UPSTREAM: <tag>: so both use the same
generalized terminology).
plugins/ci/skills/revert-pr/SKILL.md (1)

147-159: ⚠️ Potential issue | 🟡 Minor

Inconsistent PR title format between Step 6 and Step 9.

Line 153 shows the UPSTREAM revert format as:

UPSTREAM: <carry>: Revert "ORIGINAL_TITLE" because REASON

However, the actual PR title format defined in Step 9 (line 303) and the example (line 305) omit the because REASON clause:

{JIRA}: UPSTREAM: <tag>: Revert "{ORIGINAL_TITLE}"

The format in Step 6 should match the actual template used in Step 9 for consistency.

📝 Proposed fix to align Step 6 with Step 9
 - The revert commit message and PR title should use:
  • UPSTREAM: : Revert "ORIGINAL_TITLE" because REASON
  • UPSTREAM: : Revert "ORIGINAL_TITLE"
    For example:
    
  • UPSTREAM: : Revert "UPSTREAM: 12345: Fix kubelet crash" because it broke e2e-aws jobs
  • UPSTREAM: : Revert "UPSTREAM: 12345: Fix kubelet crash"

Note: The "because REASON" context belongs in the PR body's `{CONTEXT}` section, not in the title.

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @plugins/ci/skills/revert-pr/SKILL.md around lines 147 - 159, Update the
UPSTREAM revert guidance in Step 6 to match the PR title template in Step 9:
remove the trailing "because REASON" from the title format shown as UPSTREAM: <carry>: Revert "ORIGINAL_TITLE" and update the example UPSTREAM: <carry>: Revert "UPSTREAM: 12345: Fix kubelet crash" to match; ensure the note directs
authors to put the rationale in the PR body {CONTEXT} (not the title) so the
Step 6 format aligns with the {JIRA}: UPSTREAM: <tag>: Revert "{ORIGINAL_TITLE}" template in Step 9.


</details>

</blockquote></details>

</blockquote></details>
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/ci/skills/revert-pr/SKILL.md`:
- Line 296: Add language identifiers to the fenced code blocks containing the
revert heading examples: locate the code blocks with the text snippet `{JIRA}:
Revert #{PR_NUMBER} "{ORIGINAL_TITLE}"` and `{JIRA}: UPSTREAM: <tag>: Revert
"{ORIGINAL_TITLE}"` and change their fences from plain ``` to ```text so the
blocks are annotated for static analysis and readability.
- Line 197: Add language identifiers to the fenced code blocks mentioned (the
code blocks currently containing the revert lines at lines 197 and 201 in
SKILL.md) so they render with syntax highlighting; update each triple-backtick
fence from ``` to ```text and adjust the inner content to include the "UPSTREAM:
<tag>:" prefix where shown in the proposed fix, ensuring both code fences are
changed consistently (the block with Revert "Merge pull request `#638` from
author/branch" and the other block at line 201).
- Around line 179-204: The sed command currently inserts the literal "<tag>";
capture the detected tag into a variable (e.g., upstream_tag) when you detect it
in Step 6 and then use that variable when building the amended message (replace
sed '1s/^/UPSTREAM: <tag>: /' with a shell-expanded form like sed
"1s/^/UPSTREAM: ${upstream_tag}: /" or prepend the prefix into amended_msg
before git commit --amend) so the actual tag value (carry/drop/number) is
inserted into the commit message.

---

Outside diff comments:
In `@plugins/ci/commands/revert-pr.md`:
- Line 62: Replace the legacy specific term in the commit convention example:
change the string "UPSTREAM: <carry>:" to the generalized "UPSTREAM: <tag>:" in
the revert-pr.md documentation (the commit message conventions line currently
using UPSTREAM: <carry>: should be updated to match the other occurrence that
uses UPSTREAM: <tag>: so both use the same generalized terminology).

In `@plugins/ci/skills/revert-pr/SKILL.md`:
- Around line 147-159: Update the UPSTREAM revert guidance in Step 6 to match
the PR title template in Step 9: remove the trailing "because REASON" from the
title format shown as `UPSTREAM: <carry>: Revert "ORIGINAL_TITLE"` and update
the example `UPSTREAM: <carry>: Revert "UPSTREAM: 12345: Fix kubelet crash"` to
match; ensure the note directs authors to put the rationale in the PR body
`{CONTEXT}` (not the title) so the Step 6 format aligns with the `{JIRA}:
UPSTREAM: <tag>: Revert "{ORIGINAL_TITLE}"` template in Step 9.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 6524bea and 114bf51.

📒 Files selected for processing (2)
  • plugins/ci/commands/revert-pr.md
  • plugins/ci/skills/revert-pr/SKILL.md

Comment thread plugins/ci/skills/revert-pr/SKILL.md
Comment thread plugins/ci/skills/revert-pr/SKILL.md Outdated
```

This transforms the commit message from:
```
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.

⚠️ Potential issue | 🟡 Minor

Add language identifiers to code blocks.

The fenced code blocks on lines 197 and 201 should have language identifiers for proper syntax highlighting and better readability.

📝 Proposed fix
 This transforms the commit message from:
-```
+```text
 Revert "Merge pull request `#638` from author/branch"

to:
- +text
UPSTREAM: : Revert "Merge pull request #638 from author/branch"

Also applies to: 201-201

🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 197-197: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/ci/skills/revert-pr/SKILL.md` at line 197, Add language identifiers
to the fenced code blocks mentioned (the code blocks currently containing the
revert lines at lines 197 and 201 in SKILL.md) so they render with syntax
highlighting; update each triple-backtick fence from ``` to ```text and adjust
the inner content to include the "UPSTREAM: <tag>:" prefix where shown in the
proposed fix, ensuring both code fences are changed consistently (the block with
Revert "Merge pull request `#638` from author/branch" and the other block at line
201).

Comment thread plugins/ci/skills/revert-pr/SKILL.md Outdated
@petr-muller petr-muller force-pushed the fix-revert-pr-upstream-commit-message branch from cbd21d1 to 5a3c4c5 Compare February 26, 2026 13:25
The revert-pr skill creates the revert commit with `git revert -m1
--no-edit`, which produces a default `Revert "..."` message. In repos
that enforce the `UPSTREAM: <tag>:` commit message convention via a
commitchecker CI job, this causes verify-commits to fail.

Add an explicit step to amend the revert commit message with the
appropriate `UPSTREAM: <tag>:` prefix when the convention is detected.
Also emphasize that convention detection must always be performed, fix
a stale step reference, and generalize the documentation beyond
openshift/kubernetes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@petr-muller petr-muller force-pushed the fix-revert-pr-upstream-commit-message branch from 5a3c4c5 to 0d64154 Compare February 26, 2026 13:29
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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/revert-pr/SKILL.md (1)

293-343: ⚠️ Potential issue | 🟠 Major

PR title instructions and command are currently inconsistent.

Lines 293-306 define a convention-dependent title, but Line 341 still hardcodes the standard non-UPSTREAM format. This can generate incorrect titles for UPSTREAM repos.

🛠️ Proposed fix
+if [ -n "$upstream_tag" ]; then
+  pr_title_rendered="$jira: UPSTREAM: <${upstream_tag}>: Revert \"$pr_title\""
+else
+  pr_title_rendered="$jira: Revert #$pr_number \"$pr_title\""
+fi
+
 gh pr create \
   --repo "$owner/$repo" \
   --base "$base_branch" \
   --head "$gh_user:$revert_branch" \
-  --title "$jira: Revert #$pr_number \"$pr_title\"" \
+  --title "$pr_title_rendered" \
   --body "$rendered_body"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/ci/skills/revert-pr/SKILL.md` around lines 293 - 343, The PR title
guidance and the gh pr create invocation are inconsistent: the "PR Title Format"
section defines different title formats for standard vs UPSTREAM carry
repositories but the gh pr create command still hardcodes the standard format
via --title "$jira: Revert #$pr_number \"$pr_title\"". Fix by computing the
correct title beforehand (e.g., build a $title or $rendered_title variable based
on the commit-convention detected in Step 6) and then pass that variable to gh
pr create (replace --title "$jira: Revert #$pr_number \"$pr_title\"" with
--title "$title"); ensure the UPSTREAM branch path uses the UPSTREAM template
with <tag> when constructing $title.
♻️ Duplicate comments (2)
plugins/ci/skills/revert-pr/SKILL.md (2)

197-203: ⚠️ Potential issue | 🟡 Minor

Add language identifiers to these fenced blocks.

Lines 197 and 201 should use language-tagged fences (e.g., text) to satisfy MD040 and keep rendering consistent.

📝 Proposed fix
-```
+```text
 Revert "Merge pull request `#638` from author/branch"

to:
- +text
UPSTREAM: : Revert "Merge pull request #638 from author/branch"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/ci/skills/revert-pr/SKILL.md` around lines 197 - 203, Add language
identifiers (e.g., text) to the two fenced code blocks that contain the revert
lines in SKILL.md so they satisfy MD040 and render consistently: locate the
fenced blocks that wrap `Revert "Merge pull request `#638` from author/branch"`
and `UPSTREAM: <tag>: Revert "Merge pull request `#638` from author/branch"` (the
blocks around those exact strings) and change the opening backticks to include a
language tag (for example, ```text) for both blocks.

179-194: ⚠️ Potential issue | 🔴 Critical

Use the detected UPSTREAM tag variable, not a literal <tag>.

Line 190 prepends a literal placeholder, so the amended commit message still won’t match the repository convention. Capture the detected tag in Step 6 and interpolate it in Step 7.

🔧 Proposed fix
 Store the detected convention for use in Steps 7 and 9.
+```bash
+# Example: set during Step 6 detection
+upstream_tag="carry"
+```
@@
 # Get the current commit message
 current_msg=$(git log -1 --format=%B)
 
 # Prepend the UPSTREAM: <tag>: prefix to the first line
-amended_msg=$(echo "$current_msg" | sed '1s/^/UPSTREAM: <tag>: /')
+amended_msg=$(echo "$current_msg" | sed "1s/^/UPSTREAM: <${upstream_tag}>: /")
#!/bin/bash
# Verify the docs do not still use a literal placeholder in the sed replacement.
rg -n 'sed .*UPSTREAM: <tag>:' plugins/ci/skills/revert-pr/SKILL.md

# Verify a stored tag variable is documented for reuse across steps.
rg -n 'upstream_tag|detected.*tag' plugins/ci/skills/revert-pr/SKILL.md

Expected result:

  • First command: no matches after fix.
  • Second command: at least one match in Step 6/Step 7 flow.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/ci/skills/revert-pr/SKILL.md` around lines 179 - 194, The sed
replacement in Step 7 currently inserts the literal placeholder "<tag>"; capture
the detected tag in Step 6 into a variable (e.g., upstream_tag) and interpolate
that variable when building amended_msg so the commit message becomes "UPSTREAM:
<carry>:" (or other detected tag) instead of "UPSTREAM: <tag>:"; update the
example to show upstream_tag being set during detection and change amended_msg
to use double-quoted sed invocation that expands ${upstream_tag} (referencing
upstream_tag and amended_msg) so the amend step uses the correct, detected tag.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@plugins/ci/skills/revert-pr/SKILL.md`:
- Around line 293-343: The PR title guidance and the gh pr create invocation are
inconsistent: the "PR Title Format" section defines different title formats for
standard vs UPSTREAM carry repositories but the gh pr create command still
hardcodes the standard format via --title "$jira: Revert #$pr_number
\"$pr_title\"". Fix by computing the correct title beforehand (e.g., build a
$title or $rendered_title variable based on the commit-convention detected in
Step 6) and then pass that variable to gh pr create (replace --title "$jira:
Revert #$pr_number \"$pr_title\"" with --title "$title"); ensure the UPSTREAM
branch path uses the UPSTREAM template with <tag> when constructing $title.

---

Duplicate comments:
In `@plugins/ci/skills/revert-pr/SKILL.md`:
- Around line 197-203: Add language identifiers (e.g., text) to the two fenced
code blocks that contain the revert lines in SKILL.md so they satisfy MD040 and
render consistently: locate the fenced blocks that wrap `Revert "Merge pull
request `#638` from author/branch"` and `UPSTREAM: <tag>: Revert "Merge pull
request `#638` from author/branch"` (the blocks around those exact strings) and
change the opening backticks to include a language tag (for example, ```text)
for both blocks.
- Around line 179-194: The sed replacement in Step 7 currently inserts the
literal placeholder "<tag>"; capture the detected tag in Step 6 into a variable
(e.g., upstream_tag) and interpolate that variable when building amended_msg so
the commit message becomes "UPSTREAM: <carry>:" (or other detected tag) instead
of "UPSTREAM: <tag>:"; update the example to show upstream_tag being set during
detection and change amended_msg to use double-quoted sed invocation that
expands ${upstream_tag} (referencing upstream_tag and amended_msg) so the amend
step uses the correct, detected tag.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 114bf51 and 5a3c4c5.

📒 Files selected for processing (6)
  • .claude-plugin/marketplace.json
  • docs/data.json
  • plugins/ci/.claude-plugin/plugin.json
  • plugins/ci/commands/revert-pr.md
  • plugins/ci/skills/revert-pr/SKILL.md
  • plugins/testing/commands/mutation-test.md
✅ Files skipped from review due to trivial changes (1)
  • docs/data.json

@tmshort
Copy link
Copy Markdown

tmshort commented Feb 26, 2026

Thank you...

@stbenjam
Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Feb 26, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: petr-muller, 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-merge-bot openshift-merge-bot Bot merged commit 76ecb6a into openshift-eng:main Feb 26, 2026
5 checks passed
@petr-muller petr-muller deleted the fix-revert-pr-upstream-commit-message branch February 26, 2026 15:20
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.

3 participants