From d2ae46ab618ac12cd44a4b853176d253053975e2 Mon Sep 17 00:00:00 2001 From: Debasis Mandal Date: Fri, 19 Jun 2026 16:39:56 +0000 Subject: [PATCH 1/4] docs: add fail-closed safeguard against PRs from amd-integration amd-integration is the PR base, never the head. Document a fail-closed flow: if on amd-integration with commits to ship, relocate them to a fresh topic branch, reset amd-integration to origin, then PR from the topic branch. Adds the procedure to the pr-workflow skill and a backstop to CLAUDE.md. Co-Authored-By: Claude Opus 4.7 --- .claude/skills/pr-workflow/SKILL.md | 35 +++++++++++++++++++++++++++++ CLAUDE.md | 9 ++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/.claude/skills/pr-workflow/SKILL.md b/.claude/skills/pr-workflow/SKILL.md index aafb71311e..14e843389d 100644 --- a/.claude/skills/pr-workflow/SKILL.md +++ b/.claude/skills/pr-workflow/SKILL.md @@ -48,6 +48,41 @@ gh repo set-default ROCm/flashinfer # pin gh base repo so it does not fall back If a remote pointing at `flashinfer-ai/flashinfer` exists, remove it: `git remote remove `. +## CRITICAL: never PR from `amd-integration` (fail-closed) + +`amd-integration` is the **base** branch — it must never be the **head** of a +PR, and must never be pushed to directly via a PR flow. Before pushing a branch +for a PR or running `gh pr create`, check the current branch: + +```bash +git branch --show-current # if this is "amd-integration", do NOT push/PR from it +``` + +If you are on `amd-integration` and have commits to ship, do NOT raise the PR +from it. Instead, relocate the commits to a fresh topic branch, restore +`amd-integration` to match the remote, then PR from the topic branch: + +```bash +# 1. Capture the local-only commits onto a new branch at current HEAD +git branch + +# 2. Move amd-integration back to the pristine remote state (no commits lost — +# they are preserved on ). Verify origin/amd-integration is +# fetched and up to date first. +git fetch origin amd-integration +git reset --hard origin/amd-integration + +# 3. Switch to the topic branch and proceed with the normal PR flow +git checkout +``` + +Only `git reset --hard` here because the commits are already safe on +`` (confirm with `git log ` before resetting). If +anything is ambiguous — uncommitted changes, unclear which commits are +local-only, the topic branch already exists — STOP and report rather than +reset. It is always better to fail to raise a PR than to push to or PR from +`amd-integration`. + ## GitHub CLI `gh pr edit` fails with a "Projects (classic) is being deprecated" GraphQL error on this repo. Use the REST API instead: diff --git a/CLAUDE.md b/CLAUDE.md index b39ba0ed44..a69daa13d9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,8 +12,13 @@ defaults the base to the fork parent, so always pass `--repo ROCm/flashinfer --base amd-integration` explicitly, and run `gh repo set-default --view` first — it MUST print `ROCm/flashinfer` or you abort. If the target owner cannot be positively confirmed as `ROCm`, do not create the PR; stop and report why. -Failing to raise a PR is always preferable to raising one against upstream. Full -procedure: `pr-workflow` skill. +Failing to raise a PR is always preferable to raising one against upstream. + +Also NEVER push to or raise a PR from the `amd-integration` branch itself — it +is the base, never the head. If you are on `amd-integration` with commits to +ship, move them to a fresh topic branch (`git branch `), reset +`amd-integration` to `origin/amd-integration`, then PR from the topic branch. +Full procedure: `pr-workflow` skill. ## Essential Commands From bd161fc828a6fa424a60f16ad5e7e005bd873761 Mon Sep 17 00:00:00 2001 From: Debasis Mandal Date: Fri, 19 Jun 2026 12:59:11 -0400 Subject: [PATCH 2/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Debasis Mandal --- CLAUDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index a69daa13d9..b8df65b3bf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,8 +16,8 @@ Failing to raise a PR is always preferable to raising one against upstream. Also NEVER push to or raise a PR from the `amd-integration` branch itself — it is the base, never the head. If you are on `amd-integration` with commits to -ship, move them to a fresh topic branch (`git branch `), reset -`amd-integration` to `origin/amd-integration`, then PR from the topic branch. +ship, preserve them on a fresh topic branch at the current HEAD (`git branch `), +reset `amd-integration` to `origin/amd-integration`, then PR from the topic branch. Full procedure: `pr-workflow` skill. ## Essential Commands From 9ddfaaaf6299d39f7f822399c1f86ac26591191d Mon Sep 17 00:00:00 2001 From: Debasis Mandal Date: Fri, 19 Jun 2026 12:59:53 -0400 Subject: [PATCH 3/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Debasis Mandal --- .claude/skills/pr-workflow/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.claude/skills/pr-workflow/SKILL.md b/.claude/skills/pr-workflow/SKILL.md index 14e843389d..1798867e19 100644 --- a/.claude/skills/pr-workflow/SKILL.md +++ b/.claude/skills/pr-workflow/SKILL.md @@ -55,7 +55,7 @@ PR, and must never be pushed to directly via a PR flow. Before pushing a branch for a PR or running `gh pr create`, check the current branch: ```bash -git branch --show-current # if this is "amd-integration", do NOT push/PR from it +git branch --show-current # if this is "amd-integration" (or empty/detached), do NOT push/PR from it ``` If you are on `amd-integration` and have commits to ship, do NOT raise the PR From e395facfdb3a0578af9ffdfa4f4133024d2effda Mon Sep 17 00:00:00 2001 From: Debasis Mandal Date: Fri, 19 Jun 2026 17:03:17 +0000 Subject: [PATCH 4/4] docs: address Copilot review on amd-integration safeguard Handle detached HEAD (empty git branch --show-current) as an abort condition, add the missing git fetch before reset in the CLAUDE.md backstop, and align the placeholder name () and "create a branch at HEAD" wording between CLAUDE.md and the pr-workflow skill. Co-Authored-By: Claude Opus 4.7 --- .claude/skills/pr-workflow/SKILL.md | 4 ++++ CLAUDE.md | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.claude/skills/pr-workflow/SKILL.md b/.claude/skills/pr-workflow/SKILL.md index 1798867e19..841efd6a8d 100644 --- a/.claude/skills/pr-workflow/SKILL.md +++ b/.claude/skills/pr-workflow/SKILL.md @@ -58,6 +58,10 @@ for a PR or running `gh pr create`, check the current branch: git branch --show-current # if this is "amd-integration" (or empty/detached), do NOT push/PR from it ``` +This command prints an **empty string** in a detached-HEAD state. Treat empty +output as an abort condition too — do NOT push/PR from a detached HEAD; STOP and +report so the user can check out a proper topic branch first. + If you are on `amd-integration` and have commits to ship, do NOT raise the PR from it. Instead, relocate the commits to a fresh topic branch, restore `amd-integration` to match the remote, then PR from the topic branch: diff --git a/CLAUDE.md b/CLAUDE.md index b8df65b3bf..ac216a26a1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,8 +16,11 @@ Failing to raise a PR is always preferable to raising one against upstream. Also NEVER push to or raise a PR from the `amd-integration` branch itself — it is the base, never the head. If you are on `amd-integration` with commits to -ship, preserve them on a fresh topic branch at the current HEAD (`git branch `), -reset `amd-integration` to `origin/amd-integration`, then PR from the topic branch. +ship, create a fresh topic branch at the current HEAD +(`git branch `), then `git fetch origin amd-integration && +git reset --hard origin/amd-integration` to restore `amd-integration` (the +commits stay safe on ``), and PR from ``. Treat a +detached HEAD (empty `git branch --show-current`) as an abort condition too. Full procedure: `pr-workflow` skill. ## Essential Commands