Prompt Regression in CI
Why This Matters
A prompt is part of the product. If anyone can change it without a check, the next “small wording tweak” will quietly break triage for a category nobody looked at. Testers already know the answer: put it in the pipeline.
When to run the eval
Run the golden set in GitHub Actions on every pull request that touches what changes TestPilot’s behaviour:
on:
pull_request:
paths:
- "src/prompt.ts"
- "src/schema.ts"
- "fixtures/golden/**"
- "package.json"
Store the API key as a repository secret and give it to this job only. Pull requests from forks do not get secrets, which is what you want.
Thresholds that fail the build
Agree on rules your team can defend:
- every category keeps a minimum recall (for example 0.8)
product_bugrecall may never drop compared withmain- overall accuracy may not drop by more than one case
if (current.recall.product_bug < baseline.recall.product_bug) {
fail("product_bug recall dropped: real bugs would be hidden");
}
The baseline is the result stored for the last run on main.
Non-determinism in a gate
The same prompt can score slightly differently on two runs. A gate that fails randomly gets ignored, then disabled. To make it trustworthy:
- Run each case several times (three is a reasonable start) and use the majority verdict.
- Allow a small tolerance for overall accuracy, but no tolerance for the most expensive mistake.
- Never gate on a single run.
Keep the cost under control
- A small, fast set (the unstable and most important cases) on every pull request.
- The full set nightly on
main, or on demand. - A smaller model for the grader from lesson 21.
Show the diff to reviewers
Post the scorecard and the list of changed cases as a pull request comment. A reviewer who sees “golden-014: product_bug → flaky” will ask the right question; a reviewer who sees “accuracy 0.87 → 0.89” will approve.
Exercise
Add .github/workflows/eval.yml that runs the fast set three times on pull requests that change the prompt, fails on a product_bug recall drop and writes the diff to the job summary.