release-cherry-pick-missing-reverts

작성자: pytorch

pytorch/pytorch 메인에 적용되었지만, 리버트된 커밋이 이미 릴리스 브랜치(release/X.Y)에 포함되어 있어 해당 브랜치에는 없는 리버트를 찾습니다.

npx skills add https://github.com/pytorch/test-infra --skill release-cherry-pick-missing-reverts

Release: Cherry-pick missing reverts

When a commit ships in a release candidate (so it is on release/X.Y) and is later reverted on main, the revert does not automatically reach the release branch — the buggy commit is still present in release/X.Y. These are missing reverts: the revert must be cherry-picked onto the release branch.

This skill finds those missing reverts and opens one cherry-pick PR per revert against pytorch/pytorch:release/X.Y, each on its own branch in the user's fork. It never pushes to release/X.Y directly.

The detector is tools/analytics/github_analyze.py (run daily by the GitHub Analytics Daily workflow). It is the same script this skill lives next to in test-infra, but the cherry-picks operate on a pytorch/pytorch checkout.

Inputs

InputRequiredExampleNotes
Release branchyesrelease/2.13The branch to cherry-pick reverts onto.
Sourceone ofa GHA run URL, or "run the analyzer"Either a GitHub Analytics Daily run URL/ID whose log already has the analysis, or run the analyzer locally for fresh data.
pytorch/pytorch pathyes (for cherry-pick)~/pytorchA checkout with upstream → pytorch/pytorch and origin → the user's fork.
Fork remotedefaults to originoriginWhere the cherry-pick branches are pushed.
Tracker issueoptional186934The [vX.Y.Z] Release Tracker issue. When given, post one cherry-pick nomination comment per opened PR (see Step 4).

If the release branch was not supplied, ask for it before doing anything — do not guess. If a tracker issue is given, the matching release/X.Y should agree with the tracker's version (e.g. issue [v2.13.0] Release Tracker → release/2.13); confirm before posting comments.

When to use this skill

Use when the user asks to:

  • Find / list missing reverts for a release branch
  • Cherry-pick the reverts flagged by the analytics run to release/X.Y
  • Act on a GitHub Analytics Daily run that printed 🔴 WARNING: This is possibly a revert of a commit that was included in a release candidate

Background: what "missing revert" means and how it is flagged

analyze_reverts_missing_from_branch compares main against the release branch and, for every revert that is on main but not on the release branch, checks whether the reverted commit carries a release-candidate tag (v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+). Three outcomes per revert (the analyzer prints the status lines with two spaces after the emoji, e.g. 🔴 WARNING; match on the emoji, not the exact spacing):

  • 🔴 WARNING ... — the reverted commit carries an RC tag, so it may be in release/X.Y. Treat as a missing-revert candidate, but verify before acting (see caveat below).
  • ✅ DETECTED: The reverted commit ... was cherry-picked to <branch> — the revert is already on the release branch. Skip.
  • 🟢 STATUS: ... may not be needed — the reverted commit was never in the release branch. Skip.

Caveat — the WARNING is a heuristic, not a guarantee. The tag regex matches an RC tag from any release line, not just the target. For release/2.13 a commit that only ever shipped in a v2.12.0-rcN (and was never on release/2.13) is still flagged 🔴. So a 🔴 WARNING does not prove the reverted commit is on the target branch — Step 3 must confirm with git merge-base --is-ancestor before cherry-picking, or it may try to revert code that isn't there (empty/conflicting cherry-pick).

Each flagged entry prints, in order:

Reverted GitHub Commit: <reverted_sha>          # the bad commit still in release/X.Y
🏷️  Tags matching ... : v2.13.0-rc1 ...          # proof it shipped in an RC
Commit Hash: <revert_sha>                        # the revert commit on main -> cherry-pick THIS
Author / Date / Title: Revert "<orig title> (#<PR>)"
🔴  WARNING: ...

The value to cherry-pick is Commit Hash (the revert commit on main), not the reverted commit.

Step 1 — Get the list of missing reverts

Option A — from a referenced run (when the user points at a GitHub Analytics Daily run):

# Find the github-analyze job id for the run, then fetch its log.
gh api repos/pytorch/test-infra/actions/runs/<RUN_ID>/jobs \
  -q '.jobs[] | select(.name=="github-analyze") | .id'
gh api repos/pytorch/test-infra/actions/jobs/<JOB_ID>/logs > /tmp/ghanalyze.log

Option B — run the analyzer locally (preferred for fresh data; the CI log can be stale). From a pytorch/pytorch checkout with upstream → pytorch/pytorch:

git -C <pytorch> fetch upstream main release/X.Y --tags
python test-infra/tools/analytics/github_analyze.py \
  --repo-path <pytorch> --remote upstream \
  --branch release/X.Y --analyze-missing-reverts-from-branch | tee /tmp/ghanalyze.log

Step 2 — Parse the flagged reverts

Extract every entry whose status line contains the 🔴 (WARNING) emoji — match on the emoji rather than exact text/spacing, since the analyzer emits two spaces (🔴 WARNING). For each, capture:

  • revert_sha ← the Commit Hash: line (cherry-pick target)
  • reverted_sha ← the Reverted GitHub Commit: line
  • pr ← the #NNNN in the Title: line (the original PR that was reverted)
  • title ← the Title: text

A revert with ✅ DETECTED or 🟢 STATUS is not missing — skip it. Report the counts (flagged vs skipped) so nothing is silently dropped.

Reverts of Phabricator diffs print Reverted Phabricator Diff: instead of Reverted GitHub Commit:; the analyzer never resolves a GitHub SHA for them, so they can't get a 🔴 WARNING and won't appear here. They are out of scope for this skill (no GitHub commit to cherry-pick).

Step 3 — One cherry-pick PR per missing revert

Operate on the pytorch/pytorch checkout. For each flagged revert:

REL=release/X.Y
git -C <pytorch> fetch upstream "$REL" main --tags

# Confirm the reverted commit is actually on the target branch before reverting
# it (the 🔴 WARNING can fire on an RC tag from a different release line). If it
# is not an ancestor, skip and report "reverted commit not in <REL>".
git -C <pytorch> merge-base --is-ancestor <reverted_sha> "upstream/$REL" \
  || { echo "skip: <reverted_sha> not in $REL"; continue; }

BR="cherry-pick-revert-<PR>-${REL#release/}"     # e.g. cherry-pick-revert-185760-2.13
git -C <pytorch> checkout -B "$BR" "upstream/$REL"
git -C <pytorch> cherry-pick -x <revert_sha>
  • -x records (cherry picked from commit <revert_sha>) in the message.
  • On conflict: do not force-resolve blindly. Report the conflicting files for that revert, run git cherry-pick --abort, and leave it out of the PR batch (note it in the summary as "needs manual cherry-pick"). Continue with the others.

Push to the fork and open the PR against the release branch:

git -C <pytorch> push origin "$BR"
gh pr create --repo pytorch/pytorch --base "$REL" --head "<fork-owner>:$BR" \
  --title "[$REL] Revert \"<orig title> (#<PR>)\"" \
  --body "<see PR body below>"

Never push to release/X.Y itself, and never open the PR with --base main.

PR body

Cherry-pick of the main-branch revert <revert_sha> onto release/X.Y.

The reverted commit <reverted_sha> (#<PR>) shipped in a release candidate
(v X.Y.0-rcN) and is present in release/X.Y, but the revert only landed on
main. This cherry-picks the revert so release/X.Y matches main.

Detected by tools/analytics/github_analyze.py --analyze-missing-reverts-from-branch
(GitHub Analytics Daily). Cherry-pick (-x): (cherry picked from commit <revert_sha>).

This PR was authored with the assistance of an AI coding agent.

Step 4 — Nominate on the release tracker (if a tracker issue was given)

For each cherry-pick PR opened in Step 3, post one comment on the tracker issue in the tracker's standard nomination format. The landed trunk PR is the original PR that was reverted (the #<PR> from the revert title), and the release branch PR is the cherry-pick PR:

gh issue comment <tracker_issue> --repo pytorch/pytorch --body "Link to landed trunk PR (if applicable):
* https://github.com/pytorch/pytorch/pull/<PR>

Link to release branch PR:
* https://github.com/pytorch/pytorch/pull/<cherry_pick_PR>

Criteria Category:
* cherry-pick revert"

One comment per revert. Only comment for PRs actually opened in Step 3 — skip the ones that were skipped or hit a conflict. Like opening PRs, posting to the tracker is outward-facing: confirm first.

Step 5 — Summary

Report a table: PR, original title, revert_sha, and outcome — PR #<n> opened, skipped (already on <branch>), skipped (reverted commit not in <branch>), or conflict — needs manual cherry-pick. Include the new branch names, PR URLs, and (if a tracker issue was given) the tracker comment links.

Guardrails

  • Confirm before opening PRs or commenting. Creating multiple cherry-pick PRs and posting tracker comments are outward-facing actions — list what will be opened/posted and confirm first.
  • Never push to release/X.Y; only to fork branches, PRs target the release branch for review.
  • Skip non-missing reverts (✅ DETECTED / 🟢 STATUS).
  • Verify the reverted commit is on the target branch (git merge-base --is-ancestor) before cherry-picking — 🔴 WARNING can be a false positive for RC tags from another release line.
  • Stop on cherry-pick conflicts for that revert (abort + report); do not hand-resolve unless the user asks.
  • Requires gh authenticated for pytorch/pytorch and a pytorch checkout whose origin is the user's fork.

pytorch의 다른 스킬

zephyr
pytorch
임베디드 보드용 Zephyr RTOS 모듈로 ExecuTorch를 빌드하고 구성합니다. ET로 Zephyr 워크스페이스를 설정하거나 보드 지원(오버레이 등)을 추가할 때 사용합니다.
aoti-debug
pytorch
AOTInductor(AOTI) 오류 및 충돌을 디버깅합니다. AOTI 세그폴트, 장치 불일치 오류, 상수 로딩 실패 또는 런타임 오류가 발생할 때 사용하세요.
skill-writer
pytorch
Claude Code를 위한 잘 구조화된 Agent Skill 생성 가이드로, 모범 사례와 검증을 포함합니다. Skill의 전체 수명 주기(범위 설정, 파일 구조, YAML 프론트매터 검증, 콘텐츠 구성, 테스트 절차)를 다룹니다. 엄격한 명명 규칙(소문자, 하이픈, 최대 64자)과 설명 요구 사항(특정 트리거, 파일 유형, "무엇" 및 "언제" 절)을 적용합니다. 읽기 전용 Skill, 스크립트 기반 Skill, 다중 파일 Skill 등 일반적인 패턴에 대한 템플릿을 제공합니다.
triaging-issues
pytorch
GitHub 이슈를 분류하여 온콜 팀에 라우팅하고, 레이블을 적용하며, 질문을 종료합니다. 새로운 PyTorch 이슈를 처리하거나 이슈 분류를 요청받았을 때 사용하세요.
wheel-size-analyzer
pytorch
PyTorch nightly wheel 크기를 GitHub Actions 아티팩트 API를 사용하여 날짜 범위에 걸쳐 분석합니다. 바이너리 크기 변경 추적, wheel 크기 식별에 사용합니다…
release-go-live-binary-build-matrix
pytorch
tools/scripts/generate_binary_build_matrix.py를 PyTorch 릴리스가 라이브될 때 업데이트합니다. CURRENT_STABLE_VERSION을 새로운 안정 버전으로 올리고, 해당…
pr-review
pytorch
PyTorch 풀 리퀘스트의 코드 품질, 테스트 커버리지, 보안 및 하위 호환성을 검토합니다. PR을 검토할 때, 코드 변경 사항을 검토하도록 요청받았을 때 사용합니다.
qualcomm
pytorch
QNN(Qualcomm AI Engine Direct) 백엔드를 빌드, 테스트 또는 개발합니다. backends/qualcomm/에서 작업하거나 QNN을 빌드할 때 사용합니다(계속…).