Topic 4 of 5 · 4 min read
Setting pass thresholds and release gates
Goal: Choose thresholds and gate rules for a suite so that real regressions block and noise does not.
A release gate should block on a few rules the team trusts, each tied to a risk, and only warn on the rest. A gate that fails often for no good reason is switched off. A gate that never fails protects nothing.
Check yourself · 1 of 3
Why is a single rule of "overall pass rate at least 85%" weak as a release gate?
Three kinds of rule
- Absolute threshold. "Overall pass rate must be at least 85%." Simple, but it lets a drop from 98% to 86% through.
- No-regression rule. "Pass rate must not fall more than 2 points below the main branch, and no previously passing critical case may fail." This catches drops from a high baseline.
- Per-category gate. "Safety cases must pass 100%. Billing must be at least 90%." The average cannot hide a weak category when each has its own line.
Most teams combine all three: absolute floors for categories, a no-regression margin overall, and zero tolerance for a short list of critical cases (data leaks, unsafe advice, legal wording).
Setting the numbers
- Measure the noise first. Run the same suite on unchanged code 5 to 10 times. The spread of scores is your noise floor. A margin smaller than that floor will fail at random.
- Use the baseline, not wishes. Start from where the system is now, then raise the bar deliberately. A 95% gate on a system that scores 80% blocks everything.
- Small suites need wide margins. On 20 cases, one case is 5 points. Increase cases or trials before you tighten the margin.
Blocking or warning
Block when a failure means harm or a broken promise: safety, privacy, format that breaks a parser, a critical user journey. Warn when the signal is real but less certain: a style score from an LLM judge, a latency increase, a small drop in a minor category. Warnings appear in the pull request comment but do not turn the check red.
Keep the gate trusted
- Every block must say which rule failed and show the failing cases.
- Review the gate when it blocks something that was fine, and when something bad slipped through. Adjust the rule, not the case.
- Never allow a silent bypass. If a team overrides, require a written reason in the pull request.
Before and after
Before: one rule, "at least 80% overall." The score drops from 94% to 82% and ships. After: no more than 2 points below main, 100% on the 12 safety cases, and a warning on latency. The same edit is blocked, and the comment names the 9 cases that fell.
What goes wrong
- A threshold chosen from a round number rather than measured noise, so the gate flakes.
- Making everything blocking, so people retry until green.
- Lowering the threshold each time it fails instead of finding out why.
Examples
A gate file
gates:
- name: safety
category: safety
min_pass_rate: 1.0
mode: block
- name: no-regression
metric: pass_rate
max_drop_vs_main: 0.02
mode: block
- name: billing-floor
category: billing
min_pass_rate: 0.90
mode: block
- name: latency
metric: p95_latency_ms
max_increase_vs_main: 0.20
mode: warn
Safety and billing block. The 2-point drop against main blocks. The latency rule warns only.
Noise sets the margin
The team reruns the unchanged suite 8 times. Scores range from 86% to 89%, a spread of 3 points. A gate of "no more than 1 point below main" would fail about as often as it passes by chance. They set the margin at 4 points, and add 40 cases so it can later be tightened.
Key points
- Combine an absolute floor, a no-regression margin against main and per-category gates, because each catches what the others miss.
- Measure the noise by rerunning unchanged code several times, and keep the margin larger than the spread.
- Block on harm or broken promises such as safety and format, and warn on weaker signals.
- On small suites one case is a large fraction, so add cases or trials before tightening the margin.
- Every block must name the failing rule and cases, and overrides need a written reason.
Common mistakes
- Picking a round threshold such as 90% without measuring the system or its noise.
- Making every metric blocking, so developers rerun jobs until they pass.
- Using only an overall average, which lets a failing category hide behind strong ones.
- Lowering a threshold after each failure instead of investigating the failing cases.
Check yourself · 2 of 3
Five reruns of unchanged code score between 86% and 89%. Which margin against main avoids random failures?
Check yourself · 3 of 3
A style score from an LLM judge dropped 3 points on a pull request. How should the gate treat it?
Practice items, not counted towards your mastery.
Start here
- promptfoo: Testing prompts with GitHub Actions (opens in a new tab)DocsFree
A working CI recipe that runs an eval on every pull request that touches a prompt and comments the results.
- Evaluation best practices (OpenAI) (opens in a new tab)DocsFree
Vendor guidance on building evals, running them continuously and checking them against real usage.
- GitHub Actions documentation (opens in a new tab)DocsFree
Triggers, path filters, caching and scheduled workflows: the parts of CI this skill relies on.
More for this topic
- Develop test cases (Claude docs) (opens in a new tab)DocsFree
Covers choosing success criteria that are specific and measurable before setting targets.