Skip to content

Commit 890a33b

Browse files
authored
ci: keep only the automatic Claude PR review (#4384)
Removes the @claude comment/issue agent (claude job) and the @pr-claude comment trigger. The review now runs only when a PR from an owner, member, or collaborator is marked ready for review. Klaud and codeowner sign-off workflows are unchanged.
1 parent 12c6b3f commit 890a33b

1 file changed

Lines changed: 6 additions & 295 deletions

File tree

‎.github/workflows/claude.yml‎

Lines changed: 6 additions & 295 deletions
Original file line numberDiff line numberDiff line change
@@ -1,303 +1,21 @@
11
name: Claude Code
22

3-
# Distinct authorized comment requests must complete independently.
4-
on: # zizmor: ignore[concurrency-limits]
3+
on:
54
pull_request:
65
types: [ready_for_review]
7-
issue_comment: # zizmor: ignore[dangerous-triggers] both jobs gate on OWNER/MEMBER/COLLABORATOR before any secret is used
8-
types: [created]
9-
issues:
10-
types: [opened]
11-
pull_request_review_comment:
12-
types: [created]
136

147
permissions:
158
contents: read
169

1710
jobs:
18-
claude:
19-
name: claude
20-
# Only repository owners, organization members, and collaborators may start the
21-
# write-capable agent; bot accounts (CONTRIBUTOR/NONE) never pass this gate.
22-
if: |
23-
((github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') &&
24-
(contains(github.event.comment.body, '@claude') || contains(github.event.comment.body, '@Klaud-Cold')) &&
25-
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) ||
26-
(github.event_name == 'issues' &&
27-
(contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude') || contains(github.event.issue.body, '@Klaud-Cold') || contains(github.event.issue.title, '@Klaud-Cold')) &&
28-
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association))
29-
runs-on: ubuntu-latest
30-
permissions:
31-
contents: write # Let the authorized agent commit and push changes.
32-
pull-requests: write # Publish PR feedback.
33-
issues: write # Update comments, labels, and reactions.
34-
actions: read # Read workflow runs and artifacts.
35-
steps:
36-
- name: Checkout repository
37-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38-
with:
39-
fetch-depth: 0
40-
# Repository agent credential; the pinned action authorizes the triggering actor.
41-
token: ${{ secrets.AGENT_PAT }} # zizmor: ignore[secrets-outside-env]
42-
persist-credentials: false
43-
44-
- name: Set up uv
45-
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
46-
47-
- name: Install Claude Code 2.1.282
48-
id: claude_cli
49-
run: | # zizmor: ignore[adhoc-packages] Claude CLI and its native packages are pinned to 2.1.282
50-
npm install --prefix "$RUNNER_TEMP/claude-code" --no-audit --no-fund @anthropic-ai/claude-code@2.1.282
51-
claude_cli="$RUNNER_TEMP/claude-code/node_modules/.bin/claude"
52-
test "$("$claude_cli" --version)" = "2.1.282 (Claude Code)"
53-
echo "path=$claude_cli" >> "$GITHUB_OUTPUT"
54-
- name: Run Claude Code
55-
id: claude
56-
uses: anthropics/claude-code-action@9171db3e57d6a3140a37ddc2ba92788584e0ead6 # v1.0.234
57-
env:
58-
# Repository agent credential; the pinned action authorizes the triggering actor.
59-
GH_TOKEN: ${{ secrets.AGENT_PAT }} # zizmor: ignore[secrets-outside-env]
60-
# Repository agent credential; the pinned action authorizes the triggering actor.
61-
GITHUB_TOKEN: ${{ secrets.AGENT_PAT }} # zizmor: ignore[secrets-outside-env]
62-
BASH_DEFAULT_TIMEOUT_MS: "1800000"
63-
BASH_MAX_TIMEOUT_MS: "3600000"
64-
with:
65-
path_to_claude_code_executable: ${{ steps.claude_cli.outputs.path }}
66-
# Repository agent credential; the pinned action authorizes the triggering actor.
67-
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} # zizmor: ignore[secrets-outside-env]
68-
# Repository agent credential; the pinned action authorizes the triggering actor.
69-
github_token: ${{ secrets.AGENT_PAT }} # zizmor: ignore[secrets-outside-env]
70-
trigger_phrase: "${{ contains(github.event.comment.body || github.event.issue.body || github.event.issue.title || '', '@Klaud-Cold') && '@Klaud-Cold' || '@claude' }}"
71-
track_progress: true
72-
allowed_bots: ''
73-
additional_permissions: |
74-
actions: read
75-
settings: |
76-
{"fastMode": true}
77-
78-
claude_args: |
79-
--model 'claude-opus-5-5'
80-
--allowedTools "Write,Edit,Read,Glob,Grep,WebFetch,mcp__github__*,mcp__github_inline_comment__create_inline_comment,mcp__github_ci__*,Bash"
81-
prompt: |
82-
REPO: ${{ github.repository }}
83-
PR/ISSUE NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
84-
85-
You are an AI assistant for InferenceX.
86-
87-
**Workflow file modifications**: You CAN modify files in .github/workflows/ directory.
88-
89-
If you need to analyze benchmark results from a specific run, use:
90-
```bash
91-
gh run download <RUN_ID> --repo ${{ github.repository }} -n results_bmk -D ./results
92-
cat ./results/agg_bmk.json | python3 -m json.tool
93-
```
94-
95-
To find recent benchmark runs:
96-
```bash
97-
gh run list --repo ${{ github.repository }} --workflow e2e-tests.yml --limit 5
98-
```
99-
100-
You can analyze the json with:
101-
```bash
102-
python3 <<'EOF'\nimport json \nwith open('agg_bmk.json') as f: data = json.load(f) \n# Your analysis code here \nEOF
103-
```
104-
## E2E Tests
105-
To trigger e2e tests, use the `mcp__github__run_workflow` tool to directly dispatch the e2e-tests.yml workflow.
106-
107-
**Syntax:**
108-
```
109-
mcp__github__run_workflow(
110-
owner="SemiAnalysisAI",
111-
repo="InferenceX",
112-
workflow_id="e2e-tests.yml",
113-
ref="branch-name",
114-
inputs={
115-
"generate-cli-command": "generator-cli-args",
116-
"test-name": "Test description"
117-
}
118-
)
119-
```
120-
121-
The `generate-cli-command` input accepts arguments for `python -m infx.matrix.generate`. Usage: `python -m infx.matrix.generate` `[-h]` `{full-sweep,test-config}`
122-
123-
**Subcommand reference:**
124-
- `full-sweep`: Use this subcommand with filter flags like `--model-prefix`, `--framework`, `--precision`, `--runner-type`, `--min-conc`, `--max-conc`, `--seq-lens`. This is the primary subcommand for running benchmarks.
125-
- `test-config`: Use this subcommand ONLY when prompted to with 'test-config'. Uses the flags `--config-files` and `--config-keys`, does NOT accept any other arguments.
126-
127-
Examples:
128-
129-
**Filter by model prefix and Nvidia nodes:**
130-
```
131-
generate-cli-command: "full-sweep --config-files configs/nvidia-master.yaml --single-node --model-prefix dsr1"
132-
```
133-
134-
**Filter by framework and AMD nodes:**
135-
```
136-
generate-cli-command: "full-sweep --config-files configs/amd-master.yaml --single-node --framework sglang"
137-
```
138-
139-
**Filter by precision and runner type:**
140-
```
141-
generate-cli-command: "full-sweep --config-files configs/nvidia-master.yaml --single-node --precision fp8 --runner-type h200"
142-
```
143-
144-
**Specify concurrency and sequence length:**
145-
```
146-
generate-cli-command: "full-sweep --config-files configs/nvidia-master.yaml --single-node --model-prefix dsr1 --min-conc 4 --max-conc 4 --seq-lens 8k1k"
147-
```
148-
149-
**Test specific config keys (MUST USE `--conc`):**
150-
```
151-
generate-cli-command: "test-config --config-files configs/nvidia-master.yaml --config-keys dsr1-fp4-b200-sglang --conc 4"
152-
```
153-
154-
**IMPORTANT: Keep runs precise and efficient:**
155-
- Use `full-sweep` with filter flags to narrow down the benchmark scope - "full-sweep" does NOT mean running everything
156-
- When using `full-sweep`, you must use `--min-conc` and `--max-conc` together to specify a single concurrency value. Unless prompted otherwise, use `--min-conc 4 --max-conc 4`
157-
- For fixed-sequence runs, use `--seq-lens 8k1k`; 1k1k is retired for all models. Consult `inferencex-e2e/docs/MODELS.md` for model-specific scenario eligibility.
158-
- Use `test-config` ONLY when given specific config keys to test - Use `--config-files`, `--config-keys`, and `--conc` flags ONLY
159-
- Always filter by specific models, frameworks, precision, conc, or config keys when possible
160-
161-
## Monitor workflow execution
162-
```
163-
# Get workflow run details
164-
mcp__github__get_workflow_run(owner, repo, run_id)
165-
166-
# List jobs for the run
167-
mcp__github__list_workflow_jobs(owner, repo, run_id)
168-
169-
# Get logs for failed jobs
170-
mcp__github__get_job_logs(owner, repo, run_id=run_id, failed_only=true)
171-
```
172-
173-
**When to trigger e2e tests:**
174-
- When directly asked to run performance tests
175-
- When performance testing is needed
176-
- After reviewing code changes that might affect performance
177-
- For all runs, ensure they have links in the comment.
178-
179-
After triggering, monitor the workflow run using the returned run_id. Wait for completion using exponential backoff:
180-
- Start with `sleep 120` (2 minutes), then double the sleep time each iteration (4 min, 8 min) up to an max of 8 minutes per sleep before checking the status.
181-
- After each sleep, check the run status using `mcp__github__get_workflow_run`
182-
- If the run fails or errors, cancel it with `mcp__github__cancel_workflow_run`, then start a new run
183-
- Only wait for the final successful run to complete before analyzing benchmark results
184-
- Do NOT claim completion until the most recent job finishes and results are analyzed
185-
- If jobs cannot be run, say exactly what you could not run and why
186-
- **Important** Append an inferencex-e2e/perf-changelog.yaml entry when the change alters what any benchmark runs (see "Updating perf-changelog.yaml" below)
187-
188-
## Profiling (SGLang only)
189-
When asked to profile a config, dispatch the `profile.yml` workflow. **Only SGLang configs can be profiled** — the profiler uses SGLang's `/start_profile` and `/stop_profile` HTTP endpoints. Reject profiling requests for vLLM, TRT, or other frameworks.
190-
191-
**Syntax:**
192-
```
193-
mcp__github__run_workflow(
194-
owner="SemiAnalysisAI",
195-
repo="InferenceX",
196-
workflow_id="profile.yml",
197-
ref="main",
198-
inputs={
199-
"config-key": "<config-key-ending-in-sglang>",
200-
"config-file": "<configs/nvidia-master.yaml or amd-master.yaml>",
201-
"conc": "<concurrency>"
202-
}
203-
)
204-
```
205-
206-
**How to map a natural-language request to inputs:**
207-
The user will say something like "profile sglang b200 deepseek fp4 conc=4". Parse it as:
208-
- Model: resolve the requested model against the current active master configs and `inferencex-e2e/docs/MODELS.md`; for example, `dsr1` means DeepSeek-R1 and `qwen3.5` means Qwen3.5. Reject retired model/scenario requests and preserve documented exceptions.
209-
- Precision: "fp4" / "fp8" / "bf16"
210-
- Runner/hardware: "b200", "h200", "h100", "mi300x", "mi325x", "mi355x", etc.
211-
- Framework: must be "sglang" (reject if not)
212-
- Concurrency: "conc=N" → `"conc": "N"`. Default to `"64"` if not specified.
213-
214-
Construct the config-key as: `{model-prefix}-{precision}-{runner}-sglang`
215-
Choose config-file: NVIDIA runners (b200, h200, h100, gb200, gb300) → `nvidia-master.yaml`; AMD runners (mi300x, mi325x, mi355x) → `amd-master.yaml`
216-
217-
**Available SGLang config keys:**
218-
NVIDIA: `dsr1-fp4-b200-sglang`, `dsr1-fp8-b200-sglang`, `dsr1-fp8-h200-sglang`, `qwen3.5-fp8-b200-sglang`
219-
AMD: `dsr1-fp4-mi355x-sglang`, `dsr1-fp8-mi300x-sglang`, `dsr1-fp8-mi325x-sglang`, `dsr1-fp8-mi355x-sglang`, `qwen3.5-fp8-mi355x-sglang`
220-
221-
**Examples:**
222-
- "profile sglang b200 deepseek fp4 conc=4" → `config-key: dsr1-fp4-b200-sglang`, `config-file: configs/nvidia-master.yaml`, `conc: 4`
223-
- "profile sglang mi355x dsr1 fp8" → `config-key: dsr1-fp8-mi355x-sglang`, `config-file: configs/amd-master.yaml`, `conc: 64`
224-
225-
**After dispatch:**
226-
Monitor with `mcp__github__get_workflow_run`. The profile workflow takes ~15-30 minutes. When complete, the **Perfetto relay link** is in the workflow run's step summary. Retrieve it with:
227-
```bash
228-
gh run view <RUN_ID> --repo SemiAnalysisAI/InferenceX --log | grep "Perfetto Relay URL:"
229-
```
230-
Post the Perfetto relay link back to the user in the comment.
231-
232-
Focus on: code quality, benchmark config changes, and performance impact. Do not be lazy.
233-
234-
## Updating perf-changelog.yaml
235-
236-
See `AGENTS.md` → "Non-negotiable benchmark invariants" for changelog rules and `inferencex-e2e/perf-changelog.yaml` for entry format. Add an entry when the change alters what any benchmark runs: run `uv run python -m infx.matrix.changed --base origin/main` from `inferencex-e2e/` and cover every config key it lists; if it lists none (refactors, recipe moves, docs), add no entry. Use `XXX` as the PR-link placeholder until the PR exists.
237-
238-
If an entry uses `append-only: true`, require the generated base matrix to remain an immutable subset of the generated head matrix. New concurrency values or new recipe variants may be added inside a selected existing config/scenario, but no existing generated point may be removed or modified, and every addition must retain the target visual curve's single non-null image. Do not enforce a file allowlist: supporting code, benchmark scripts, launchers, helpers, and other files may change when their benchmark effect is exclusive to the corresponding newly appended points. All added changelog entries must be append-only, and eval modifiers are forbidden. Trace behavior through the complete diff; unguarded changes or paths reachable by an existing point are blocking.
239-
240-
## Spawning Additional Workers:
241-
You CAN spawn additional Claude workers by commenting "@claude" with a specific task.
242-
243-
**Rules for spawning workers:**
244-
1. Only spawn workers for truly parallel, independent tasks
245-
2. Never spawn more than 2 workers at once
246-
3. Include `[depth:N]` in your spawn comment (increment from parent)
247-
4. Do NOT spawn if you see `[depth:3]` or higher in the thread
248-
5. Each spawned worker should have a clearly scoped, specific task
249-
250-
Example spawn comment: `@claude [depth:1] Please analyze the AMD benchmark results while I focus on NVIDIA results.`
251-
252-
**Never spawn workers for:**
253-
- Sequential tasks that depend on each other
254-
- Simple tasks you can do yourself
255-
- When you're unsure if it's needed
256-
257-
## Web Access:
258-
Use `WebFetch` to read documentation and other URLs.
259-
260-
### Useful Documentation URLs:
261-
- sglang: https://docs.sglang.ai/
262-
- vllm: https://docs.vllm.ai/en/latest/
263-
- vllm optimized flags configs: https://github.com/vllm-project/recipes
264-
265-
### Additional Knowledge
266-
- MI355 is gfx950 not gfx1201
267-
268-
### Expert Parallelism in Benchmark Scripts
269-
vLLM and SGLang handle expert parallelism differently. When writing or reviewing benchmark scripts for MoE models:
270-
271-
- **vLLM** (`vllm serve`): Uses `--enable-expert-parallel` (a boolean flag). vLLM does NOT accept `--expert-parallel-size`. When EP is enabled, vLLM automatically determines the EP size based on TP and the number of available GPUs.
272-
- **SGLang** (`sglang.launch_server`): Uses `--expert-parallel-size N` (an explicit integer). Pass the `EP_SIZE` env var value directly.
273-
- **ATOM** (AMD vLLM fork): Uses `--enable-expert-parallel` (same as vLLM).
274-
275-
**Required pattern for vLLM/ATOM scripts:** Scripts must conditionally enable `--enable-expert-parallel` based on the `EP_SIZE` env var from the config YAML, rather than hardcoding it:
276-
```bash
277-
if [ "$EP_SIZE" -gt 1 ]; then
278-
EP=" --enable-expert-parallel"
279-
else
280-
EP=" "
281-
fi
282-
# Then use $EP in the vllm serve command
283-
```
284-
This ensures the script respects the `ep` setting in the master config YAML's search-space.
285-
28611
review:
28712
name: review
28813
runs-on: ubuntu-latest
28914
concurrency:
290-
group: pr-review-${{ github.event.pull_request.number || github.event.issue.number }}
15+
group: pr-review-${{ github.event.pull_request.number }}
29116
cancel-in-progress: false
292-
# Only run if:
293-
# 1. It's a PR event from someone with write access, OR
294-
# 2. It's a comment containing @pr-claude from someone with write access
295-
if: |
296-
(github.event_name == 'pull_request' &&
297-
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)) ||
298-
((github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') &&
299-
contains(github.event.comment.body, '@pr-claude') &&
300-
contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
17+
# Only review PRs opened by someone with write access.
18+
if: contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
30119
permissions:
30220
contents: read
30321
pull-requests: write # Publish PR feedback.
@@ -326,7 +44,6 @@ jobs:
32644
path_to_claude_code_executable: ${{ steps.claude_cli.outputs.path }}
32745
# Repository review credential; the job gates eligible review requests.
32846
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} # zizmor: ignore[secrets-outside-env]
329-
trigger_phrase: "@pr-claude"
33047
track_progress: true
33148
allowed_bots: ''
33249
settings: |
@@ -337,17 +54,11 @@ jobs:
33754
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
33855
prompt: |
33956
REPO: ${{ github.repository }}
340-
PR NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
57+
PR NUMBER: ${{ github.event.pull_request.number }}
34158
34259
You are reviewing code for InferenceMAX. Your job is to provide HIGH-SIGNAL feedback only.
34360
344-
## Commands:
345-
- `@pr-claude review` - Full review of the PR
346-
- `@pr-claude re-review` - Re-review only NEW changes since your last review (check your previous comments first)
347-
- `@pr-claude review <file>` - Review only a specific file
348-
- `@pr-claude` followed by a question - Answer the question about this PR
349-
350-
## If this is a re-review:
61+
## If this PR already has a Claude review:
35162
1. First, check existing review comments on this PR using `gh pr view`
35263
2. Focus ONLY on new commits or changes not previously reviewed
35364
3. Do NOT repeat previous feedback - reference it if still applicable

0 commit comments

Comments
 (0)