From 4c2f9688ce960a42641c6a4ce20783ace681f56d Mon Sep 17 00:00:00 2001 From: Debasis Mandal Date: Fri, 19 Jun 2026 16:20:26 +0000 Subject: [PATCH 1/2] docs: add fail-closed PR target safeguard for ROCm/flashinfer Guard against accidental PRs against the fork parent flashinfer-ai/flashinfer. Adds a mandatory gh repo set-default pre-flight and explicit --repo/--base requirements to the pr-workflow skill, plus an always-on backstop in CLAUDE.md. Co-Authored-By: Claude Opus 4.7 --- .claude/skills/pr-workflow/SKILL.md | 42 +++++++++++++++++++++++++++++ CLAUDE.md | 11 ++++++++ 2 files changed, 53 insertions(+) diff --git a/.claude/skills/pr-workflow/SKILL.md b/.claude/skills/pr-workflow/SKILL.md index 639ed082d7..aafb71311e 100644 --- a/.claude/skills/pr-workflow/SKILL.md +++ b/.claude/skills/pr-workflow/SKILL.md @@ -8,6 +8,46 @@ description: How to create and edit PRs on the ROCm/flashinfer GitHub repo (whic > The GitHub repo is `ROCm/flashinfer`; the Python package it publishes is > `amd-flashinfer`. All `gh` commands below target the GitHub repo. +## CRITICAL: PR target safeguard (fail-closed) + +`ROCm/flashinfer` is a **GitHub fork** of `flashinfer-ai/flashinfer` (the true +upstream). Because of this, `gh pr create` defaults the PR base to the +fork-parent `flashinfer-ai/flashinfer` unless explicitly overridden. **A PR must +NEVER be opened against `flashinfer-ai/flashinfer`.** + +All PRs go to **`ROCm/flashinfer`**, base branch **`amd-integration`**. + +**Before ANY `gh pr create`, run this pre-flight check and ABORT if it fails:** + +```bash +gh repo set-default --view # MUST print exactly: ROCm/flashinfer +``` + +If it prints anything else (or errors), STOP — do not create the PR. Report the +mismatch to the user instead. Never guess the target. + +**Always pass the target and base explicitly** — never rely on gh defaults: + +```bash +gh pr create --repo ROCm/flashinfer --base amd-integration \ + --title "" --body "$(cat /tmp/pr_body.md)" +``` + +If the resolved owner of `--repo` is ever `flashinfer-ai`, abort. It is always +better to fail to raise a PR and explain why than to raise one against upstream. + +### One-time setup after a fresh clone + +These are local config (not checked in) and must be redone per clone: + +```bash +git remote -v # origin should be ROCm/flashinfer; there must be NO flashinfer-ai remote +gh repo set-default ROCm/flashinfer # pin gh base repo so it does not fall back to the fork parent +``` + +If a remote pointing at `flashinfer-ai/flashinfer` exists, remove it: +`git remote remove <name>`. + ## GitHub CLI `gh pr edit` fails with a "Projects (classic) is being deprecated" GraphQL error on this repo. Use the REST API instead: @@ -22,6 +62,8 @@ gh api repos/ROCm/flashinfer/pulls/<number> --method PATCH --field body="$(cat / Ask the user to confirm before running `git push` or `gh pr create` — these publish to a shared repo and shouldn't be triggered without explicit consent. +Before any `gh pr create`, also complete the fail-closed PR target safeguard +above. ## PR Description diff --git a/CLAUDE.md b/CLAUDE.md index 71eb318777..dec3824aae 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,6 +4,17 @@ > The upstream CUDA repo at <https://github.com/flashinfer-ai/flashinfer> uses > different env vars, paths, and toolchains — its patterns don't apply here. +## CRITICAL: PR target + +All PRs go to **`ROCm/flashinfer`**, base branch **`amd-integration`** — NEVER +to `flashinfer-ai/flashinfer` (the fork parent / true upstream). `gh pr create` +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. + ## Essential Commands | Task | Command | From 5a732526ec558f0037d85734d7ed3ccab9b33dbd Mon Sep 17 00:00:00 2001 From: Debasis Mandal <Debasis.Mandal@amd.com> Date: Fri, 19 Jun 2026 12:23:41 -0400 Subject: [PATCH 2/2] 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 <Debasis.Mandal@amd.com> --- CLAUDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index dec3824aae..b39ba0ed44 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,8 +8,8 @@ All PRs go to **`ROCm/flashinfer`**, base branch **`amd-integration`** — NEVER to `flashinfer-ai/flashinfer` (the fork parent / true upstream). `gh pr create` -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 — +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