diff --git a/.claude/skills/pr-workflow/SKILL.md b/.claude/skills/pr-workflow/SKILL.md index aafb71311e..841efd6a8d 100644 --- a/.claude/skills/pr-workflow/SKILL.md +++ b/.claude/skills/pr-workflow/SKILL.md @@ -48,6 +48,45 @@ 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" (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: + +```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..ac216a26a1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,8 +12,16 @@ 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, 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