Skip to content

Commit 5fa7459

Browse files
committed
clean
Signed-off-by: Joe Isaacs <[email protected]>
1 parent 4239a61 commit 5fa7459

File tree

2 files changed

+61
-17
lines changed

2 files changed

+61
-17
lines changed

.github/workflows/fuzz.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ jobs:
108108
needs: io_fuzz
109109
if: always() && needs.io_fuzz.outputs.crashes_found == 'true'
110110
runs-on: ubuntu-latest
111+
outputs:
112+
issue_number: ${{ steps.extract_issue.outputs.issue_number }}
111113
permissions:
112114
issues: write
113115
contents: read
@@ -124,6 +126,7 @@ jobs:
124126
path: ./logs
125127

126128
- name: Analyze and report crash with Claude
129+
id: claude_report
127130
env:
128131
CRASH_FILE: ${{ needs.io_fuzz.outputs.first_crash_name }}
129132
ARTIFACT_URL: ${{ needs.io_fuzz.outputs.artifact_url }}
@@ -208,12 +211,17 @@ jobs:
208211
- Workflow: $WORKFLOW_RUN
209212
210213
### If NEW BUG (not a duplicate):
211-
Create a new issue with `gh issue create`:
214+
Create a new issue with `gh issue create` and save the issue number:
212215
```bash
213-
gh issue create --repo ${{ github.repository }} \
216+
ISSUE_URL=$(gh issue create --repo ${{ github.repository }} \
214217
--title "Fuzzing Crash: [brief description]" \
215218
--label "bug,fuzzer" \
216-
--body "..."
219+
--body "...")
220+
221+
# Extract issue number from URL and save to file
222+
ISSUE_NUMBER=$(echo "$ISSUE_URL" | grep -oP '\d+$')
223+
echo "$ISSUE_NUMBER" > issue_number.txt
224+
echo "Created issue #$ISSUE_NUMBER"
217225
```
218226
219227
Issue body must include:
@@ -291,11 +299,33 @@ jobs:
291299
- COMMIT: $COMMIT
292300
293301
Start by reading `logs/fuzz_output.log`.
302+
303+
**IMPORTANT**: After creating a new issue, you MUST save the issue number to `issue_number.txt` as shown above. This is required for the automated fix workflow.
294304
claude_args: |
295305
--model claude-sonnet-4-5-20250929
296306
--max-turns 25
297307
--allowedTools "Read,Write,Bash(gh issue list:*),Bash(gh issue view:*),Bash(gh issue create:*),Bash(gh issue comment:*),Bash(gh api:*),Bash(echo:*),Bash(cat:*),Bash(jq:*),Bash(grep:*),Bash(cargo +nightly fuzz run:*),Bash(RUST_BACKTRACE=* cargo +nightly fuzz run:*)"
298308
309+
- name: Extract issue number
310+
id: extract_issue
311+
run: |
312+
if [ -f issue_number.txt ]; then
313+
ISSUE_NUM=$(cat issue_number.txt)
314+
echo "issue_number=$ISSUE_NUM" >> $GITHUB_OUTPUT
315+
echo "New issue created: #$ISSUE_NUM"
316+
else
317+
echo "No new issue created (duplicate or similar)"
318+
echo "issue_number=" >> $GITHUB_OUTPUT
319+
fi
320+
321+
attempt-fix-io:
322+
name: "Attempt Fix for IO Fuzz Crash"
323+
needs: report-io-fuzz-failures
324+
if: always() && needs.report-io-fuzz-failures.outputs.issue_number != ''
325+
uses: ./.github/workflows/fuzzer-fix-automation.yml
326+
with:
327+
issue_number: ${{ needs.report-io-fuzz-failures.outputs.issue_number }}
328+
secrets: inherit
299329

300330
ops_fuzz:
301331
name: "Array Operations Fuzz"

.github/workflows/fuzzer-fix-automation.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ on:
66
workflow_dispatch:
77
inputs:
88
issue_number:
9-
description: 'Issue number to analyze and fix'
9+
description: "Issue number to analyze and fix"
10+
required: true
11+
type: number
12+
workflow_call:
13+
inputs:
14+
issue_number:
15+
description: "Issue number to analyze and fix"
1016
required: true
1117
type: number
1218

@@ -16,8 +22,10 @@ jobs:
1622
# Only run when:
1723
# 1. Issue is opened with 'fuzzer' label, OR
1824
# 2. 'fuzzer' label is added to existing issue, OR
19-
# 3. Manually triggered via workflow_dispatch
25+
# 3. Manually triggered via workflow_dispatch, OR
26+
# 4. Called from another workflow (workflow_call)
2027
if: |
28+
github.event_name == 'workflow_call' ||
2129
github.event_name == 'workflow_dispatch' ||
2230
(github.event.action == 'opened' && contains(github.event.issue.labels.*.name, 'fuzzer')) ||
2331
(github.event.action == 'labeled' && github.event.label.name == 'fuzzer')
@@ -35,8 +43,8 @@ jobs:
3543
- name: Checkout repository
3644
uses: actions/checkout@v5
3745

38-
- name: Fetch issue details (for workflow_dispatch)
39-
if: github.event_name == 'workflow_dispatch'
46+
- name: Fetch issue details (for workflow_dispatch/workflow_call)
47+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call'
4048
id: fetch_issue
4149
run: |
4250
ISSUE_DATA=$(gh issue view ${{ inputs.issue_number }} --repo ${{ github.repository }} --json number,title,body,labels)
@@ -62,33 +70,39 @@ jobs:
6270

6371
- name: Extract crash details from issue
6472
id: extract
73+
shell: bash
6574
run: |
66-
# Use fetched issue body for workflow_dispatch, otherwise use event issue body
67-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
68-
ISSUE_BODY="${{ steps.fetch_issue.outputs.issue_body }}"
75+
# Use fetched issue body for workflow_dispatch/workflow_call, otherwise use event issue body
76+
if [ "${{ github.event_name }}" = "workflow_dispatch" ] || [ "${{ github.event_name }}" = "workflow_call" ]; then
77+
cat > issue_body.txt <<'ISSUE_EOF'
78+
${{ steps.fetch_issue.outputs.issue_body }}
79+
ISSUE_EOF
6980
else
70-
ISSUE_BODY="${{ github.event.issue.body }}"
81+
cat > issue_body.txt <<'ISSUE_EOF'
82+
${{ github.event.issue.body }}
83+
ISSUE_EOF
7184
fi
7285
7386
# Extract target name from issue body
74-
TARGET=$(echo "$ISSUE_BODY" | grep -oP '(?<=\*\*Target\*\*: `)[^`]+' || echo "file_io")
87+
TARGET=$(grep -oP '(?<=\*\*Target\*\*: `)[^`]+' issue_body.txt || echo "file_io")
7588
echo "target=$TARGET" >> $GITHUB_OUTPUT
7689
7790
# Extract crash file name
78-
CRASH_FILE=$(echo "$ISSUE_BODY" | grep -oP '(?<=\*\*Crash File\*\*: `)[^`]+' || echo "")
91+
CRASH_FILE=$(grep -oP '(?<=\*\*Crash File\*\*: `)[^`]+' issue_body.txt || echo "")
7992
echo "crash_file=$CRASH_FILE" >> $GITHUB_OUTPUT
8093
8194
# Extract artifact URL
82-
ARTIFACT_URL=$(echo "$ISSUE_BODY" | grep -oP 'https://[^\s]+/artifacts/[0-9]+' | head -1 || echo "")
95+
ARTIFACT_URL=$(grep -oP 'https://[^\s]+/artifacts/[0-9]+' issue_body.txt | head -1 || echo "")
8396
echo "artifact_url=$ARTIFACT_URL" >> $GITHUB_OUTPUT
8497
8598
echo "Extracted: target=$TARGET, crash_file=$CRASH_FILE"
99+
rm -f issue_body.txt
86100
87101
- name: Attempt to fix crash with Claude
88102
env:
89-
ISSUE_NUMBER: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}
90-
ISSUE_TITLE: ${{ github.event_name == 'workflow_dispatch' && steps.fetch_issue.outputs.issue_title || github.event.issue.title }}
91-
ISSUE_BODY: ${{ github.event_name == 'workflow_dispatch' && steps.fetch_issue.outputs.issue_body || github.event.issue.body }}
103+
ISSUE_NUMBER: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.issue_number || github.event.issue.number }}
104+
ISSUE_TITLE: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && steps.fetch_issue.outputs.issue_title || github.event.issue.title }}
105+
ISSUE_BODY: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && steps.fetch_issue.outputs.issue_body || github.event.issue.body }}
92106
TARGET: ${{ steps.extract.outputs.target }}
93107
CRASH_FILE: ${{ steps.extract.outputs.crash_file }}
94108
ARTIFACT_URL: ${{ steps.extract.outputs.artifact_url }}

0 commit comments

Comments
 (0)