[CI] Enhance AI-generated PR workflow with PR description reproducers and lint failure comments#3488
Open
chuanqi129 wants to merge 1 commit intomainfrom
Open
[CI] Enhance AI-generated PR workflow with PR description reproducers and lint failure comments#3488chuanqi129 wants to merge 1 commit intomainfrom
chuanqi129 wants to merge 1 commit intomainfrom
Conversation
…ands and lint failure comments - Support reproducer commands in PR description via ```reproducer-cmd fenced blocks - Comment @copilot on lint check failures for ai_generated PRs - Split reproducer test into two steps: changed repro files and PR description command - Only run added/modified test/repro/ files (git diff --diff-filter=AM) - PR description commands run from pytorch/third_party/torch-xpu-ops/
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CI workflows for ai_generated pull requests to (a) provide clearer automation feedback (lint failure comments) and (b) expand “reproducer” support to include commands embedded in the PR description, while reducing reproducer runtime by focusing on changed reproducer files.
Changes:
- Add lint
continue-on-errorwith an automated@copilotcomment on lint failures forai_generatedPRs, while still failing the job afterward. - Extend the reproducer requirement to accept PR-description
```reproducer-cmdblocks, and pass extracted commands into the reproducer workflow. - Update Linux reproducer workflow to run only added/modified reproducer files and to run PR-description commands in a dedicated step.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
.github/workflows/pull.yml |
Adds lint-failure commenting for AI PRs; extracts PR-body reproducer commands; passes extracted commands to the reproducer workflow. |
.github/workflows/_linux_reproducer.yml |
Accepts pr_body_cmd input; runs only changed reproducer files; adds a separate step to run PR-body reproducer commands. |
Skill file(s) read: .github/skills/xpu-ops-pr-review/SKILL.md.
Comment on lines
122
to
+124
| - name: Write summary | ||
| if: ${{ steps.reproducer.outcome == 'success' }} | ||
| run: echo "✅ Reproducer test passed. All tests in \`test/repro/\` executed successfully." >> $GITHUB_STEP_SUMMARY | ||
| if: ${{ steps.reproducer-files.outcome != 'failure' && steps.reproducer-cmd.outcome != 'failure' }} | ||
| run: echo "✅ Reproducer test passed. All reproducer tests executed successfully." >> $GITHUB_STEP_SUMMARY |
Comment on lines
96
to
111
| # Check if reproducer files exist | ||
| if ! ls test/repro/test_*.py 1>/dev/null 2>&1; then | ||
| FAIL_MSG="No reproducer test found. AI-generated PRs must include at least one reproducer in \`test/repro/test_*.py\`." | ||
| else | ||
| # Validate pytest format: must contain test functions or test classes | ||
| VALID=false | ||
| if ls test/repro/test_*.py 1>/dev/null 2>&1; then | ||
| # Validate pytest format | ||
| for f in test/repro/test_*.py; do | ||
| if grep -qE '^[[:space:]]*(def test_|class Test)' "$f"; then | ||
| VALID=true | ||
| HAS_REPRO_FILES=true | ||
| else | ||
| FAIL_MSG="Reproducer \`$f\` is not in pytest format. It must contain pytest-style test functions (\`def test_...\`) or test classes (\`class Test...\`)." | ||
| break | ||
| fi | ||
| done | ||
| if [ "$VALID" = true ] && [ -z "$FAIL_MSG" ]; then | ||
| echo "All reproducer tests are valid pytest format:" | ||
| if [ "$HAS_REPRO_FILES" = true ] && [ -z "$FAIL_MSG" ]; then | ||
| echo "Found valid reproducer files:" | ||
| ls test/repro/test_*.py | ||
| fi | ||
| fi |
| ${{ (steps.lint-python.outcome == 'failure' || steps.lint-clang.outcome == 'failure') | ||
| && contains(github.event.pull_request.labels.*.name, 'ai_generated') }} | ||
| env: | ||
| GH_TOKEN: ${{ secrets.MERGE_TOKEN }} |
Comment on lines
+125
to
+128
| # Use delimiter for multiline output | ||
| echo "pr_cmd<<ENDOFCMD" >> "$GITHUB_OUTPUT" | ||
| echo "$PR_CMD" >> "$GITHUB_OUTPUT" | ||
| echo "ENDOFCMD" >> "$GITHUB_OUTPUT" |
Comment on lines
+73
to
+80
| - name: Get changed reproducer files | ||
| id: changed-repro | ||
| run: | | ||
| cd torch-xpu-ops | ||
| CHANGED_FILES=$(git diff --name-only --diff-filter=AM origin/${{ github.event.pull_request.base.ref }}...HEAD -- test/repro/test_*.py || true) | ||
| echo "files<<EOF" >> "$GITHUB_OUTPUT" | ||
| echo "$CHANGED_FILES" >> "$GITHUB_OUTPUT" | ||
| echo "EOF" >> "$GITHUB_OUTPUT" |
Comment on lines
+110
to
+114
| set -o pipefail | ||
| cd pytorch/third_party/torch-xpu-ops | ||
| echo "=== Running reproducer command from PR description ===" | ||
| echo "Command: $PR_BODY_CMD" | ||
| eval "$PR_BODY_CMD" 2>&1 | tee -a ${{ github.workspace }}/reproducer_output.txt |
Performance outliers, please check!
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
```reproducer-cmdfenced code blocks in the PR description, in addition to (or instead of)test/repro/test_*.pyfilesai_generatedPRs, automatically comment@copilotwith the failure details and job linkgit diff --diff-filter=AM), not all files intest/repro/Changes
.github/workflows/pull.yml: Lint steps getcontinue-on-error+ comment step; reproducer check supports PR descriptionreproducer-cmdblocks; passespr_body_cmdoutput to reproducer workflow.github/workflows/_linux_reproducer.yml: Newpr_body_cmdinput; split intoreproducer-filesandreproducer-cmdsteps; PR description commands run frompytorch/third_party/torch-xpu-ops/