Skip to content

agents: add determine-affected-versions skill#10341

Open
rleungx wants to merge 1 commit intotikv:masterfrom
rleungx:skill/determine-affected-versions
Open

agents: add determine-affected-versions skill#10341
rleungx wants to merge 1 commit intotikv:masterfrom
rleungx:skill/determine-affected-versions

Conversation

@rleungx
Copy link
Copy Markdown
Member

@rleungx rleungx commented Mar 12, 2026

What problem does this PR solve?

Issue Number: ref #10159

What is changed and how does it work?

Add a new determine-affected-versions skill under .agents/skills.

The skill starts from linked fix PRs and existing may-affects labels,
traces the bug-introducing change, and decides which tentative versions
should become affects labels or be removed. It also requires leaving an
issue comment that explains the evidence used for the triage result.

Register the new skill in AGENTS.md so it is discoverable in the
repository skill list.

Check List

Tests

  • No code

Release note

None.

Summary by CodeRabbit

  • Documentation
    • Added comprehensive documentation for the determine-affected-versions skill: a multi‑phase workflow to infer affected product release lines from bug reports and linked fixes, including guidance for validating tentative version labels, producing evidence-rich conclusions, and recommended comment/labeling wording.
    • Updated agent index to list the new skill and its prerequisites.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue 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 12, 2026
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot bot commented Mar 12, 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 siddontang 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 the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 12, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 12, 2026

📝 Walkthrough

Walkthrough

New documentation adds a multi-phase "determine-affected-versions" skill that derives affected PD release lines from a bug issue by resolving candidate versions (may-affects-* and linked fix PRs), finding the bug-introducing change, validating containment, and producing label updates plus an evidence-rich comment.

Changes

Cohort / File(s) Summary
New Skill Documentation
.agents/skills/determine-affected-versions/SKILL.md
Adds full specification for the determine-affected-versions skill: five-phase workflow, git/GH CLI commands, containment/path rules, evidence-driven output format, comment templates, edge-case handling, and policy references.
Agent Registry
AGENTS.md
Registers the new determine-affected-versions skill with purpose, prerequisites (gh auth), and docs link.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Agent as Agent (skill)
participant GH as GitHub (issues/PRs)
participant Repo as Git Repo
participant CLI as gh / git CLI
Agent->>GH: Fetch issue (labels, linked PRs)
Agent->>CLI: Clone repo / checkout candidate branches
CLI->>Repo: Read diffs / blame / commits
Agent->>Repo: Identify introducing change (bisection/heuristics)
Agent->>GH: Validate may-affects-* containment vs introducing change
Agent->>GH: Post comment with evidence and update labels

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • JmPotato
  • okJiang
  • liyishuai

Poem

🐰 I hop through commits and linked PR lines,
Tracing the change where the bug first shines,
Labels I sort, evidence I bring,
A little rabbit that helps releases sing,
Hooray for clear traces and tidy signs!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'agents: add determine-affected-versions skill' directly and clearly describes the main change—adding a new skill to the agents framework.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description addresses the template requirements with issue reference, commit message, and appropriate checklist selections, though some contextual details about the skill's purpose could be more explicit.

✏️ 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
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@rleungx rleungx force-pushed the skill/determine-affected-versions branch from 0cd419b to e6b56a9 Compare March 13, 2026 02:21
Copy link
Copy Markdown

@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/determine-affected-versions/SKILL.md (3)

16-24: Consider consolidating the redundant gh commands.

The first command (lines 16-18) fetches the issue without labels, while the second command (lines 22-24) includes labels. Since the second command provides a superset of the information, you could simplify this section by showing only the comprehensive command with labels.

📝 Streamlined version
-Fetch the issue:
-
-```bash
-gh issue view <issue> --repo tikv/pd --json number,title,url,closedByPullRequestsReferences
-```
-
-Fetch the issue with labels as well:
+Fetch the issue with labels:
 
 ```bash
 gh issue view <issue> --repo tikv/pd --json number,title,url,labels,closedByPullRequestsReferences
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/skills/determine-affected-versions/SKILL.md around lines 16 - 24,
Remove the redundant gh command that fetches the issue without labels and keep
only the comprehensive command that includes labels (the line with gh issue view
<issue> --repo tikv/pd --json
number,title,url,labels,closedByPullRequestsReferences); update the surrounding
prose to say "Fetch the issue with labels:" (or similar) so the example is not
duplicated and delete the earlier block containing gh issue view ...
number,title,url,closedByPullRequestsReferences.

186-187: Consider varying sentence structure for better readability.

Three consecutive constraint bullets begin with "When", which slightly impacts readability. Consider varying the sentence structure.

✍️ Alternative wording
-- When a candidate version is confirmed affected, replace `may-affects-*` with `affects-*`.
-- When a candidate version is confirmed not affected, remove `may-affects-*`.
-- When the result is inconclusive, keep `may-affects-*` and state the uncertainty in the comment.
+- If a candidate version is confirmed affected, replace `may-affects-*` with `affects-*`.
+- Remove `may-affects-*` for versions confirmed not affected.
+- For inconclusive results, keep `may-affects-*` and state the uncertainty in the comment.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/skills/determine-affected-versions/SKILL.md around lines 186 - 187,
The three consecutive constraint bullets that start with "When" (e.g., "When a
candidate version is confirmed not affected, remove `may-affects-*`." and "When
the result is inconclusive, keep `may-affects-*` and state the uncertainty in
the comment.") should be rephrased to vary sentence openings for readability;
change one or more to an imperative or conditional form such as "Remove
`may-affects-*` if a candidate version is confirmed not affected." and "If the
result is inconclusive, retain `may-affects-*` and explain the uncertainty in
the comment." Update the third similar bullet to start differently (e.g.,
"Retain..." or "If...") so all three don't begin with "When".

81-81: Clarify the placeholder syntax in the gh api example.

The ...?... placeholder syntax might be unclear. Consider using more explicit placeholders or providing a concrete example.

📝 Clearer placeholder syntax
-   - If the branch is not fetched locally, use `gh api repos/tikv/pd/contents/...?...ref=<branch>`.
+   - If the branch is not fetched locally, use `gh api repos/tikv/pd/contents/<path>?ref=<branch>`.

Or provide a concrete example:

-   - If the branch is not fetched locally, use `gh api repos/tikv/pd/contents/...?...ref=<branch>`.
+   - If the branch is not fetched locally, use `gh api repos/tikv/pd/contents/server/config/config.go?ref=release-7.5`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/skills/determine-affected-versions/SKILL.md at line 81, Replace the
ambiguous `gh api repos/tikv/pd/contents/...?...ref=<branch>` placeholder in
SKILL.md with clearer placeholder syntax or a concrete example; specifically
update the sentence that currently contains the string `gh api
repos/tikv/pd/contents/...?...ref=<branch>` to use an explicit path and query
format such as `gh api repos/tikv/pd/contents/<path>?ref=<branch>` or show a
concrete example (e.g., `gh api repos/tikv/pd/contents/go.mod?ref=release-6.0`)
so readers understand where to put the file path and branch name.
🤖 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/determine-affected-versions/SKILL.md:
- Around line 16-24: Remove the redundant gh command that fetches the issue
without labels and keep only the comprehensive command that includes labels (the
line with gh issue view <issue> --repo tikv/pd --json
number,title,url,labels,closedByPullRequestsReferences); update the surrounding
prose to say "Fetch the issue with labels:" (or similar) so the example is not
duplicated and delete the earlier block containing gh issue view ...
number,title,url,closedByPullRequestsReferences.
- Around line 186-187: The three consecutive constraint bullets that start with
"When" (e.g., "When a candidate version is confirmed not affected, remove
`may-affects-*`." and "When the result is inconclusive, keep `may-affects-*` and
state the uncertainty in the comment.") should be rephrased to vary sentence
openings for readability; change one or more to an imperative or conditional
form such as "Remove `may-affects-*` if a candidate version is confirmed not
affected." and "If the result is inconclusive, retain `may-affects-*` and
explain the uncertainty in the comment." Update the third similar bullet to
start differently (e.g., "Retain..." or "If...") so all three don't begin with
"When".
- Line 81: Replace the ambiguous `gh api
repos/tikv/pd/contents/...?...ref=<branch>` placeholder in SKILL.md with clearer
placeholder syntax or a concrete example; specifically update the sentence that
currently contains the string `gh api
repos/tikv/pd/contents/...?...ref=<branch>` to use an explicit path and query
format such as `gh api repos/tikv/pd/contents/<path>?ref=<branch>` or show a
concrete example (e.g., `gh api repos/tikv/pd/contents/go.mod?ref=release-6.0`)
so readers understand where to put the file path and branch name.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dc928b08-3ee7-491c-bcfd-35830d184a61

📥 Commits

Reviewing files that changed from the base of the PR and between 0cd419b and e6b56a9.

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

@rleungx
Copy link
Copy Markdown
Member Author

rleungx commented Mar 13, 2026

An example for #9776:

  - Candidate versions considered from historical `may-affects-*` labels: 6.5, 7.1, 7.5, 8.1, 8.5
  - Linked fix PR: #10100
  - The fix in #10100 cleans up the `schedulersUpdatingNotifier` lifecycle in `updateScheduler()` after primary switch.
  - The buggy logic was introduced by commit `e295e628f` in PR #7076 (`scheduling: sync schedulers from the API server`).
  - `release-7.5`, `release-8.1`, and `release-8.5` contain `e295e628f` and still have the same buggy notifier logic.
  - `release-6.5` and `release-7.1` do not contain this scheduling MCS code path, so they are not affected.
  - Based on the code path, the affected release lines are 7.5, 8.1, and 8.5.
  - The issue currently keeps the official label `affects-8.5`.

@rleungx
Copy link
Copy Markdown
Member Author

rleungx commented Mar 13, 2026

/retest

@rleungx rleungx requested review from JmPotato and okJiang March 13, 2026 03:00
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.85%. Comparing base (0059e6f) to head (e6b56a9).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10341      +/-   ##
==========================================
- Coverage   78.88%   78.85%   -0.03%     
==========================================
  Files         527      527              
  Lines       70920    70920              
==========================================
- Hits        55944    55924      -20     
- Misses      10978    10984       +6     
- Partials     3998     4012      +14     
Flag Coverage Δ
unittests 78.85% <ø> (-0.03%) ⬇️

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.

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

1 participant