Skip to content

*: add skill for cherry-pick PR repair#10313

Open
okJiang wants to merge 5 commits intotikv:masterfrom
okJiang:codex/add-pd-cherry-pick-skill
Open

*: add skill for cherry-pick PR repair#10313
okJiang wants to merge 5 commits intotikv:masterfrom
okJiang:codex/add-pd-cherry-pick-skill

Conversation

@okJiang
Copy link
Member

@okJiang okJiang commented Mar 9, 2026

What problem does this PR solve?

Issue Number: ref #10159

What is changed and how does it work?

This adds a reusable agent skill at .agents/skills/fix-cherry-pick-pr and registers it in AGENTS.md.

The skill documents a repeatable workflow for repairing broken cherry-pick PRs in PD:

  • identify the source PR and cherry-pick PR pair
  • compare their final aggregate diffs rather than raw commit lists
  • preserve release-branch-only code while removing committed conflict markers
  • run failpoint-aware targeted verification before committing and pushing

The goal is to make cherry-pick PR repair and parity verification consistent for future maintenance work.

*: add skill for cherry-pick PR repair

Check List

Tests

Manual test steps:

  • inspect .agents/skills/fix-cherry-pick-pr/SKILL.md
  • confirm AGENTS.md links the new skill from the Agent Skills section
  • run the skill validator against .agents/skills/fix-cherry-pick-pr

Code changes

Side effects

Related changes

Release note

None.

Summary by CodeRabbit

  • Documentation
    • Added a new "fix-cherry-pick-pr" skill with a comprehensive step-by-step guide for repairing and verifying cherry-pick pull requests.
    • Guide includes identifying source PRs, comparing and normalizing diffs, branch preparation, conflict repair, verification workflows, commit/push instructions, example commands, and common pitfalls.

Signed-off-by: okjiang <819421878@qq.com>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. labels Mar 9, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Mar 9, 2026

[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 disksing for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

@ti-chi-bot ti-chi-bot bot added needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 9, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Added documentation: a new AGENTS.md entry registering the fix-cherry-pick-pr skill and a comprehensive skill guide at .agents/skills/fix-cherry-pick-pr/SKILL.md describing step-by-step procedures to repair and verify cherry-pick PRs.

Changes

Cohort / File(s) Summary
Agent Skills Registry
AGENTS.md
Added a new entry to the Agent Skills table documenting the fix-cherry-pick-pr skill with purpose, prerequisites, and link to the skill guide.
Cherry-Pick Fix Skill Guide
.agents/skills/fix-cherry-pick-pr/SKILL.md
New procedural guide containing end-to-end instructions: identify source PR, normalize and compare diffs, prepare working branch, repair conflicts, failpoint-based verification, commit/push workflows, reporting, examples, and common pitfalls.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • tikv/pd#10147 — Introduced the AGENTS.md file that this PR extends with a new skill entry.

Suggested labels

contribution, ok-to-test

Suggested reviewers

  • rleungx
  • liyishuai

Poem

🐰 I hopped through diffs both near and far,
Found the cherry-pick and fixed each scar,
Conflicts mended, tests set to run,
A tidy branch when the work was done,
Hooray — the guide helps everyone! 🌸

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title '*: add skill for cherry-pick PR repair' clearly and concisely summarizes the main change—adding a new agent skill for cherry-pick PR repair.
Description check ✅ Passed The description follows the template structure with all required sections: problem statement (Issue #10159), changes explanation, manual testing steps, and release notes. Properly formatted with commit message block.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.85%. Comparing base (c1f3166) to head (183c108).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10313      +/-   ##
==========================================
+ Coverage   78.78%   78.85%   +0.07%     
==========================================
  Files         527      527              
  Lines       70916    70920       +4     
==========================================
+ Hits        55870    55926      +56     
+ Misses      11026    10975      -51     
+ Partials     4020     4019       -1     
Flag Coverage Δ
unittests 78.85% <ø> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: okjiang <819421878@qq.com>
@okJiang okJiang changed the title *: add codex skill for cherry-pick PR repair *: add skill for cherry-pick PR repair Mar 9, 2026
Copy link

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

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

Inline comments:
In @.agents/skills/pd-fix-cherry-pick-pr/SKILL.md:
- Around line 35-39: The current pipeline in SKILL.md which runs "gh pr diff
<source-pr> --repo tikv/pd | rg '^[+-][^+-]' | sort" loses filename context and
can report false parity when identical line changes occur in different files;
update the recipe so file identity is preserved and comparisons are done
per-file (e.g., capture the per-file diff headers from the gh pr diff output and
group/compare +/− hunks for each filename, or produce a patch per file and diff
corresponding files) instead of globally sorting all added/removed lines; locate
the existing command in SKILL.md and replace it with a per-file-aware comparison
pipeline that retains the diff filenames and aligns changes by file.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: af4a820a-0de4-475f-96da-9dcfa721d5b2

📥 Commits

Reviewing files that changed from the base of the PR and between d553516 and 82dc65d.

📒 Files selected for processing (2)
  • .agents/skills/pd-fix-cherry-pick-pr/SKILL.md
  • AGENTS.md

okJiang added 2 commits March 9, 2026 12:03
Signed-off-by: okjiang <819421878@qq.com>
Signed-off-by: okjiang <819421878@qq.com>
Copy link

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

🧹 Nitpick comments (1)
.agents/skills/fix-cherry-pick-pr/SKILL.md (1)

95-99: Always run failpoint cleanup even on test failure.

This recipe only disables failpoints if the test command completes normally. If go test fails or is interrupted, the working tree can stay dirty and skew the later parity checks. Consider documenting it with a shell trap so cleanup is guaranteed.

Suggested doc update
-```bash
-make failpoint-enable
-go test ./server/cluster -run 'TestCheckCache|TestStoreLimitChangeRefreshLimiter' -count=1 -v -timeout=2m
-make failpoint-disable
-```
+```bash
+make failpoint-enable
+trap 'make failpoint-disable' EXIT
+go test ./server/cluster -run 'TestCheckCache|TestStoreLimitChangeRefreshLimiter' -count=1 -v -timeout=2m
+trap - EXIT
+make failpoint-disable
+```
Based on learnings, the skill should document its workflow and constraints clearly for reuse under `.agents/skills/**/*.md`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/skills/fix-cherry-pick-pr/SKILL.md around lines 95 - 99, Update the
SKILL documentation (in .agents/skills/fix-cherry-pick-pr/SKILL.md) to ensure
failpoint cleanup always runs by wrapping the test invocation with a shell trap
that calls make failpoint-disable on EXIT, and explicitly reset/remove the trap
after tests complete; also add a short section describing the workflow and
constraints (why failpoints must be disabled, when to run the recipe, and
expected repo state) so future users follow the guaranteed-cleanup pattern.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.agents/skills/fix-cherry-pick-pr/SKILL.md:
- Around line 95-99: Update the SKILL documentation (in
.agents/skills/fix-cherry-pick-pr/SKILL.md) to ensure failpoint cleanup always
runs by wrapping the test invocation with a shell trap that calls make
failpoint-disable on EXIT, and explicitly reset/remove the trap after tests
complete; also add a short section describing the workflow and constraints (why
failpoints must be disabled, when to run the recipe, and expected repo state) so
future users follow the guaranteed-cleanup pattern.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9e82a671-f45c-40a1-912b-58569b067ce6

📥 Commits

Reviewing files that changed from the base of the PR and between bb3cdef and 9dffb72.

📒 Files selected for processing (2)
  • .agents/skills/fix-cherry-pick-pr/SKILL.md
  • AGENTS.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • AGENTS.md

@okJiang
Copy link
Member Author

okJiang commented Mar 9, 2026

/retest

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Mar 9, 2026

@okJiang: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-unit-test-next-gen-3 d553516 link true /test pull-unit-test-next-gen-3

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.


- Keep the current worktree clean before switching.
- Fetch the cherry-pick head branch from its actual remote, often `tichi` or `ti-chi-bot`.
- Create a local `codex/...` branch that tracks the cherry-pick head.
Copy link
Member

Choose a reason for hiding this comment

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

Codex-specific logic; consider changing it.


```bash
git fetch tichi cherry-pick-10131-to-release-8.5
git switch -c codex/pr-10301-fix-conflict-markers --track tichi/cherry-pick-10131-to-release-8.5
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

git commit -s -m 'storelimit: resolve cherry-pick markers in #10301'
```

- Push back to the cherry-pick head branch if you have permission.
Copy link
Member

Choose a reason for hiding this comment

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

In the previous requirement, we actually created a separate local branch to track the actual cherry-pick branch. Here, the phrasing “push back” seems ambiguous and can easily cause the agent to deviate during execution—for example, pushing to a newly created branch on origin.

make failpoint-disable
```

- If you need broader signal, run `make basic-test`.
Copy link
Member

Choose a reason for hiding this comment

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

Running make basic-test does not cover the tests directory; if the related fix is in there, it seems running it doesn’t help.

@liyishuai
Copy link
Contributor

Maybe we should bypass the CI requirement for doc-only PR's like this.

@okJiang
Copy link
Member Author

okJiang commented Mar 10, 2026

/retest

@okJiang
Copy link
Member Author

okJiang commented Mar 10, 2026

/ok-to-retest

Signed-off-by: okjiang <819421878@qq.com>
Copy link

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

🧹 Nitpick comments (3)
.agents/skills/fix-cherry-pick-pr/SKILL.md (3)

63-72: Consider generalizing or documenting the Codex-specific remote names.

Lines 63 and 70 reference tichi and ti-chi-bot as the remotes for cherry-pick branches. These appear specific to PingCAP's Codex bot infrastructure. For broader applicability, consider either:

  1. Using more generic language: "Fetch the cherry-pick head branch from its bot remote (commonly tichi or ti-chi-bot in tikv/pd)"
  2. Adding a note that this workflow is specific to tikv/pd's automation setup

This would help future maintainers understand whether these remote names are tikv/pd-specific conventions or general guidance.

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

In @.agents/skills/fix-cherry-pick-pr/SKILL.md around lines 63 - 72, The doc
currently names specific bot remotes "tichi" and "ti-chi-bot" in the examples
and prose; update the SKILL.md text around the git fetch/git switch examples to
use generic wording (e.g., "bot remote (commonly `tichi`/`ti-chi-bot` in
tikv/pd)") or add a short note clarifying these are Codex/PingCAP-specific
remotes rather than universal names; update the example lines that show git
fetch and git switch to either use a placeholder like `<bot-remote>` or include
a parenthetical explaining the remote is example-specific so readers know to
replace it with their own remote.

101-102: Clarify testing coverage for the tests/ directory.

The guidance mentions running "the narrowest additional package or integration test target" but doesn't explicitly address a common pitfall: package-level test commands like make basic-test do not cover integration tests in the tests/ directory.

Consider adding an explicit note after line 101:

Suggested addition
 - If you need broader signal, run the narrowest additional package or integration test target that covers the touched files.
+- Note: package-level targets like `make basic-test` do not cover the top-level `tests/` directory. If the fix touches integration tests in `tests/`, run those tests explicitly (e.g., `make integration-test` or targeted tests in that directory).
 - If that extra verification fails in unrelated packages, separate that from the cherry-pick fix. Report the failing package and test name rather than attributing it to the cherry-pick automatically.

This helps prevent agents from claiming verification is complete when integration tests were never run.

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

In @.agents/skills/fix-cherry-pick-pr/SKILL.md around lines 101 - 102, Add an
explicit note after the paragraph that includes "If you need broader signal, run
the narrowest additional package or integration test target that covers the
touched files" clarifying that package-level test commands (for example "make
basic-test") do not execute integration tests located in the tests/ directory;
instruct agents to run the integration test targets explicitly (e.g., run the
tests under tests/ or the project's integration-test target) and to report
missing integration-test verification if they only ran package-level commands.

121-122: Provide explicit git push command to avoid ambiguity.

Line 121 says "Push HEAD back to the existing cherry-pick head branch" but doesn't show the exact command. Given the concern about agents potentially pushing to the wrong location, consider showing the explicit command:

Suggested clarification
-- Push `HEAD` back to the existing cherry-pick head branch if you have permission.
+- Push to the tracked upstream branch (the remote cherry-pick branch you fetched in step 3):
+
+```bash
+git push
+```
+
+This works because the local branch was created with `--track` pointing to the cherry-pick head. If push access is denied, the command will fail with a clear error.
+
 - If push fails and the user did not specify a fallback, stop and report the push error instead of inventing a new branch plan.

Since the local branch tracks the remote cherry-pick branch (per line 71), a plain git push will push to the correct upstream without ambiguity.

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

In @.agents/skills/fix-cherry-pick-pr/SKILL.md around lines 121 - 122, Replace
the vague instruction "Push `HEAD` back to the existing cherry-pick head branch"
with an explicit instruction to run a simple push to the branch that the local
branch is tracking (i.e., use a plain git push relying on the earlier created
tracking branch), and keep the existing behavior that if that push fails and no
fallback was provided the agent must stop and report the push error instead of
inventing a new branch plan; reference the phrasing "Push `HEAD` back to the
existing cherry-pick head branch" and the note that the local branch was created
with --track so the plain push targets the correct remote.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.agents/skills/fix-cherry-pick-pr/SKILL.md:
- Around line 63-72: The doc currently names specific bot remotes "tichi" and
"ti-chi-bot" in the examples and prose; update the SKILL.md text around the git
fetch/git switch examples to use generic wording (e.g., "bot remote (commonly
`tichi`/`ti-chi-bot` in tikv/pd)") or add a short note clarifying these are
Codex/PingCAP-specific remotes rather than universal names; update the example
lines that show git fetch and git switch to either use a placeholder like
`<bot-remote>` or include a parenthetical explaining the remote is
example-specific so readers know to replace it with their own remote.
- Around line 101-102: Add an explicit note after the paragraph that includes
"If you need broader signal, run the narrowest additional package or integration
test target that covers the touched files" clarifying that package-level test
commands (for example "make basic-test") do not execute integration tests
located in the tests/ directory; instruct agents to run the integration test
targets explicitly (e.g., run the tests under tests/ or the project's
integration-test target) and to report missing integration-test verification if
they only ran package-level commands.
- Around line 121-122: Replace the vague instruction "Push `HEAD` back to the
existing cherry-pick head branch" with an explicit instruction to run a simple
push to the branch that the local branch is tracking (i.e., use a plain git push
relying on the earlier created tracking branch), and keep the existing behavior
that if that push fails and no fallback was provided the agent must stop and
report the push error instead of inventing a new branch plan; reference the
phrasing "Push `HEAD` back to the existing cherry-pick head branch" and the note
that the local branch was created with --track so the plain push targets the
correct remote.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d0ff8595-6909-48f8-ad17-17a938dbf044

📥 Commits

Reviewing files that changed from the base of the PR and between 9dffb72 and 183c108.

📒 Files selected for processing (1)
  • .agents/skills/fix-cherry-pick-pr/SKILL.md

@okJiang
Copy link
Member Author

okJiang commented Mar 10, 2026

/retest

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

Labels

dco-signoff: yes Indicates the PR's author has signed the dco. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants