Gate Policy
[gate] is the part of an evalset that decides what a passing gate means.
Verdicts are reported; the gate policy decides which verdicts block a merge.
Where policy lives
Put the block in evalset.toml (or in eval.toml when a single eval is the
whole target):
[gate]
max_score_drop_pct = 2.0
max_cost_increase_pct = 0
block_on_flake = true
min_k_noise_floor = 3
confidence = 0.95
| Key | Default | Meaning |
|---|---|---|
max_score_drop_pct |
2.0 |
Budget for score drops, in percent of the baseline score. A negative value disables score gating entirely. |
max_cost_increase_pct |
0 |
Cost-gate budget, in percent. 0 means off; a positive value blocks cost blowups. |
block_on_flake |
true |
Block when the candidate's repeats disagree. |
min_k_noise_floor |
3 |
Minimum k before the Student-t noise margin applies. |
confidence |
0.95 |
Confidence level for the noise margin: 0.90, 0.95, or 0.99. |
shipyard init ci appends the [gate] block to an existing evalset.toml
when it is missing, so a scaffolded pipeline starts with explicit, reviewable
policy instead of defaults.
The rules, exactly
For a candidate compared against a baseline, the gate blocks when any of these is true:
- Pass to fail flip. Any eval that passed on the baseline and failed on the candidate blocks. No margin, no budget.
- Flake. A candidate that flaked (its repeats disagreed) blocks while
block_on_flake = true. - Score drop beyond both margins. A score drop blocks only when it is
larger than the
max_score_drop_pctbudget and larger than the 95% Student-t noise margin. The margin is a Welch t-interval over the repeats and applies when either side hask >= min_k_noise_floor(default 3). Inside either margin, the eval is reported assame. - Cost increase. When
max_cost_increase_pctis enabled (> 0), a candidate whose estimated cost rises beyond the budget blocks. - Infra errors always block. A sandbox failure, timeout, killed container, or rubric process failure fails closed.
Rule 3 is the one people misread, so state it twice: a large drop inside the
noise margin is same, and a tiny drop outside the budget is same too. The
score rule needs both to fire.
Exit codes from shipyard compare follow the same verdict: 0 passed,
1 blocked (regression, flake, infra error, or definition mismatch), 2
usage error.
Infra vs agent vs rubric
Not every red is the agent's fault, and the gate says which one it is. Every
verdict JSON carries schema_version, and error_kind is one of:
error_kind |
What it means | Gate behavior |
|---|---|---|
agent |
The agent ran and failed the tests. | Blocks on the score rules above. |
infra |
Sandbox failure, timeout, killed container. | Always blocks, labeled infra. |
rubric |
The rubric process failed (crash, bad output). | Always blocks, labeled rubric. |
Infra kills never read as "the agent failed", because that misdiagnosis sends
people to rewrite prompts for a Docker problem. Per-repeat verdicts are
passed | failed | errored; the aggregate adds flaked, which means the
repeats disagreed.
--policy for CI
Manifests carry defaults, but CI often needs a stricter gate than the local
one. shipyard compare --policy <file> reads a gate policy file for that
comparison:
shipyard compare evalsets/starter-eval \
--baseline baselines/main.json \
--candidate results.json \
--policy .shipyard/gate.toml
Use it to set max_cost_increase_pct on the release branch only, or to turn
block_on_flake off for an intentionally flaky experimental suite without
weakening the committed policy.
Worked examples
A flip blocks. Baseline repeats for refund-policy-cap: pass, pass, pass.
Candidate: fail, pass, fail (verdict flaked). Two independent rules fire:
the pass to fail flip and the flake. Status regressed or flaked,
exit 1.
A small drop does not block. Baseline mean 0.95, candidate mean 0.93. The
drop is 2.1% of the baseline, which is over the default 2% budget, but the
t-interval half-width for these 3-repeat samples is about 0.11. Inside the
margin, status same, exit 0. The margin is printed so you can see why.
A big drop blocks. Baseline mean 0.95, candidate mean 0.55, k = 3. The
drop is beyond both the 2% budget and the margin. Status regressed,
exit 1.
An infra timeout blocks. One repeat hits the container timeout and is
recorded as errored with error_kind = infra. The gate blocks and the
report says infra, not "agent failed", because the run never produced a
fair sample.
A cost blowup blocks only when enabled. With max_cost_increase_pct = 25,
a candidate whose estimated cost rises 40% blocks. With the default 0
(off), the same rise is reported and does not block.
What blocks vs what only reports
| Signal | Reported | Blocks |
|---|---|---|
| Pass to fail flip | Always | Always |
| Flake | Always | By default (block_on_flake) |
| Score drop | Always, with the margin | Budget AND margin |
| Cost increase | Always, when usage exists | Only when enabled and exceeded |
| Infra / rubric error | Always, labeled | Always |
| Definition mismatch | Always, with the changed files | Always (exit 1) |
Improvement, same, n/a usage |
Always | Never |
See Repeats & statistics for the noise margin arithmetic and CI/CD & Pipelines for wiring the gate into pull requests.