Skip to content

Commit 4bb30c8

Browse files
authored
Refactor LLM Fuzzer workflow to allow multiple oracles (#10033)
Add build matrix and split out the oracle-specific code.
1 parent 431ecc6 commit 4bb30c8

3 files changed

Lines changed: 64 additions & 43 deletions

File tree

.github/workflows/llm-fuzzer.yaml

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,18 @@ jobs:
6464

6565
fuzzer:
6666
if: needs.config.outputs.pg_latest
67-
name: LLM fuzzer PG${{ needs.config.outputs.pg_latest }}
67+
name: ${{ matrix.display_name }}
6868
runs-on: ubuntu-22.04
6969
needs: config
7070
permissions:
7171
contents: read
7272
pull-requests: read
7373
issues: read
74+
strategy:
75+
matrix:
76+
include:
77+
- oracle: "internal-error"
78+
display_name: "Internal Program Errors"
7479

7580
steps:
7681
- name: Install Linux Dependencies
@@ -176,6 +181,9 @@ jobs:
176181
EVENT_WHAT: ${{ github.event.pull_request.title || github.event.head_commit.message || github.event.schedule || github.event_name }}
177182
EVENT_BRANCH: ${{ github.head_ref || github.ref_name }}
178183
EVENT_BASE: ${{ github.base_ref || github.ref_name }}
184+
EVENT_NAME: ${{ github.event_name }}
185+
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
186+
ORACLE_NAME: ${{ matrix.oracle }}
179187
run: |
180188
export PATH=$HOME/$PG_INSTALL_DIR/bin:$PATH
181189
export PGDATABASE=postgres
@@ -184,43 +192,8 @@ jobs:
184192
claude -p --output-format stream-json --verbose \
185193
--max-budget-usd 5.00 --dangerously-skip-permissions \
186194
--model opus --effort high \
187-
"$(cat <<PROMPT
188-
Find bugs in the TimescaleDB code modified in this change set. Focus
189-
on crashes, assertion failures, sanitizer errors, and internal errors
190-
(SQLSTATE XX000) -- these are detected automatically from server
191-
logs. Do not chase wrong-result bugs that need manual verification.
192-
That is, if you see a bug, but it manifests in a way that is not
193-
going to be caught by the reproduction step of this workflow, choose
194-
another bug. Stop after one reproducible bug.
195-
196-
Read the workflow at .github/workflows/llm-fuzzer.yaml. You are
197-
running in that workflow. PostgreSQL with TimescaleDB is already
198-
built and installed, with AddressSanitizer enabled. The build
199-
environment is functional, use it to rebuild with debug logging as
200-
needed.
201-
202-
Determine whether we are testing a PR or a commit on a branch. Focus
203-
on the changes in that change set. Do not explore unrelated git
204-
history or old commits.
205-
206-
Only use public SQL APIs (CREATE, ALTER, SELECT, INSERT, etc. and
207-
documented timescaledb functions). Do not directly modify internal
208-
catalog tables (_timescaledb_catalog.*, _timescaledb_internal.*) --
209-
corrupting internal state is not a useful bug. The goal is to find
210-
inputs that break the code through its public interface.
211-
212-
When done, generate a self-contained ~/llm-fuzzer-repro.sql that
213-
reproduces the error when the subsequent workflow step replays it
214-
against a fresh server.
215-
216-
Some details about the GitHub Actions event that triggered this workflow
217-
what=$EVENT_WHAT
218-
branch=$EVENT_BRANCH
219-
base=$EVENT_BASE
220-
event=${{ github.event_name }}
221-
sha=${{ github.event.pull_request.head.sha || github.sha }}
222-
PROMPT
223-
)" > ${{ runner.temp }}/claude-execution-output.json || rc=$?
195+
"$(envsubst < .github/workflows/llm-fuzzer/prompt.txt)" \
196+
> ${{ runner.temp }}/claude-execution-output.json || rc=$?
224197
225198
# When it goes over the budget, mostly it terminates gracefully because
226199
# the agent is aware of the remaining budget, but sometimes there's a
@@ -323,8 +296,11 @@ jobs:
323296
pg_ctl start
324297
325298
psql -c "create extension timescaledb;"
326-
psql -v ON_ERROR_STOP=0 -f ~/llm-fuzzer-repro.sql
327-
psql -c "select 1"
299+
300+
.github/workflows/llm-fuzzer/oracle/${{ matrix.oracle }}/verify.sh
301+
302+
psql -c "select 1;"
303+
328304
329305
pg_ctl stop
330306
@@ -334,9 +310,13 @@ jobs:
334310
if: always() && steps.repro.outputs.found == 'true'
335311
run: |
336312
! jq 'select(
337-
(.state_code == "XX000" and .error_severity != "LOG" and (.message | test("TestFailure") | not))
338-
or (.message | test("resource was not closed|could not close|leak"))
339-
) | [.message, .func_name, .statement] | @tsv
313+
(
314+
.state_code == "XX000" and .func_name != "exec_stmt_raise"
315+
and .error_severity != "LOG" and (.message | test("TestFailure") | not)
316+
) or (
317+
.message | test("resource was not closed|could not close|leak")
318+
)
319+
) | [.message, .func_name, .statement] | @tsv
340320
' -r postmaster.json | grep .
341321
342322
- name: Collect the logs
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
# This oracle runs the reproducer script with no additional checks. The later
4+
# workflow checks will detect the program logic errors: segfault, assertion
5+
# failure, address sanitizer failure, internal program error (SQLSTATE XX000)
6+
# and so on. The admissible bug must manifest as this class of error.
7+
set -xeu
8+
9+
psql -v ON_ERROR_STOP=0 -f ~/llm-fuzzer-repro.sql
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Read the workflow at .github/workflows/llm-fuzzer.yaml. You are
2+
running in that workflow. PostgreSQL with TimescaleDB is already
3+
built and installed, with AddressSanitizer enabled. The build
4+
environment is functional, use it to rebuild with debug logging as
5+
needed.
6+
7+
Find bugs in the TimescaleDB code modified in this change set. Only consider the
8+
bugs that manifest in a way that is handled by the current oracle at
9+
.github/workflows/llm-fuzzer/oracle/${ORACLE_NAME}/verify.sh.
10+
This run focuses on these classes of bugs specifically, so do not chase
11+
different classes. Stop after one reproducible bug.
12+
13+
Determine whether you are testing a PR or a commit on a branch. Focus
14+
on the changes in that change set. Do not explore unrelated git
15+
history or old commits.
16+
17+
Only use public SQL APIs (CREATE, ALTER, SELECT, INSERT, etc. and
18+
documented timescaledb functions). Do not directly modify internal
19+
catalog tables (_timescaledb_catalog.*, _timescaledb_internal.*) --
20+
corrupting internal state is not a useful bug. The goal is to find
21+
inputs that break the code through its public interface.
22+
23+
When done, generate a self-contained ~/llm-fuzzer-repro.sql that reproduces the
24+
error when the subsequent workflow step replays it against a fresh server. If no
25+
bug in the target class is reproducible, do not create the reproducer file.
26+
27+
Some details about the GitHub Actions event that triggered this workflow:
28+
what=${EVENT_WHAT}
29+
branch=${EVENT_BRANCH}
30+
base=${EVENT_BASE}
31+
event=${EVENT_NAME}
32+
sha=${SHA}

0 commit comments

Comments
 (0)