diff --git a/bin/gstack-doctor-components.sh b/bin/gstack-doctor-components.sh index 975b2e1e1d..7ebbbcc218 100644 --- a/bin/gstack-doctor-components.sh +++ b/bin/gstack-doctor-components.sh @@ -443,6 +443,7 @@ gstack_result_anchor() { EVAL_JUDGE_UNCHECKED) printf '%s' 'eval-judge-unchecked' ;; EVAL_REPORT_UNPLANTED_ZERO) printf '%s' 'eval-report-unplanted-zero' ;; EVAL_REPORT_NO_ANSWER_ONLY) printf '%s' 'eval-report-no-answer-only' ;; + EVAL_QUICK_LOOK_NO_NUMBER) printf '%s' 'eval-quick-look-no-number' ;; EVAL_ARM_DUPLICATE) printf '%s' 'eval-arm-duplicate' ;; OFFICE_HOURS_PROBE_REFUSED) printf '%s' 'office-hours-probe-refused' ;; TASKS_SUPERSEDE_REFUSED) printf '%s' 'tasks-supersede-refused' ;; diff --git a/bin/gstack-eval-plan b/bin/gstack-eval-plan index 4ea39ba654..f50d61de66 100755 --- a/bin/gstack-eval-plan +++ b/bin/gstack-eval-plan @@ -2,7 +2,7 @@ /** * gstack-eval-plan — the tier-1 machinery behind /eval-plan (plan E1). * - * gstack-eval-plan prereg --check [--allow-repo-commands] [--json] | --init [--title ] + * gstack-eval-plan prereg --check [--allow-repo-commands] [--json] | --init [--title ] [--quick] * gstack-eval-plan arms [--arms ] [--policy-doc ] [--input-tokens N] [--output-tokens N] [--json] * gstack-eval-plan dry-run --input --arms [--fields a,b] [--output-budget N] * [--retry-prompt ] [--max-rows N] [--tier-question ] [--out ] [--json] @@ -34,7 +34,7 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import { spawnSync } from 'node:child_process'; -import { armModel, checkPrereg, DEFAULT_TOKENS, dryRun, pilotReport, preregTemplate, priceGate, releasePilot, renderArms, renderDryRun, renderGatePrice, renderPilotReport, renderPreregDiagnostics, resolveArms, resolvePlanSource, runPreregDiagnostics, settlePilot, startPilot } from '../lib/eval-plan'; +import { armIdentities, armModel, checkPrereg, DEFAULT_TOKENS, dryRun, pilotReport, preregTemplate, quickLookTemplate, priceGate, releasePilot, renderArms, renderDryRun, renderGatePrice, renderPilotReport, renderPreregDiagnostics, resolveArms, resolvePlanSource, runPreregDiagnostics, settlePilot, startPilot } from '../lib/eval-plan'; import { checkResults } from '../lib/eval-plan-report'; import { checkJudgeLabels, renderJudgeLabels } from '../lib/eval-plan-checks'; import { checkModelRules, EVAL_SCOPES, type EvalScope, type ModelRulesCheck } from '../lib/eval-models'; @@ -53,7 +53,7 @@ const HELP = `gstack-eval-plan — preregistration, priced arms, $0 dry run, pri more arms, paired: yes, interval: 95% and mdd:; a frozen: date before 2026-11-15 skips both; an optional Diagnostics section's summarizer runs on its synthetic fixture only with --allow-repo-commands (else it is listed and exit 3) and every count must match - prereg --init [--title ] write the template + prereg --init [--title ] [--quick] write the template (--quick: a quick look) arms [--arms m,m] [--policy-doc f] [--input-tokens N] [--output-tokens N] [--json] arms from \`gstack-models resolve --role eval-arms\`, else the repo policy doc, each priced per item dry-run --input rows.jsonl --arms m,m [--fields a,b] [--output-budget N] [--retry-prompt f] [--max-rows N] [--cap usd] [--tier-question ""] [--out dir] [--json] @@ -121,7 +121,7 @@ function doPrereg(rest: string[]): number { if (init) { if (fs.existsSync(init) && !rest.includes('--force')) { process.stderr.write(`gstack-eval-plan: ${init} exists (pass --force)\n`); return EXIT.refused; } fs.mkdirSync(path.dirname(path.resolve(init)), { recursive: true }); - fs.writeFileSync(init, preregTemplate(flag(rest, '--title'))); + fs.writeFileSync(init, rest.includes('--quick') ? quickLookTemplate(flag(rest, '--title')) : preregTemplate(flag(rest, '--title'))); process.stdout.write(`PREREG_INIT: ${init}\n`); return EXIT.ok; } @@ -136,11 +136,11 @@ function doPrereg(rest: string[]): number { const run = runnable && allowed ? runPreregDiagnostics(d, repoRoot) : null; if (rest.includes('--json')) process.stdout.write(JSON.stringify({ file, ...r, diagnostics_run: run }) + '\n'); else { - process.stdout.write(`PREREG: ${r.ok ? 'ok' : 'incomplete'} present=${r.present.length}/${r.present.length + r.missing.length + r.empty.length}${r.missing.length ? ` missing=${r.missing.join(',')}` : ''}${r.empty.length ? ` empty=${r.empty.join(',')}` : ''}${r.comparison.stack ? ` stack=${r.comparison.stack}` : ''}${r.no_gstack.required ? ` no_gstack_arm=${r.no_gstack.ok ? 'ok' : r.no_gstack.problems[0] === 'missing section' ? 'missing' : 'incomplete'}` : ''}${d ? ` diagnostics=${d.errors.length ? 'invalid' : d.expected.length}` : ''}${r.grandfathered ? ` frozen=${r.frozen} result_checks=exempt` : ''} file=${file}\n`); + process.stdout.write(`PREREG: ${r.ok ? 'ok' : 'incomplete'} present=${r.present.length}/${r.present.length + r.missing.length + r.empty.length}${r.missing.length ? ` missing=${r.missing.join(',')}` : ''}${r.empty.length ? ` empty=${r.empty.join(',')}` : ''}${r.comparison.stack ? ` stack=${r.comparison.stack}` : ''}${r.no_gstack.required ? ` no_gstack_arm=${r.no_gstack.ok ? 'ok' : r.no_gstack.problems[0] === 'missing section' ? 'missing' : 'incomplete'}` : ''}${d ? ` diagnostics=${d.errors.length ? 'invalid' : d.expected.length}` : ''}${r.quick ? ` kind=quick-look cap=${r.quick.cap ?? 'missing'}` : ''}${r.loop.interim_required ? ' interim_look=required' : ''}${r.grandfathered ? ` frozen=${r.frozen} result_checks=exempt` : ''}${r.loop_grandfathered ? `${r.grandfathered ? '' : ` frozen=${r.frozen}`} loop_checks=exempt` : ''} file=${file}\n`); if (runnable && !allowed) process.stdout.write(`PREREG_COMMAND: summarizer=${JSON.stringify(d.summarizer)} fixture=${d.fixture} cwd=${repoRoot}\n`); if (run) process.stdout.write(renderPreregDiagnostics(run)); } - const incomplete = [...r.missing.map(m => `missing ${m}`), ...r.empty.map(e => `empty ${e}`), ...r.comparison.errors.map(e => `comparison: ${e}`), ...r.decisions.errors.map(e => `decisions: ${e}`), ...r.scoring.errors.map(e => `scoring: ${e}`), ...(d?.errors ?? []).map(e => `diagnostics: ${e}`)]; + const incomplete = [...r.missing.map(m => `missing ${m}`), ...r.empty.map(e => `empty ${e}`), ...r.comparison.errors.map(e => `comparison: ${e}`), ...r.decisions.errors.map(e => `decisions: ${e}`), ...r.scoring.errors.map(e => `scoring: ${e}`), ...r.loop.errors.map(e => `${e.section.toLowerCase()}: ${e.message}`), ...(r.quick?.errors ?? []).map(e => `quick look: ${e}`), ...(d?.errors ?? []).map(e => `diagnostics: ${e}`)]; if (incomplete.length) process.stderr.write(resultLine('gstack-eval-plan prereg', 'PREREG_INCOMPLETE', incomplete.join('; ')) + '\n'); if (!r.no_gstack.ok) process.stderr.write(resultLine('gstack-eval-plan prereg', 'PREREG_NO_GSTACK_ARM', `no-gstack arm: ${r.no_gstack.problems.join('; ')}`) + '\n'); if (run && !run.ok) process.stderr.write(resultLine('gstack-eval-plan prereg', 'PREREG_DIAGNOSTIC_UNTESTED', run.error ?? run.rows.filter(row => row.status !== 'ok').map(row => `${row.name} ${row.status} (expected ${row.expected ?? 'undeclared'}, got ${row.got ?? 'none'})`).join('; ')) + '\n'); @@ -167,9 +167,10 @@ function doJudge(rest: string[]): number { const prereg = flag(rest, '--check'); const labels = flag(rest, '--labels'); if (!prereg || !labels || !fs.existsSync(prereg) || !fs.existsSync(labels)) return usage('judge needs --check --labels '); - const { scoring } = checkPrereg(fs.readFileSync(prereg, 'utf8')); + const preregText = fs.readFileSync(prereg, 'utf8'); + const { scoring } = checkPrereg(preregText); if (!scoring.judge || scoring.judge.toLowerCase() === 'none') return usage('judge --check needs a preregistration whose ## Scoring names a judge model'); - const r = checkJudgeLabels(scoring, fs.readFileSync(labels, 'utf8')); + const r = checkJudgeLabels(scoring, fs.readFileSync(labels, 'utf8'), armIdentities(preregText)); process.stdout.write(rest.includes('--json') ? JSON.stringify({ prereg, labels, ...r }) + '\n' : renderJudgeLabels(r)); if (!r.ok) { process.stderr.write(resultLine('gstack-eval-plan judge', 'EVAL_JUDGE_UNCHECKED', r.problems.join('; ')) + '\n'); return EXIT.fail; } return EXIT.ok; diff --git a/changelog.d/eval-plan-loop-rules.md b/changelog.d/eval-plan-loop-rules.md new file mode 100644 index 0000000000..62cce42ddb --- /dev/null +++ b/changelog.d/eval-plan-loop-rules.md @@ -0,0 +1 @@ +**`/eval-plan` now writes eval plans that waste less money.** `gstack-eval-plan prereg --check` refuses a plan frozen on or after 2026-11-21 unless it pilots every arm on at most a tenth of its budget (drawing every unit type, in a seeded order), checks its judge on each arm's outputs at a stated reasoning effort, carries a cost line, scores any "smaller change" arm with a regression-test bar, says how task machines were checked for readable answers, and, above $500 paid, preregisters one look at half the units with O'Brien-Fleming and futility bounds. `judge --check` reads agreement per arm. A small question gets a quick look (`prereg --init --quick`): at most $100, three lines, and no published number, which `results --check` enforces. New plans name GPT-6.2 Sol as the frontier Sol, and GPT-6.2 Sol and Astra are priced. Older frozen plans keep their rules and models. diff --git a/docs/TESTING_INTERNALS.md b/docs/TESTING_INTERNALS.md index 38427619f8..5f128fa0a6 100644 --- a/docs/TESTING_INTERNALS.md +++ b/docs/TESTING_INTERNALS.md @@ -2111,6 +2111,45 @@ rules it was frozen under: the PREREG line shows `result_checks=exempt` and none of the four checks apply. Text frozen before a priced call is not edited to meet a newer rule. +## Eval-loop checks + +The owner's eval-loop rules (2026-11-19) are refusals in `prereg --check` for +every preregistration frozen on or after 2026-11-21, on top of the result +checks. Logic in `checkLoop` and `checkQuickLook` (`lib/eval-plan-checks.ts`): + +| Check | Refusal | +|---|---| +| `## Pilot`, uncounted, per arm: `share:` at most 10% of that arm's budget, `counted: no`, `ran:` (the part under test ran, on that arm's own outputs), `judge:` (the judge passes its label check on that arm's pilot outputs, with a model judge), `supply:` (the units can be supplied at the planned rate), `units:` (every unit type, each drawn at least once) and `seed:` (a fixed draw order that doesn't depend on the number of workers) | `PREREG_INCOMPLETE` | +| `## Scoring` with a model judge: `per-arm: yes` and `effort:`, the reasoning effort set in the judge's start | `PREREG_INCOMPLETE` | +| `## Cost`: `paid:` (a plain dollar amount such as `$1,200`; `2k`, ranges, units and arithmetic are refused), `meter:` and `ledger:`, the private file that gets the actual cost and the decision it settled | `PREREG_INCOMPLETE` | +| `## Interim look` when `paid:` is above $500: `at: 50%`, `looks: 1`, `bounds:` O'Brien-Fleming, `futility:` | `PREREG_INCOMPLETE` | +| An arm or bar asking for a smaller change or less code has a `regression test` bar beside it | `PREREG_INCOMPLETE` | +| `## Held-out exposure` has an `answers:` line: how each task machine was checked for answers the agent could read there | `PREREG_INCOMPLETE` | +| With `per-arm: yes`, `judge --check` needs an `arm` on every label row, rows naming only arms in `## Arms` and covering every one, and the bar met on each arm's labels (`JUDGE_ARM:` lines) | `EVAL_JUDGE_UNCHECKED` | +| A quick look (`kind: quick look`; `question:`, `decision:`, `stop:`, `cap:` of $100 or less) publishes no number | `results --check`: `EVAL_QUICK_LOOK_NO_NUMBER` | + +Why: of $28,836 spent on our last 30 evals, 23.7% settled nothing, and most of +that leaked through arms and judges that broke rather than through too many +samples. The biggest single loss ($2,033) was a judge that failed its check after +the whole grid had run, which a per-arm pilot catches for a tenth of the price. +A pilot that drew one unit type planned a 77% yield and got 9%, and a restart at a +new concurrency redrew its items. A "smaller change" instruction cut code to 0.44x +and wrote fewer tests (28 of 100 sessions against 79). A reader subagent that +inherited its parent's highest effort cost about four times the default. Three +unplanned looks raise a 5% false-positive rate to about 11%, so a counted run big +enough to matter takes one planned look. One look at half the units under +O'Brien-Fleming bounds stops for effect at |z| 2.80 or more and passes at the end +at |z| 1.98 or more. + +How we'll know it worked: cost per decision (paid plus meter spend divided by the +ship-or-kill calls settled) is recounted over evals preregistered under these +checks on Monday 2026-12-07, against $1,922 per decision and 23.7% settling +nothing. That count reads each plan's `ledger:` file. + +A `frozen: YYYY-MM-DD` line before 2026-11-21 keeps the rules it was frozen +under: the PREREG line shows `loop_checks=exempt`. Frozen plans also keep the +models they named; new plans name `gpt-6.2-sol`. + ## Frontier models under test Garry, 2026-11-01 (R54): "I think you are spending too much time with Haiku and @@ -2119,7 +2158,7 @@ models like Opus and 6.1 Sol... just transfer from Haiku to Sonnet, who gives a shit about that, man?" **Models under test are frontier models.** Today that's `claude-opus-5-5` and -`gpt-6.1-sol`, plus at most one low-cost primary the preregistration names. Haiku +`gpt-6.2-sol` (a plan frozen on `gpt-6.1-sol` keeps it), plus at most one low-cost primary the preregistration names. Haiku and Sonnet are not models under test. They aren't stand-ins for a frontier model, and an eval has no tier-transfer arms (Haiku against Sonnet, say) unless its preregistration says it is asking about that tier. @@ -2136,7 +2175,7 @@ model they already use. is Haiku or Sonnet. When every arm is one, the dry run fails unless `--tier-question ""` is passed. When only some arms are, it warns. Either way it prints the whole plan's price -on `claude-opus-5-5` and `gpt-6.1-sol`. The dry run doesn't enforce that number: +on `claude-opus-5-5` and `gpt-6.2-sol`. The dry run doesn't enforce that number: compare it with the brief cap before any arm is swapped. `pilot start` refuses a pilot whose every arm is Haiku or Sonnet unless its dry run recorded a tier question. diff --git a/docs/skills.md b/docs/skills.md index 97eb4fc2d3..efeabfedc9 100644 --- a/docs/skills.md +++ b/docs/skills.md @@ -969,7 +969,12 @@ You: /eval-plan how much will the retrieval eval cost before I run it? `bin/gstack-eval-plan prereg --init` writes the preregistration (question, bars, arms, decoys, stop rules, cap) and `--check` refuses to continue while a field is blank (`PREREG_INCOMPLETE`), including the `## Decisions` and `## Scoring` -sections the [result checks](TESTING_INTERNALS.md#result-checks) require. +sections the [result checks](TESTING_INTERNALS.md#result-checks) require and, +for plans frozen on or after 2026-11-21, the `## Pilot`, `## Cost` and (above +$500 paid) `## Interim look` sections the +[eval-loop checks](TESTING_INTERNALS.md#eval-loop-checks) require. +`prereg --init --quick` writes a quick look instead: at most $100, three lines, +and no published number (`EVAL_QUICK_LOOK_NO_NUMBER`). `judge --check --labels ` scores a model judge against hand labels (`EVAL_JUDGE_UNCHECKED`). `arms` resolves the `eval-arms` model role against `lib/pricing.ts` and stops on an unpriced model (`EVAL_PRICE_MISSING`); `dry-run` diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 4c2ca3b370..f79d91d596 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -5185,7 +5185,13 @@ actions, and `## Scoring` needs a `judge:` line, a model judge from another model family than every arm with `labels:` of 40 or more and `agreement:` of 0.6 or more, and with two or more arms `paired: yes`, `interval: 95%` and `mdd:`. A `frozen:` date before 2026-11-15 exempts both -([docs/TESTING_INTERNALS.md](TESTING_INTERNALS.md#result-checks)). +([docs/TESTING_INTERNALS.md](TESTING_INTERNALS.md#result-checks)). The +eval-loop checks add `## Pilot`, `## Cost`, `## Interim look` (a counted run +above $500), the judge's `per-arm:` and `effort:` lines, a regression-test bar +for a "smaller change" arm and an `answers:` line under held-out exposure; a +`frozen:` date before 2026-11-21 exempts them, and a `kind: quick look` plan +is checked for its three lines and a cap of $100 or less instead +([docs/TESTING_INTERNALS.md](TESTING_INTERNALS.md#eval-loop-checks)). **Fix.** Fill the named sections before any priced call. A plan that cannot name its stop rule or its held-out exposure is not preregistered; the pilot @@ -5233,11 +5239,15 @@ in [docs/TESTING_INTERNALS.md](TESTING_INTERNALS.md#no-gstack-arm). file, fewer labelled outputs than the preregistered count (at least 40), labels that are all one class (agreement is undefined), a repeated id, or a Cohen's kappa between the hand labels and the judge below the preregistered bar (at -least 0.6). Until it passes, the judge's numbers do not count. +least 0.6). With `per-arm: yes` in `## Scoring`, it also refuses a label row +with no `arm`, rows naming an arm not in `## Arms`, an arm with no rows, or +any arm whose own kappa is below the bar (its `JUDGE_ARM:` line). Until it +passes, the judge's numbers do not count. **Fix.** Label outputs by hand from development or calibration rows, never -held-out ones, as JSONL rows `{"id", "human", "judge"}`, covering every kind -of output the judge scores, and pass the file with `--labels`. A judge below +held-out ones, as JSONL rows `{"id", "human", "judge"}` (plus `"arm"` with +`per-arm: yes`), covering every kind of output the judge scores and every +arm, and pass the file with `--labels`. A judge below its bar is replaced or its prompt fixed and relabelled; the bar is not lowered. The rule is in [docs/TESTING_INTERNALS.md](TESTING_INTERNALS.md#result-checks). @@ -5270,6 +5280,18 @@ must be read side by side. the grader's rule on the final answer alone, and report both readings. The rule is in [docs/TESTING_INTERNALS.md](TESTING_INTERNALS.md#result-checks). + +### `EVAL_QUICK_LOOK_NO_NUMBER` + +**Meaning.** `gstack-eval-plan results --check` was given a quick look (a plan +with `kind: quick look`). A quick look costs at most $100, takes a day and only +opens or closes a question, so it publishes no number. + +**Fix.** Record the quick look's answer as an opened or closed question. To +publish a number, write a counted-run preregistration (`prereg --init`), pilot +each arm and run it. The rule is in +[docs/TESTING_INTERNALS.md](TESTING_INTERNALS.md#eval-loop-checks). + ### `EVAL_ARM_DUPLICATE` diff --git a/docs/working-across-agent-systems.md b/docs/working-across-agent-systems.md index ca798f021e..7157c1b4ae 100644 --- a/docs/working-across-agent-systems.md +++ b/docs/working-across-agent-systems.md @@ -57,8 +57,11 @@ either side is paid for: - No acknowledgement messages, no polling loops, and never print the whole environment (it puts every key in the transcript). -**Evals.** The checklist for a paid eval is moving into [/eval-plan](../eval-plan/SKILL.md). Until it -lands there, use /eval-plan's current checks before any paid run. +**Evals.** Plan every paid eval with [/eval-plan](../eval-plan/SKILL.md), whichever system runs it. Its +preregistration check refuses a plan that doesn't name the decision each result changes, pilot every +arm on a tenth of its budget, check its judge on each arm's outputs, carry a cost line, or (above $500 +paid) preregister one look at half the units. For a small question it offers a $100 quick look that +publishes no number. ## Worth trying (one team's practice, not yet measured by us) diff --git a/eval-plan/SKILL.md b/eval-plan/SKILL.md index 4feee367df..e1d98c7e7c 100644 --- a/eval-plan/SKILL.md +++ b/eval-plan/SKILL.md @@ -116,6 +116,15 @@ priced pilot (three items per arm, settled against the invoice, extrapolated with an error band). Only then is the owner asked to approve the full run. Every step prints one grep-able line; a parent agent reads the lines, not this prose. +## Step 0: Size the question + +First name the decision: what we do differently for each way the result could come +out. If no result changes what we do, don't run it. For a small question ("does this +edit help?"), offer a quick look first: at most 100 dollars paid and one day, a +three-line plan (`prereg --init --quick`) that publishes no number +(`results --check` refuses one, `EVAL_QUICK_LOOK_NO_NUMBER`). Anything that publishes +a number or ships a cut is a counted run: Steps 1 to 5. + Usage: `/eval-plan [] [--input ] [--arms ] [--cap ] [--total ]` ## Boundaries @@ -145,7 +154,10 @@ Write (or open) the preregistration file. Each section is required and must be f | Decisions | one `if : ` line per way the run can come out, at least two, with different actions | | Arms | one line per arm: the arm identity first (`` or `#`), settings, per-item cost from Step 1b | | Comparison | `stack: loaded` when any arm loads gstack or another skill stack; otherwise `stack: none` and a `why:` line | -| Scoring | `judge: none` or the judge model with `labels:` and `agreement:`; with two or more arms, `paired: yes`, `interval: 95%`, `mdd:` | +| Scoring | `judge: none` or the judge model with `labels:`, `agreement:`, `per-arm: yes` and `effort:`; with two or more arms, `paired: yes`, `interval: 95%`, `mdd:` | +| Pilot | per arm, uncounted: `share:` (at most 10% of the arm's budget), `counted: no`, `ran:`, `judge:`, `supply:`, `units:` (every unit type), `seed:` (a draw order that doesn't depend on the number of workers) | +| Cost | `paid:` a plain dollar amount (no k, ranges or arithmetic), `meter:`, `ledger:` (the private file that gets the actual cost and the decision it settled) | +| Interim look | only when `paid:` is above 500 dollars: `at: 50%`, `looks: 1`, `bounds: O'Brien-Fleming`, `futility:` | | Decoys | inputs the scorer must reject or score low; how many, how they were made, what a decoy pass proves | | Stop rules | the spend cap, a bar missed on the pilot, a scorer below its bar, `budget_exhausted`, the first quota or rate-limit error on a seat-metered arm | | Held-out exposure | every held-out set the plan touches: prior exposure (which runs, which models), the reservation on it; and how each task machine was checked, before any session, for answers the agent could read there (other git refs such as `git log --all`, build and package caches, archives and the task's own work tree; never a sweep of `/`, runner state or `~/.ssh`) | @@ -192,8 +204,15 @@ at least one, so `expected` is 1 or more and the summarizer is shown to find it. kappa of 0.6 or better, and the comparison is paired with a 95% interval and its smallest detectable difference stated now. +3. **The eval-loop checks** (docs/TESTING_INTERNALS.md#eval-loop-checks): the Pilot, + Cost and (above 500 dollars paid) Interim look sections; the judge's `per-arm:` and + `effort:`; a `regression test` bar beside any arm that asks for a smaller change + or less code, because a shorter diff can come from skipping the test; and an + `answers:` line under Held-out exposure. + A `frozen: YYYY-MM-DD` line before 2026-11-15 keeps the rules it was frozen under -(`result_checks=exempt`). +(`result_checks=exempt`); one before 2026-11-21 skips item 3 (`loop_checks=exempt`) +and keeps the models it named. ### Step 1b: Arms and their price @@ -210,9 +229,10 @@ page or drop the arm. Copy the priced arms into the Arms section. An arm identit `#` (for example `claude-opus-5-5#no-gstack`) is priced by its model and gets its own pilot attempts; naming one identity twice is `EVAL_ARM_DUPLICATE`. -Models under test are frontier models (`claude-opus-5-5`, `gpt-6.1-sol`, at most one named +Models under test are frontier models (`claude-opus-5-5`, `gpt-6.2-sol`, at most one named low-cost primary); a Haiku or Sonnet arm only with a stated tier question -(docs/TESTING_INTERNALS.md#frontier-models-under-test). +(docs/TESTING_INTERNALS.md#frontier-models-under-test). Judges: `gpt-6-astra` or +`gpt-6.2-astra` for Claude arms, `claude-opus-5-5` for GPT arms. When the repo commits `.gstack/eval-models.json` (allow, deny, per-scope lists, families newest first; `docs/eval-models.md` in gstack), `arms`, `dry-run`, `pilot start` and @@ -280,6 +300,12 @@ anything else (`EVAL_DRY_RUN_FAILED`). ~/.claude/skills/gstack/bin/gstack-eval-plan pilot start --out --cap --arms --dry-run ``` +The pilot is uncounted and runs per arm, on at most a tenth of that arm's budget. It shows, +on that arm's own outputs, that the part under test ran, that the judge passes its label check +there, and that the units can be supplied. It draws at least one unit of every type the +counted run uses, in an order from a fixed seed, so a restart at another concurrency draws the +same items. An arm that fails is fixed or left out, and reported as left out. + `pilot start` reserves three attempts per arm through the spend ledger (`spend.json` in `--out`): admission is `spent + reserved + unknown + estimate <= cap`, under a file lock shared with any concurrent worker. Run each `PILOT_ATTEMPT:` through the project's own @@ -316,7 +342,10 @@ then: ~/.claude/skills/gstack/bin/gstack-eval-plan judge --check --labels ``` -`JUDGE_AGREEMENT: ok` continues. `EVAL_JUDGE_UNCHECKED` (exit 1) means too few labels, +Give each label row its `"arm"`: with `per-arm: yes`, each `JUDGE_ARM:` line must meet the +bar on its own. Start every judge or reader subagent with its model and reasoning effort +set; left unset, it inherits its parent's, and a reader that inherited the highest effort +cost about four times the default. `JUDGE_AGREEMENT: ok` continues. `EVAL_JUDGE_UNCHECKED` (exit 1) means too few labels, one class, or kappa below the bar: replace the judge or fix its prompt, then relabel; never lower the bar. @@ -356,7 +385,9 @@ question with the projection as the recommended option only when `verdict=within Under `SESSION_KIND: unattended` write the question as an `approval` gate item through `gstack-gate` and end with `GSTACK_RESULT: skill=eval-plan status=gate_pending run=`. The full run, when approved, keeps settling every attempt into the same ledger and reprints -the spend table at each gate; `budget_exhausted` stops it. +the spend table at each gate; `budget_exhausted` stops it. Above 500 dollars paid it takes the one +preregistered look at half the units and stops on its O'Brien-Fleming or futility bound; +it takes no other look. ## Step 5: Results beside the no-gstack arm @@ -380,6 +411,9 @@ leaves the run (a report, a READY block, a PR body), check it: it (failures by the grader's own rule on the final answer); a broader count can rise while that one stays flat. +Write the actual paid and meter cost, and the decision the run settled (or "none"), to the +Cost section's `ledger:` file; the public page carries the decision, not the cost. + The results file opens with two or three plain takeaways ("We learned X. You should do X."): what works first, then what didn't, with its number. Cost appears only as part of a lesson, and nothing is opened without a stated reason (ETHOS.md, Explain the Number). diff --git a/eval-plan/SKILL.md.tmpl b/eval-plan/SKILL.md.tmpl index 164ce20cb0..933862961f 100644 --- a/eval-plan/SKILL.md.tmpl +++ b/eval-plan/SKILL.md.tmpl @@ -31,6 +31,15 @@ priced pilot (three items per arm, settled against the invoice, extrapolated with an error band). Only then is the owner asked to approve the full run. Every step prints one grep-able line; a parent agent reads the lines, not this prose. +## Step 0: Size the question + +First name the decision: what we do differently for each way the result could come +out. If no result changes what we do, don't run it. For a small question ("does this +edit help?"), offer a quick look first: at most 100 dollars paid and one day, a +three-line plan (`prereg --init --quick`) that publishes no number +(`results --check` refuses one, `EVAL_QUICK_LOOK_NO_NUMBER`). Anything that publishes +a number or ships a cut is a counted run: Steps 1 to 5. + Usage: `/eval-plan [] [--input ] [--arms ] [--cap ] [--total ]` ## Boundaries @@ -60,7 +69,10 @@ Write (or open) the preregistration file. Each section is required and must be f | Decisions | one `if : ` line per way the run can come out, at least two, with different actions | | Arms | one line per arm: the arm identity first (`` or `#`), settings, per-item cost from Step 1b | | Comparison | `stack: loaded` when any arm loads gstack or another skill stack; otherwise `stack: none` and a `why:` line | -| Scoring | `judge: none` or the judge model with `labels:` and `agreement:`; with two or more arms, `paired: yes`, `interval: 95%`, `mdd:` | +| Scoring | `judge: none` or the judge model with `labels:`, `agreement:`, `per-arm: yes` and `effort:`; with two or more arms, `paired: yes`, `interval: 95%`, `mdd:` | +| Pilot | per arm, uncounted: `share:` (at most 10% of the arm's budget), `counted: no`, `ran:`, `judge:`, `supply:`, `units:` (every unit type), `seed:` (a draw order that doesn't depend on the number of workers) | +| Cost | `paid:` a plain dollar amount (no k, ranges or arithmetic), `meter:`, `ledger:` (the private file that gets the actual cost and the decision it settled) | +| Interim look | only when `paid:` is above 500 dollars: `at: 50%`, `looks: 1`, `bounds: O'Brien-Fleming`, `futility:` | | Decoys | inputs the scorer must reject or score low; how many, how they were made, what a decoy pass proves | | Stop rules | the spend cap, a bar missed on the pilot, a scorer below its bar, `budget_exhausted`, the first quota or rate-limit error on a seat-metered arm | | Held-out exposure | every held-out set the plan touches: prior exposure (which runs, which models), the reservation on it; and how each task machine was checked, before any session, for answers the agent could read there (other git refs such as `git log --all`, build and package caches, archives and the task's own work tree; never a sweep of `/`, runner state or `~/.ssh`) | @@ -107,8 +119,15 @@ at least one, so `expected` is 1 or more and the summarizer is shown to find it. kappa of 0.6 or better, and the comparison is paired with a 95% interval and its smallest detectable difference stated now. +3. **The eval-loop checks** (docs/TESTING_INTERNALS.md#eval-loop-checks): the Pilot, + Cost and (above 500 dollars paid) Interim look sections; the judge's `per-arm:` and + `effort:`; a `regression test` bar beside any arm that asks for a smaller change + or less code, because a shorter diff can come from skipping the test; and an + `answers:` line under Held-out exposure. + A `frozen: YYYY-MM-DD` line before 2026-11-15 keeps the rules it was frozen under -(`result_checks=exempt`). +(`result_checks=exempt`); one before 2026-11-21 skips item 3 (`loop_checks=exempt`) +and keeps the models it named. ### Step 1b: Arms and their price @@ -125,9 +144,10 @@ page or drop the arm. Copy the priced arms into the Arms section. An arm identit `#` (for example `claude-opus-5-5#no-gstack`) is priced by its model and gets its own pilot attempts; naming one identity twice is `EVAL_ARM_DUPLICATE`. -Models under test are frontier models (`claude-opus-5-5`, `gpt-6.1-sol`, at most one named +Models under test are frontier models (`claude-opus-5-5`, `gpt-6.2-sol`, at most one named low-cost primary); a Haiku or Sonnet arm only with a stated tier question -(docs/TESTING_INTERNALS.md#frontier-models-under-test). +(docs/TESTING_INTERNALS.md#frontier-models-under-test). Judges: `gpt-6-astra` or +`gpt-6.2-astra` for Claude arms, `claude-opus-5-5` for GPT arms. When the repo commits `.gstack/eval-models.json` (allow, deny, per-scope lists, families newest first; `docs/eval-models.md` in gstack), `arms`, `dry-run`, `pilot start` and @@ -195,6 +215,12 @@ anything else (`EVAL_DRY_RUN_FAILED`). ~/.claude/skills/gstack/bin/gstack-eval-plan pilot start --out --cap --arms --dry-run ``` +The pilot is uncounted and runs per arm, on at most a tenth of that arm's budget. It shows, +on that arm's own outputs, that the part under test ran, that the judge passes its label check +there, and that the units can be supplied. It draws at least one unit of every type the +counted run uses, in an order from a fixed seed, so a restart at another concurrency draws the +same items. An arm that fails is fixed or left out, and reported as left out. + `pilot start` reserves three attempts per arm through the spend ledger (`spend.json` in `--out`): admission is `spent + reserved + unknown + estimate <= cap`, under a file lock shared with any concurrent worker. Run each `PILOT_ATTEMPT:` through the project's own @@ -231,7 +257,10 @@ then: ~/.claude/skills/gstack/bin/gstack-eval-plan judge --check --labels ``` -`JUDGE_AGREEMENT: ok` continues. `EVAL_JUDGE_UNCHECKED` (exit 1) means too few labels, +Give each label row its `"arm"`: with `per-arm: yes`, each `JUDGE_ARM:` line must meet the +bar on its own. Start every judge or reader subagent with its model and reasoning effort +set; left unset, it inherits its parent's, and a reader that inherited the highest effort +cost about four times the default. `JUDGE_AGREEMENT: ok` continues. `EVAL_JUDGE_UNCHECKED` (exit 1) means too few labels, one class, or kappa below the bar: replace the judge or fix its prompt, then relabel; never lower the bar. @@ -264,7 +293,9 @@ question with the projection as the recommended option only when `verdict=within Under `SESSION_KIND: unattended` write the question as an `approval` gate item through `gstack-gate` and end with `GSTACK_RESULT: skill=eval-plan status=gate_pending run=`. The full run, when approved, keeps settling every attempt into the same ledger and reprints -the spend table at each gate; `budget_exhausted` stops it. +the spend table at each gate; `budget_exhausted` stops it. Above 500 dollars paid it takes the one +preregistered look at half the units and stops on its O'Brien-Fleming or futility bound; +it takes no other look. ## Step 5: Results beside the no-gstack arm @@ -288,6 +319,9 @@ leaves the run (a report, a READY block, a PR body), check it: it (failures by the grader's own rule on the final answer); a broader count can rise while that one stays flat. +Write the actual paid and meter cost, and the decision the run settled (or "none"), to the +Cost section's `ledger:` file; the public page carries the decision, not the cost. + The results file opens with two or three plain takeaways ("We learned X. You should do X."): what works first, then what didn't, with its number. Cost appears only as part of a lesson, and nothing is opened without a stated reason (ETHOS.md, Explain the Number). diff --git a/lib/eval-plan-checks.ts b/lib/eval-plan-checks.ts index 4491fc3962..c269f581b1 100644 --- a/lib/eval-plan-checks.ts +++ b/lib/eval-plan-checks.ts @@ -15,7 +15,7 @@ const PLACEHOLDER = /^(?:|-+|—|n\/a|none|tbd|todo|\?)\.?$/i; const keyValues = (body: string[]) => { const kv: Record = {}; for (const line of body) { - const m = /^\s*(?:[-*]\s+)?([a-z]+):(.*)$/i.exec(line); + const m = /^\s*(?:[-*]\s+)?([a-z][a-z-]*):(.*)$/i.exec(line); if (m) kv[m[1]!.toLowerCase()] = m[2]!.trim().replace(/^`(.*)`$/, '$1'); } return kv; @@ -36,6 +36,80 @@ export function modelFamily(model: string): string { return labs[head] ?? head; } +/** + * The eval-loop checks (docs/TESTING_INTERNALS.md#eval-loop-checks), dated + * LOOP_CHECKS_SINCE: an uncounted pilot per arm of at most a tenth of its + * budget that draws every unit type in a seeded order, a judge read per arm at + * a stated effort, a cost line, one preregistered look at half the units for a + * counted run above INTERIM_LOOK_ABOVE_USD, "smaller" scored with tests, and a + * check that the task machine holds no answers. A quick look (`kind: quick + * look`) is a three-line plan capped at QUICK_LOOK_MAX_USD that publishes no + * number. A preregistration frozen before LOOP_CHECKS_SINCE keeps its rules. + */ +export const LOOP_CHECKS_SINCE = '2026-11-21'; +export const PILOT_MAX_SHARE_PCT = 10; +export const INTERIM_LOOK_ABOVE_USD = 500; +export const QUICK_LOOK_MAX_USD = 100; +export const loopGrandfathered = (text: string) => { const d = frozenDate(text); return d !== null && d < LOOP_CHECKS_SINCE; }; +export const isQuickLook = (text: string) => /^\s*kind:\s*quick[- ]look\s*$/im.test(text); +const filled = (v: string | undefined) => v !== undefined && !PLACEHOLDER.test(v.trim()) && !/^<.*>$/.test(v.trim()); +const dollars = (v: string | undefined) => { const m = /^\$?\s*(\d{1,3}(?:,\d{3})+|\d+)(\.\d{1,2})?$/.exec((v ?? '').trim()); return m ? Number(m[1]!.replace(/,/g, '') + (m[2] ?? '')) : null; }; +const SMALLER = /\b(smaller (?:change|diff|patch)|less code|fewer lines|shorter diff|minimal diff|diff size)\b/i; + +export interface QuickLookCheck { cap: number | null; errors: string[] } +/** `kind: quick look`: `question:`, `decision:`, `stop:` and `cap:` at most QUICK_LOOK_MAX_USD paid. It publishes no number. */ +export function checkQuickLook(text: string): QuickLookCheck { + const kv = keyValues(text.split('\n')); + const errors = (['question', 'decision', 'stop'] as const).filter(k => !filled(kv[k])).map(k => `no ${k}: line (a quick look is three lines: question, decision, stop rule)`); + const cap = dollars(kv.cap); + if (cap === null || cap > QUICK_LOOK_MAX_USD) errors.push(`cap: needs a plain dollar amount (such as $100) of at most $${QUICK_LOOK_MAX_USD}; anything bigger is a counted run with a full preregistration`); + return { cap, errors }; +} + +export interface LoopCheck { paid: number | null; interim_required: boolean; errors: Array<{ section: string; message: string }> } +export interface LoopSections { pilot: string[] | null; cost: string[] | null; interim: string[] | null; scoring: string[] | null; bars: string[] | null; arms: string[] | null; heldOut: string[] | null } +/** The dated eval-loop checks over a counted run's preregistration sections. */ +export function checkLoop(s: LoopSections): LoopCheck { + const errors: LoopCheck['errors'] = []; + const add = (section: string, message: string) => errors.push({ section, message }); + const scoring = keyValues(s.scoring ?? []); + const modelJudge = filled(scoring.judge); + if (s.pilot?.length) { + const kv = keyValues(s.pilot); + const share = firstNumber(kv.share); + if (share === null || share <= 0 || share > PILOT_MAX_SHARE_PCT) add('Pilot', `share: each arm's pilot spends at most ${PILOT_MAX_SHARE_PCT}% of that arm's budget`); + if (!/^no\b/i.test(kv.counted ?? '')) add('Pilot', 'counted: no (pilot items never count toward the result)'); + for (const [k, what] of [['ran', 'how the pilot shows, on each arm\'s own outputs, that the part under test ran'], ['supply', 'how the pilot shows the units can be supplied at the planned rate'], ['units', 'every unit type the counted run uses, each drawn at least once in the pilot'], ['seed', 'the fixed seed for the draw order, which does not depend on the number of workers']] as const) if (!filled(kv[k])) add('Pilot', `${k}: ${what}`); + if (modelJudge && !filled(kv.judge)) add('Pilot', 'judge: how the judge is checked against labels on each arm\'s pilot outputs'); + } + if (modelJudge) { + if (!/^yes\b/i.test(scoring['per-arm'] ?? '')) add('Scoring', 'per-arm: yes (the judge\'s agreement is read on each arm\'s outputs, not pooled)'); + if (!filled(scoring.effort)) add('Scoring', 'effort: the reasoning effort set in the judge\'s start (left unset, it inherits its parent\'s)'); + } + const cost = keyValues(s.cost ?? []); + const paid = dollars(cost.paid); + if (s.cost?.length) { + if (paid === null) add('Cost', 'paid: the counted run\'s paid budget as a plain dollar amount, such as $1,200 (no k, ranges, units or arithmetic)'); + if (!filled(cost.meter)) add('Cost', 'meter: the expected meter spend (agent and machine time), or $0'); + if (!filled(cost.ledger)) add('Cost', 'ledger: the private file where the actual cost and the decision it settled are written'); + } + const interim_required = paid !== null && paid > INTERIM_LOOK_ABOVE_USD; + if (interim_required) { + const kv = keyValues(s.interim ?? []); + if (!s.interim?.length) add('Interim look', `missing: a counted run above $${INTERIM_LOOK_ABOVE_USD} preregisters one look at half its units`); + else { + if (firstNumber(kv.at) !== 50) add('Interim look', 'at: 50% (the one look comes at half the units)'); + if (firstNumber(kv.looks) !== 1) add('Interim look', 'looks: 1 (no other look is taken)'); + if (!/o['’]?brien[- ]fleming/i.test(kv.bounds ?? '')) add('Interim look', 'bounds: O\'Brien-Fleming stop bounds, with their values'); + if (!filled(kv.futility)) add('Interim look', 'futility: the result at the look that stops the run as unable to reach its bar'); + } + } + if (SMALLER.test([...(s.arms ?? []), ...(s.bars ?? [])].join('\n')) && !(s.bars ?? []).some(l => /regression test/i.test(l))) add('Bars', 'an arm asks for a smaller change or less code, so "regression test added" is a co-primary bar (a shorter diff can come from skipping the test)'); + const answers = (s.heldOut ?? []).map(l => /^\s*(?:[-*]\s+)?answers(?: on the task machine)?:(.*)$/i.exec(l)?.[1]).find(v => v !== undefined); + if (s.heldOut?.length && !filled(answers?.trim().replace(/^`(.*)`$/, '$1'))) add('Held-out exposure', 'answers: how each task machine was checked, before any session, for answers the agent could read there'); + return { paid, interim_required, errors }; +} + export interface DecisionsCheck { outcomes: Array<{ result: string; action: string }>; errors: string[] } /** `## Decisions`: one `if : ` line per possible result, at least two, and not all the same action. */ export function checkDecisions(body: string[] | null): DecisionsCheck { @@ -53,7 +127,7 @@ export function checkDecisions(body: string[] | null): DecisionsCheck { return { outcomes, errors }; } -export interface ScoringCheck { judge: string | null; labels: number | null; agreement: number | null; errors: string[] } +export interface ScoringCheck { judge: string | null; labels: number | null; agreement: number | null; errors: string[]; per_arm?: boolean } /** * `## Scoring`: `judge: none` or the judge model; a model judge needs `labels:` * (at least 40) and `agreement:` (a kappa bar of at least 0.6) and a family no @@ -79,10 +153,10 @@ export function checkScoring(body: string[] | null, arms: string[]): ScoringChec if (firstNumber(kv.interval) !== 95) errors.push('interval: 95% (the interval every comparison is reported with)'); if (PLACEHOLDER.test(kv.mdd ?? '')) errors.push('mdd: the smallest difference this run can detect, stated before the run'); } - return { judge, labels, agreement, errors }; + return { judge, labels, agreement, errors, per_arm: /^yes\b/i.test(kv['per-arm'] ?? '') }; } -export interface JudgeLabelCheck { ok: boolean; judge: string; n: number; kappa: number | null; need_n: number; need_kappa: number; problems: string[] } +export interface JudgeLabelCheck { ok: boolean; judge: string; n: number; kappa: number | null; need_n: number; need_kappa: number; problems: string[]; arms: Array<{ arm: string; n: number; kappa: number | null }> } /** Cohen's kappa over paired categorical labels; null when chance agreement is total (every label one class). */ export function cohensKappa(pairs: Array<[string, string]>): number | null { @@ -96,26 +170,40 @@ export function cohensKappa(pairs: Array<[string, string]>): number | null { } /** Score the preregistered judge against a JSONL file of `{"id", "human", "judge"}` rows. */ -export function checkJudgeLabels(scoring: ScoringCheck, labelsText: string): JudgeLabelCheck { +export function checkJudgeLabels(scoring: ScoringCheck, labelsText: string, planArms: string[] = []): JudgeLabelCheck { const need_n = Math.max(JUDGE_MIN_LABELS, scoring.labels ?? 0); const need_kappa = Math.max(JUDGE_MIN_KAPPA, scoring.agreement ?? 0); const problems: string[] = []; const pairs: Array<[string, string]> = []; const ids = new Set(); + const byArm = new Map>(); + let unarmed = 0; labelsText.split('\n').forEach((line, i) => { if (!line.trim()) return; - let row: { id?: unknown; human?: unknown; judge?: unknown } | null = null; + let row: { id?: unknown; human?: unknown; judge?: unknown; arm?: unknown } | null = null; try { row = JSON.parse(line); } catch { row = null; } if (!row || typeof row !== 'object' || ![row.id, row.human, row.judge].every(v => (typeof v === 'string' && v.trim() !== '') || typeof v === 'number' || typeof v === 'boolean')) { problems.push(`line ${i + 1}: needs {"id", "human", "judge"}, each a string, number or boolean`); return; } if (ids.has(String(row.id))) { problems.push(`id ${String(row.id)} is labelled twice`); return; } ids.add(String(row.id)); pairs.push([String(row.human), String(row.judge)]); + const arm = typeof row.arm === 'string' && row.arm.trim() ? row.arm.trim() : null; + if (arm) byArm.set(arm, [...(byArm.get(arm) ?? []), [String(row.human), String(row.judge)]]); else unarmed++; }); const kappa = cohensKappa(pairs); if (pairs.length < need_n) problems.push(`${pairs.length} labelled outputs, needs ${need_n}`); if (pairs.length && kappa === null) problems.push('every label is one class, so agreement is undefined; label outputs of every kind the judge scores'); else if (kappa !== null && kappa < need_kappa) problems.push(`kappa ${kappa.toFixed(2)} is below the bar ${need_kappa}`); - return { ok: problems.length === 0, judge: scoring.judge ?? 'none', n: pairs.length, kappa, need_n, need_kappa, problems }; + const arms = [...byArm].map(([arm, p]) => ({ arm, n: p.length, kappa: cohensKappa(p) })); + if (scoring.per_arm && unarmed) problems.push(`per-arm: yes needs an "arm" on every label row; ${unarmed} have none`); + const planned = [...new Set(planArms)]; + if (scoring.per_arm) { + const unlabelled = planned.filter(a => !byArm.has(a)); + const unknown = [...byArm.keys()].filter(a => planned.length && !planned.includes(a)); + if (unlabelled.length) problems.push(`per-arm: yes needs labels from every arm in ## Arms; no rows for ${unlabelled.join(', ')}`); + if (unknown.length) problems.push(`label rows name arms that are not in ## Arms: ${unknown.join(', ')}`); + } + if (scoring.per_arm) for (const a of arms) if (a.kappa === null || a.kappa < need_kappa) problems.push(`arm ${a.arm}: kappa ${a.kappa === null ? 'undefined' : a.kappa.toFixed(2)} on its ${a.n} labels is below the bar ${need_kappa}; the judge does not pass on this arm's outputs`); + return { ok: problems.length === 0, judge: scoring.judge ?? 'none', n: pairs.length, kappa, need_n, need_kappa, problems, arms }; } -export const renderJudgeLabels = (c: JudgeLabelCheck) => `JUDGE_AGREEMENT: ${c.ok ? 'ok' : 'unchecked'} judge=${c.judge} n=${c.n}/${c.need_n} kappa=${c.kappa === null ? 'undefined' : c.kappa.toFixed(2)} bar=${c.need_kappa}\n`; +export const renderJudgeLabels = (c: JudgeLabelCheck) => c.arms.map(a => `JUDGE_ARM: ${a.arm} n=${a.n} kappa=${a.kappa === null ? 'undefined' : a.kappa.toFixed(2)} bar=${c.need_kappa}\n`).join('') + `JUDGE_AGREEMENT: ${c.ok ? 'ok' : 'unchecked'} judge=${c.judge} n=${c.n}/${c.need_n} kappa=${c.kappa === null ? 'undefined' : c.kappa.toFixed(2)} bar=${c.need_kappa}\n`; diff --git a/lib/eval-plan-report.ts b/lib/eval-plan-report.ts index beabde8865..662407febd 100644 --- a/lib/eval-plan-report.ts +++ b/lib/eval-plan-report.ts @@ -55,13 +55,17 @@ export function checkResults(preregText: string, resultsText: string, labelsText if (!tables.length) issues.push({ code: 'EVAL_REPORT_NO_GSTACK_ROW', message: 'no markdown table in the results file' }); else for (const id of missing) issues.push({ code: 'EVAL_REPORT_NO_GSTACK_ROW', message: `no filled row for ${id} in the table that holds the other arms` }); } + if (prereg.quick) issues.push({ code: 'EVAL_QUICK_LOOK_NO_NUMBER', message: 'the plan is a quick look (kind: quick look), which publishes no number; write a counted-run preregistration to publish one' }); + for (const s of prereg.missing) issues.push({ code: 'PREREG_INCOMPLETE', message: `## ${s}: missing` }); + for (const s of prereg.empty) issues.push({ code: 'PREREG_INCOMPLETE', message: `## ${s}: empty` }); + for (const e of prereg.loop.errors) issues.push({ code: 'PREREG_INCOMPLETE', message: `## ${e.section}: ${e.message}` }); let judge: JudgeLabelCheck | null = null; if (!prereg.grandfathered) { for (const [section, errors] of [['Decisions', prereg.decisions.errors], ['Scoring', prereg.scoring.errors]] as const) { for (const e of errors) issues.push({ code: 'PREREG_INCOMPLETE', message: `## ${section}: ${e}` }); } if (prereg.scoring.judge && prereg.scoring.judge.toLowerCase() !== 'none') { - judge = labelsText === null ? null : checkJudgeLabels(prereg.scoring, labelsText); + judge = labelsText === null ? null : checkJudgeLabels(prereg.scoring, labelsText, arms); if (!judge) issues.push({ code: 'EVAL_JUDGE_UNCHECKED', message: `the preregistration names judge ${prereg.scoring.judge}; pass --labels ` }); else if (!judge.ok) issues.push({ code: 'EVAL_JUDGE_UNCHECKED', message: judge.problems.join('; ') }); } diff --git a/lib/eval-plan.ts b/lib/eval-plan.ts index 98f3c3ed0c..fc6ee6e018 100644 --- a/lib/eval-plan.ts +++ b/lib/eval-plan.ts @@ -19,19 +19,21 @@ import { EXCLUDED_BILLING_CATEGORIES, estimateCostUsd, hasPricing, PRICING, pric import type { ResultCodeName } from './result-codes'; import type { ModelRulesCheck } from './eval-models'; import { readLedger, release, reserve, settle, SpendCapExceeded, summarize, type SpendLedger, type SpendSummary } from './spend-ledger'; -import { checkDecisions, checkScoring, frozenDate, grandfathered, type DecisionsCheck, type ScoringCheck } from './eval-plan-checks'; +import { checkDecisions, checkLoop, checkQuickLook, checkScoring, frozenDate, grandfathered, isQuickLook, loopGrandfathered, type DecisionsCheck, type LoopCheck, type QuickLookCheck, type ScoringCheck } from './eval-plan-checks'; // --------------------------------------------------------------------------- // preregistration // --------------------------------------------------------------------------- -export const PREREG_SECTIONS = ['Bars', 'Decisions', 'Arms', 'Comparison', 'Scoring', 'Decoys', 'Stop rules', 'Held-out exposure'] as const; +export const PREREG_SECTIONS = ['Bars', 'Decisions', 'Arms', 'Comparison', 'Scoring', 'Pilot', 'Cost', 'Decoys', 'Stop rules', 'Held-out exposure'] as const; /** Sections added with the result checks; a preregistration frozen before them (`frozen:` before RESULT_CHECKS_SINCE) is not asked for them. */ const RESULT_CHECK_SECTIONS: readonly string[] = ['Decisions', 'Scoring']; +/** Sections added with the eval-loop checks (`frozen:` before LOOP_CHECKS_SINCE is not asked for them). */ +const LOOP_CHECK_SECTIONS: readonly string[] = ['Pilot', 'Cost']; /** `## Comparison`: `stack: loaded` when any arm loads gstack or another skill stack, `stack: none` with a `why:` otherwise. */ export interface ComparisonCheck { stack: 'loaded' | 'none' | null; why: string | null; errors: string[] } /** `## No-gstack arm`, required when `stack: loaded`: one `#no-gstack` Arms line per model, the inputs, prompt, panel and report it shares with the variants, and its masking, install and audit lines. */ export interface NoGstackArmCheck { required: boolean; ok: boolean; arms: string[]; problems: string[] } -export interface PreregCheck { ok: boolean; present: string[]; missing: string[]; empty: string[]; comparison: ComparisonCheck; no_gstack: NoGstackArmCheck; diagnostics: PreregDiagnostics | null; decisions: DecisionsCheck; scoring: ScoringCheck; frozen: string | null; grandfathered: boolean } +export interface PreregCheck { ok: boolean; present: string[]; missing: string[]; empty: string[]; comparison: ComparisonCheck; no_gstack: NoGstackArmCheck; diagnostics: PreregDiagnostics | null; decisions: DecisionsCheck; scoring: ScoringCheck; frozen: string | null; grandfathered: boolean; loop: LoopCheck; loop_grandfathered: boolean; quick: QuickLookCheck | null } export const NO_GSTACK_LOADOUT = 'no-gstack'; /** masking, install and audit keep the arm clean (TESTING_INTERNALS.md#no-gstack-arm): an arm that read a gstack skill file is contaminated. */ export const NO_GSTACK_KEYS = ['arms', 'inputs', 'prompt', 'panel', 'report', 'masking', 'install', 'audit'] as const; @@ -46,7 +48,7 @@ export function preregTemplate(title = 'Eval preregistration'): string { ## Arms - + ## Comparison @@ -55,7 +57,16 @@ export function preregTemplate(title = 'Eval preregistration'): string { ## Scoring - + + +## Pilot + + +## Cost + + +## Interim look + ## Decoys @@ -70,6 +81,19 @@ export function preregTemplate(title = 'Eval preregistration'): string { `; } +/** `prereg --init --quick`: a quick look, three lines and a cap, that publishes no number (docs/TESTING_INTERNALS.md#eval-loop-checks). */ +export function quickLookTemplate(title = 'Quick look'): string { + return `# ${title} + +kind: quick look +question: +decision: +stop: +cap: $100 + +`; +} + /** A section's content lines (blank lines and `` guidance, one-line or multi-line, dropped); null when the heading is absent. */ function sectionBody(text: string, name: string): string[] | null { const lines = text.split('\n'); @@ -141,8 +165,15 @@ function checkNoGstackArm(text: string, stack: ComparisonCheck['stack']): NoGsta export function checkPrereg(text: string): PreregCheck { const present: string[] = []; const missing: string[] = []; const empty: string[] = []; const exempt = grandfathered(text); + const loopExempt = loopGrandfathered(text); + const noLoop: LoopCheck = { paid: null, interim_required: false, errors: [] }; + if (isQuickLook(text)) { + const quick = checkQuickLook(text); + return { ok: !quick.errors.length, present, missing, empty, comparison: { stack: null, why: null, errors: [] }, no_gstack: { required: false, ok: true, arms: [], problems: [] }, diagnostics: null, decisions: { outcomes: [], errors: [] }, scoring: { judge: null, labels: null, agreement: null, errors: [] }, frozen: frozenDate(text), grandfathered: exempt, loop: noLoop, loop_grandfathered: loopExempt, quick }; + } for (const name of PREREG_SECTIONS) { if (exempt && RESULT_CHECK_SECTIONS.includes(name)) continue; + if (loopExempt && LOOP_CHECK_SECTIONS.includes(name)) continue; const body = sectionBody(text, name); if (body === null) missing.push(name); else if (body.length === 0) empty.push(name); else present.push(name); } @@ -151,8 +182,10 @@ export function checkPrereg(text: string): PreregCheck { const diagnostics = parsePreregDiagnostics(text); const decisions = exempt ? { outcomes: [], errors: [] } : checkDecisions(sectionBody(text, 'Decisions')); const scoring = exempt ? { judge: null, labels: null, agreement: null, errors: [] } : checkScoring(sectionBody(text, 'Scoring'), armIdentities(text)); - const ok = missing.length === 0 && empty.length === 0 && !comparison.errors.length && no_gstack.ok && !diagnostics?.errors.length && !decisions.errors.length && !scoring.errors.length; - return { ok, present, missing, empty, comparison, no_gstack, diagnostics, decisions, scoring, frozen: frozenDate(text), grandfathered: exempt }; + const section = (name: string) => sectionBody(text, name); + const loop = loopExempt ? noLoop : checkLoop({ pilot: section('Pilot'), cost: section('Cost'), interim: section('Interim look'), scoring: section('Scoring'), bars: section('Bars'), arms: section('Arms'), heldOut: section('Held-out exposure') }); + const ok = missing.length === 0 && empty.length === 0 && !comparison.errors.length && no_gstack.ok && !diagnostics?.errors.length && !decisions.errors.length && !scoring.errors.length && !loop.errors.length; + return { ok, present, missing, empty, comparison, no_gstack, diagnostics, decisions, scoring, frozen: frozenDate(text), grandfathered: exempt, loop, loop_grandfathered: loopExempt, quick: null }; } // --------------------------------------------------------------------------- @@ -317,7 +350,7 @@ export interface DryRunResult { export interface DryRunOptions { input: string; arms: string[]; fields?: string[]; outputBudget?: number; retryPrompt?: string; maxRows?: number; cap?: number; modelRules?: ModelRulesCheck; tierQuestion?: string } /** Today's frontier models under test (R54, docs/TESTING_INTERNALS.md#frontier-models-under-test); a small-tier plan is re-costed on these. */ -export const FRONTIER_MODELS = ['claude-opus-5-5', 'gpt-6.1-sol'] as const; +export const FRONTIER_MODELS = ['claude-opus-5-5', 'gpt-6.2-sol'] as const; export const isSmallTierModel = (model: string) => /(^|[-/])(haiku|sonnet)(-|$)/i.test(model); /** Four bytes per token, the estimator every gstack admission uses. */ diff --git a/lib/inventory.ts b/lib/inventory.ts index 67a45ed53f..c498456098 100644 --- a/lib/inventory.ts +++ b/lib/inventory.ts @@ -53,8 +53,8 @@ export const DISPATCHES: Dispatch[] = [ export const STATUSES = ['helps', 'no-effect', 'hurts', 'untested', 'safety'] as const; export type Status = (typeof STATUSES)[number]; export const R48_VERDICTS = ['KEEP', 'FIX-METHOD', 'CUT-CANDIDATE'] as const; -/** R54: the frontier models under test; a row may add at most one named low-cost primary, never Haiku or Sonnet. */ -export const FRONTIER_MODELS = ['claude-opus-5-5', 'gpt-6.1-sol']; +/** R54: the frontier models under test (GPT-6.2 Sol for new plans; rows measured on 6.1 Sol keep it); a row may add at most one named low-cost primary, never Haiku or Sonnet. */ +export const FRONTIER_MODELS = ['claude-opus-5-5', 'gpt-6.2-sol', 'gpt-6.1-sol']; /** Why an earlier result does not count as fair evidence yet. */ export const PRIOR_WHY: Record = { stub: 'ran on the Agent SDK stub prompt, not the claude_code preset', diff --git a/lib/pricing.ts b/lib/pricing.ts index f6d8035afd..5f97d0a759 100644 --- a/lib/pricing.ts +++ b/lib/pricing.ts @@ -61,6 +61,10 @@ export const PRICING: Record = { 'gpt-6-astra': { input_per_mtok: 10.00, output_per_mtok: 50.00, cached_input_per_mtok: 1.00, as_of: '2026-09' }, // https://developers.openai.com/api/docs/models/gpt-6.1-sol (standard tier, up to 272K input) 'gpt-6.1-sol': { input_per_mtok: 2.00, output_per_mtok: 10.00, cached_input_per_mtok: 0.10, as_of: '2026-10' }, + // https://developers.openai.com/api/docs/models/gpt-6.2-sol (fetched 2026-11-21; standard tier, up to 272K input) + 'gpt-6.2-sol': { input_per_mtok: 2.00, output_per_mtok: 10.00, cached_input_per_mtok: 0.10, as_of: '2026-11' }, + // https://developers.openai.com/api/docs/models/gpt-6.2-astra (fetched 2026-11-21; standard tier, up to 272K input) + 'gpt-6.2-astra': { input_per_mtok: 8.00, output_per_mtok: 40.00, cached_input_per_mtok: 0.40, as_of: '2026-11' }, // https://developers.openai.com/api/docs/models/gpt-6-luna (fetched 2026-10-31; standard tier, up to 272K input) 'gpt-6-luna': { input_per_mtok: 0.10, output_per_mtok: 0.50, cached_input_per_mtok: 0.01, as_of: '2026-10' }, 'gpt-5.4': { input_per_mtok: 2.50, output_per_mtok: 10.00, as_of: '2026-04' }, diff --git a/lib/result-codes-eval.ts b/lib/result-codes-eval.ts index 23d6143cf6..fe5194a46c 100644 --- a/lib/result-codes-eval.ts +++ b/lib/result-codes-eval.ts @@ -46,6 +46,12 @@ export const EVAL_RESULT_CODES = { summary: 'a results table counts failures without an answer-only column beside it, so a rise in failures cannot be compared with the grader\'s own reading', fix: 'add a column headed answer-only to the same table, counting failures by the grader\'s rule on the final answer alone, and report both readings', }, + // Eval-loop practice R112 (docs/TESTING_INTERNALS.md#eval-loop-checks): a quick look publishes no number. + EVAL_QUICK_LOOK_NO_NUMBER: { + anchor: 'eval-quick-look-no-number', + summary: 'results --check was given a quick look (kind: quick look), which only opens or closes a question and publishes no number', + fix: 'keep the quick look\'s answer as an opened or closed question; to publish a number, write a counted-run preregistration (prereg --init) and run it through the pilot', + }, EVAL_ARM_DUPLICATE: { anchor: 'eval-arm-duplicate', summary: 'the pilot was given the same arm identity twice, so two arms would share one set of attempts', diff --git a/test/eval-plan-loop-checks.test.ts b/test/eval-plan-loop-checks.test.ts new file mode 100644 index 0000000000..0e504f3c8d --- /dev/null +++ b/test/eval-plan-loop-checks.test.ts @@ -0,0 +1,131 @@ +/** + * The eval-loop checks behind /eval-plan (docs/TESTING_INTERNALS.md#eval-loop-checks): + * an uncounted pilot per arm on at most a tenth of its budget that draws every unit + * type in a seeded order, a judge read per arm at a stated effort, a cost line, one + * preregistered look at half the units above $500 paid, "smaller" scored with tests, + * an answers check on the task machine, and a quick look that publishes no number. + */ +import { describe, expect, test } from 'bun:test'; +import { checkPrereg, quickLookTemplate } from '../lib/eval-plan'; +import { checkJudgeLabels, LOOP_CHECKS_SINCE } from '../lib/eval-plan-checks'; +import { checkResults } from '../lib/eval-plan-report'; + +const PILOT: Record = { share: '10%', counted: 'no', ran: "the skill's tool calls appear in each arm's transcripts", judge: "labels checked on each arm's pilot outputs", supply: 'three development rows per arm at the planned rate', units: 'bug fix, refactor and docs tasks, one each', seed: '7, independent of the number of workers' }; +const COST: Record = { paid: '$200', meter: '$40', ledger: 'the private spend ledger' }; +const INTERIM: Record = { at: '50%', looks: '1', bounds: "O'Brien-Fleming, |z| >= 2.80 at the look, 1.98 at the end", futility: 'stop when the paired difference is below zero at the look' }; +const kv = (o: Record) => Object.entries(o).map(([k, v]) => `${k}: ${v}`).join('\n'); +const without = (o: Record, k: string) => Object.fromEntries(Object.entries(o).filter(([key]) => key !== k)); +const plan = (o: { pilot?: Record; cost?: Record; interim?: Record | null; scoring?: string; arms?: string; bars?: string; heldOut?: string; frozen?: string } = {}) => [ + o.frozen ? `frozen: ${o.frozen}\n` : '', + `## Bars\n${o.bars ?? '- pass rate, higher is better'}\n`, + '## Decisions\nif the skill arm passes more items: keep the skill\nif there is no difference: cut the skill\n', + `## Arms\n${o.arms ?? '- claude-opus-5-5 the skill installed\n- claude-opus-5-5#plain no skill'}\n`, + '## Comparison\nstack: none\nwhy: prompts compared, not skill stacks\n', + `## Scoring\n${o.scoring ?? 'judge: gpt-6.2-astra\nlabels: 40\nagreement: 0.6\nper-arm: yes\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items'}\n`, + `## Pilot\n${kv(o.pilot ?? PILOT)}\n`, + `## Cost\n${kv(o.cost ?? COST)}\n`, + o.interim === null || o.interim === undefined ? '' : `## Interim look\n${kv(o.interim)}\n`, + '## Decoys\n- filled in\n', '## Stop rules\n- filled in\n', + `## Held-out exposure\n- none touched\n${o.heldOut ?? 'answers: other git refs and build caches checked on each task machine'}\n`, +].join('\n'); +const messages = (text: string) => checkPrereg(text).loop.errors.map(e => `${e.section}: ${e.message.split(' ')[0]}`); + +describe('## Pilot (R111, G12)', () => { + test('a complete pilot passes', () => { + expect(checkPrereg(plan())).toMatchObject({ ok: true, missing: [], empty: [] }); + }); + + test('a share above a tenth, a counted pilot, or a missing ran, supply, units, seed or judge line fails', () => { + expect(messages(plan({ pilot: { ...PILOT, share: '15%' } }))).toEqual(['Pilot: share:']); + expect(messages(plan({ pilot: { ...PILOT, counted: 'yes' } }))).toEqual(['Pilot: counted:']); + for (const k of ['ran', 'supply', 'units', 'seed', 'judge']) expect(messages(plan({ pilot: without(PILOT, k) }))).toEqual([`Pilot: ${k}:`]); + expect(checkPrereg(plan({ pilot: without(PILOT, 'judge'), scoring: 'judge: none\npaired: yes\ninterval: 95%\nmdd: 3' })).ok).toBe(true); + }); + + test('a missing Pilot or Cost section is missing', () => { + expect(checkPrereg(plan().replace(/## Pilot[\s\S]*?(?=## Cost)/, '')).missing).toEqual(['Pilot']); + }); +}); + +describe('## Scoring per arm and effort (R78, G14)', () => { + test('a model judge needs per-arm: yes and an effort; judge: none needs neither', () => { + expect(messages(plan({ scoring: 'judge: gpt-6-astra\nlabels: 40\nagreement: 0.6\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3' }))).toEqual(['Scoring: per-arm:']); + expect(messages(plan({ scoring: 'judge: gpt-6-astra\nlabels: 40\nagreement: 0.6\nper-arm: yes\npaired: yes\ninterval: 95%\nmdd: 3' }))).toEqual(['Scoring: effort:']); + }); + + test('with per-arm: yes, every label row names its arm and each arm meets the bar', () => { + const scoring = { judge: 'gpt-6.2-astra', labels: 40, agreement: 0.6, errors: [], per_arm: true }; + const row = (i: number, arm: string | null, flip: boolean) => JSON.stringify({ id: `i${i}`, ...(arm ? { arm } : {}), human: i % 2 ? 'pass' : 'fail', judge: (i % 2 ? 'pass' : 'fail') === 'pass' !== flip ? 'pass' : 'fail' }); + const rows = (arm: (i: number) => string | null, flip: (i: number) => boolean) => Array.from({ length: 40 }, (_, i) => row(i, arm(i), flip(i))).join('\n'); + const good = checkJudgeLabels(scoring, rows(i => (i < 20 ? 'a' : 'b'), i => i === 0)); + expect(good).toMatchObject({ ok: true }); + expect(good.arms.map(a => a.arm)).toEqual(['a', 'b']); + expect(checkJudgeLabels(scoring, rows(i => (i < 20 ? 'a' : null), () => false)).problems).toEqual(['per-arm: yes needs an "arm" on every label row; 20 have none']); + const pooledOk = checkJudgeLabels(scoring, rows(i => (i < 10 ? 'a' : 'b'), i => i < 4)); + expect(pooledOk.kappa).toBeGreaterThanOrEqual(0.6); + expect(pooledOk.problems.map(p => p.split(':')[0])).toEqual(['arm a']); + expect(checkJudgeLabels(scoring, rows(() => 'a', () => false), ['a', 'b']).problems).toEqual(['per-arm: yes needs labels from every arm in ## Arms; no rows for b']); + expect(checkJudgeLabels(scoring, rows(i => (i < 20 ? 'a' : 'typo'), () => false), ['a', 'b']).problems).toEqual(['per-arm: yes needs labels from every arm in ## Arms; no rows for b', 'label rows name arms that are not in ## Arms: typo']); + expect(checkJudgeLabels({ ...scoring, per_arm: false }, rows(i => (i < 10 ? 'a' : 'b'), i => i < 4), ['a', 'b'])).toMatchObject({ ok: true }); + }); +}); + +describe('## Cost and ## Interim look (R113)', () => { + test('a cost line needs paid dollars, a meter and a ledger', () => { + for (const k of ['paid', 'meter', 'ledger']) expect(messages(plan({ cost: without(COST, k) }))).toEqual([`Cost: ${k}:`]); + }); + + test('above $500 paid, one look at half the units with O\'Brien-Fleming and futility bounds is required; at $500 it is not', () => { + expect(checkPrereg(plan({ cost: { ...COST, paid: '$500' } })).ok).toBe(true); + const big = { ...COST, paid: '$1,200' }; + expect(messages(plan({ cost: big }))).toEqual(['Interim look: missing:']); + for (const paid of ['$2k', '$1e3', '6 arms x $100', '$150USD', '$500-$900']) expect(messages(plan({ cost: { ...COST, paid } }))).toEqual(['Cost: paid:']); + expect(checkPrereg(plan({ cost: { ...COST, paid: '1200.50' } })).loop.paid).toBe(1200.5); + expect(checkPrereg(plan({ cost: big, interim: INTERIM }))).toMatchObject({ ok: true, loop: { paid: 1200, interim_required: true } }); + expect(messages(plan({ cost: big, interim: { ...INTERIM, at: '30%' } }))).toEqual(['Interim look: at:']); + expect(messages(plan({ cost: big, interim: { ...INTERIM, looks: '3' } }))).toEqual(['Interim look: looks:']); + expect(messages(plan({ cost: big, interim: { ...INTERIM, bounds: 'Pocock' } }))).toEqual(['Interim look: bounds:']); + expect(messages(plan({ cost: big, interim: without(INTERIM, 'futility') }))).toEqual(['Interim look: futility:']); + }); +}); + +describe('smaller is scored with tests (G11) and no answers on the machine (G13)', () => { + test('an arm that asks for less code needs a regression-test bar', () => { + const arms = '- claude-opus-5-5#smaller "make the smaller change"\n- claude-opus-5-5#plain no instruction'; + expect(messages(plan({ arms }))).toEqual(['Bars: an']); + expect(checkPrereg(plan({ arms, bars: '- pass rate, higher is better\n- regression test added, co-primary, higher is better' })).ok).toBe(true); + }); + + test('held-out exposure says how each task machine was checked for answers', () => { + expect(messages(plan({ heldOut: '' }))).toEqual(['Held-out exposure: answers:']); + expect(messages(plan({ heldOut: 'Answers on the task machine: tbd' }))).toEqual(['Held-out exposure: answers:']); + expect(checkPrereg(plan({ heldOut: 'Answers on the task machine: git refs and caches checked' })).ok).toBe(true); + }); +}); + +describe('grandfathering by freeze date', () => { + test(`a plan frozen before ${LOOP_CHECKS_SINCE} keeps its rules; one frozen on it does not`, () => { + const old = plan({ frozen: '2026-11-20', pilot: {}, cost: {}, heldOut: '' }).replace(/## Pilot\n\n/, '').replace(/## Cost\n\n/, ''); + expect(checkPrereg(old)).toMatchObject({ ok: true, loop_grandfathered: true, grandfathered: false }); + expect(checkPrereg(old.replace('frozen: 2026-11-20', `frozen: ${LOOP_CHECKS_SINCE}`))).toMatchObject({ ok: false, loop_grandfathered: false, missing: ['Pilot', 'Cost'] }); + }); +}); + +describe('quick look (R112)', () => { + const quick = (cap = '$100', drop = '') => quickLookTemplate('q').replace('cap: $100', `cap: ${cap}`).split('\n').filter(l => !drop || !l.startsWith(drop)).join('\n').replace(/<[^!][^>]*>/g, 'filled'); + test('three lines and a cap of $100 or less pass, with no counted-run sections', () => { + expect(checkPrereg(quick())).toMatchObject({ ok: true, quick: { cap: 100, errors: [] } }); + }); + + test('a cap above $100 or a missing line fails', () => { + expect(checkPrereg(quick('$150')).quick!.errors[0]).toContain('at most $100'); + expect(checkPrereg(quick('$100k')).quick!.errors[0]).toContain('at most $100'); + expect(checkPrereg(quickLookTemplate('q')).quick!.errors.map(e => e.split(':')[0])).toEqual(['no question', 'no decision', 'no stop']); + for (const k of ['question', 'decision', 'stop']) expect(checkPrereg(quick('$100', k)).quick!.errors).toEqual([`no ${k}: line (a quick look is three lines: question, decision, stop rule)`]); + }); + + test('results --check refuses a quick look: it publishes no number', () => { + const r = checkResults(quick(), '| arm | pass rate |\n|---|---|\n| claude-opus-5-5 | 7/10 |\n'); + expect(r.issues.map(i => i.code)).toEqual(['EVAL_QUICK_LOOK_NO_NUMBER']); + }); +}); diff --git a/test/eval-plan-no-gstack-arm.test.ts b/test/eval-plan-no-gstack-arm.test.ts index 0d4ef98537..8291cef207 100644 --- a/test/eval-plan-no-gstack-arm.test.ts +++ b/test/eval-plan-no-gstack-arm.test.ts @@ -21,7 +21,8 @@ const tmp = () => { const d = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-no-g afterEach(() => { while (dirs.length) fs.rmSync(dirs.pop()!, { recursive: true, force: true }); }); const RESULT_SECTIONS = '## Decisions\nif the variant passes more items: adopt it\nif there is no difference: keep the default\n\n## Scoring\njudge: none\npaired: yes\ninterval: 95%\nmdd: 2 of 9 items\n'; -const BASE = ['Bars', 'Decoys', 'Stop rules', 'Held-out exposure'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n' + RESULT_SECTIONS; +const LOOP = '\n## Pilot\nshare: 10%\ncounted: no\nran: the part under test shows in each arm\'s own transcripts\njudge: labels checked on each arm\'s pilot outputs\nsupply: three development rows per arm at the planned rate\nunits: every task type, one each\nseed: 7, independent of the number of workers\n\n## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger\n\n## Held-out exposure\n- filled in\nanswers: other git refs and build caches checked on each task machine\n'; +const BASE = ['Bars', 'Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n' + RESULT_SECTIONS + LOOP; const ARMS = (...ids: string[]) => `\n## Arms\n${ids.map(id => `- ${id} default settings, $0.01 per item`).join('\n')}\n`; const LOADED = '\n## Comparison\nstack: loaded\n'; const NO_GSTACK = (o: Partial> = {}) => { @@ -190,10 +191,10 @@ describe('gstack-eval-plan prereg --check', () => { return { code: r.status, out: r.stdout ?? '', err: r.stderr ?? '' }; }; - test('a loaded comparison without the arm: one PREREG line out of 8, PREREG_NO_GSTACK_ARM on stderr, exit 1', () => { + test('a loaded comparison without the arm: one PREREG line out of 10, PREREG_NO_GSTACK_ARM on stderr, exit 1', () => { const r = run(BASE + VARIANTS + LOADED); expect(r.code).toBe(1); - expect(r.out).toMatch(/^PREREG: incomplete present=8\/8 stack=loaded no_gstack_arm=missing file=/m); + expect(r.out).toMatch(/^PREREG: incomplete present=10\/10 stack=loaded no_gstack_arm=missing file=/m); expect(r.err).toContain('missing section'); expect(r.err).toContain('(PREREG_NO_GSTACK_ARM)'); expect(r.err).not.toContain('(PREREG_INCOMPLETE)'); @@ -217,9 +218,9 @@ describe('gstack-eval-plan prereg --check', () => { test('complete: PREREG: ok with stack=loaded no_gstack_arm=ok; an opt-out prints stack=none', () => { const ok = run(BASE + VARIANTS + LOADED + NO_GSTACK()); expect(ok.code, ok.out + ok.err).toBe(0); - expect(ok.out).toMatch(/^PREREG: ok present=8\/8 stack=loaded no_gstack_arm=ok file=/m); + expect(ok.out).toMatch(/^PREREG: ok present=10\/10 stack=loaded no_gstack_arm=ok file=/m); const none = run(BASE + ARMS('claude-opus-5-5') + '\n## Comparison\nstack: none\nwhy: scorer calibration\n'); expect(none.code, none.out + none.err).toBe(0); - expect(none.out).toMatch(/^PREREG: ok present=8\/8 stack=none file=/m); + expect(none.out).toMatch(/^PREREG: ok present=10\/10 stack=none file=/m); }); }); diff --git a/test/eval-plan-prereg-diagnostics.test.ts b/test/eval-plan-prereg-diagnostics.test.ts index 22f94abad1..af3c66b943 100644 --- a/test/eval-plan-prereg-diagnostics.test.ts +++ b/test/eval-plan-prereg-diagnostics.test.ts @@ -14,7 +14,8 @@ import { checkPrereg, parsePreregDiagnostics, preregTemplate } from '../lib/eval import { capyHost, type CapyHost } from './helpers/capy-host'; const BIN = path.resolve(import.meta.dir, '..', 'bin', 'gstack-eval-plan'); -const FILLED = ['Bars', 'Arms', 'Decoys', 'Stop rules', 'Held-out exposure'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n## Comparison\nstack: none\nwhy: one arm, no skill stack\n\n## Decisions\nif the bar is met: run the full set\nif the bar is missed: fix the scorer first\n\n## Scoring\njudge: none\n'; +const LOOP = '\n## Pilot\nshare: 10%\ncounted: no\nran: the part under test shows in each arm\'s own transcripts\njudge: labels checked on each arm\'s pilot outputs\nsupply: three development rows per arm at the planned rate\nunits: every task type, one each\nseed: 7, independent of the number of workers\n\n## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger\n\n## Held-out exposure\n- filled in\nanswers: other git refs and build caches checked on each task machine\n'; +const FILLED = ['Bars', 'Arms', 'Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`).join('\n') + LOOP + '\n## Comparison\nstack: none\nwhy: one arm, no skill stack\n\n## Decisions\nif the bar is met: run the full set\nif the bar is missed: fix the scorer first\n\n## Scoring\njudge: none\n'; const SUMMARIZER = [ 'touch ran.marker', 'r=$(grep -c \'"kind":"refusal"\' "$1")', @@ -54,7 +55,7 @@ describe('prereg --check: the Diagnostics section', () => { const r = check(FILLED + diagnostics([['refusals', '2'], ['truncated', '1']])); expect(r.code).toBe(3); expect(r.ran).toBe(false); - expect(r.out).toContain('PREREG: ok present=8/8 stack=none diagnostics=2 file='); + expect(r.out).toContain('PREREG: ok present=10/10 stack=none diagnostics=2 file='); expect(r.out).toContain(`PREREG_COMMAND: summarizer="sh summarize.sh {fixture}" fixture=fixtures/synthetic records.jsonl cwd=${fs.realpathSync(repo)}`); expect(r.err).toContain('(REPO_COMMANDS_NOT_ALLOWED)'); expect(r.out).not.toContain('PREREG_DIAGNOSTICS:'); @@ -104,7 +105,7 @@ describe('prereg --check: the Diagnostics section', () => { const r = check(FILLED + diagnostics([['refusals', 'two']], { summarizer: 'sh summarize.sh fixtures/x.jsonl' }), '--allow-repo-commands'); expect(r.code).toBe(1); expect(r.ran).toBe(false); - expect(r.out).toContain('PREREG: incomplete present=8/8 stack=none diagnostics=invalid'); + expect(r.out).toContain('PREREG: incomplete present=10/10 stack=none diagnostics=invalid'); expect(r.err).toContain('diagnostics: row "| refusals | two |"'); expect(r.err).toContain('diagnostics: the summarizer command never names the fixture ({fixture})'); expect(r.err).toContain('diagnostics: no | diagnostic | expected | rows'); @@ -114,7 +115,7 @@ describe('prereg --check: the Diagnostics section', () => { test('without a Diagnostics section the check is unchanged; the template mentions the section without adding a heading', () => { const r = check(FILLED); expect(r.code).toBe(0); - expect(r.out).toBe(`PREREG: ok present=8/8 stack=none file=${path.join(repo, 'evals', 'prereg.md')}\n`); + expect(r.out).toBe(`PREREG: ok present=10/10 stack=none file=${path.join(repo, 'evals', 'prereg.md')}\n`); expect(parsePreregDiagnostics(FILLED)).toBeNull(); expect(parsePreregDiagnostics(FILLED + '\n## Diagnostics\n\n')).toBeNull(); expect(preregTemplate()).toContain('## Diagnostics'); diff --git a/test/eval-plan-result-checks.test.ts b/test/eval-plan-result-checks.test.ts index 3b24c2a525..efdcec2d90 100644 --- a/test/eval-plan-result-checks.test.ts +++ b/test/eval-plan-result-checks.test.ts @@ -19,7 +19,8 @@ const dirs: string[] = []; afterEach(() => { while (dirs.length) fs.rmSync(dirs.pop()!, { recursive: true, force: true }); }); const DECISIONS = '## Decisions\nif the skill arm passes more items: keep the skill\nif there is no difference: cut the skill\n'; -const SCORING = (judge = 'gpt-6-astra', extra = 'labels: 40\nagreement: 0.6\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items\n') => `## Scoring\njudge: ${judge}\n${extra}`; +const LOOP = '\n## Pilot\nshare: 10%\ncounted: no\nran: the part under test shows in each arm\'s own transcripts\njudge: labels checked on each arm\'s pilot outputs\nsupply: three development rows per arm at the planned rate\nunits: every task type, one each\nseed: 7, independent of the number of workers\n\n## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger\n\n## Held-out exposure\n- filled in\nanswers: other git refs and build caches checked on each task machine\n'; +const SCORING = (judge = 'gpt-6-astra', extra = 'labels: 40\nagreement: 0.6\nper-arm: yes\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items\n') => `## Scoring\njudge: ${judge}\n${extra}`; const prereg = (o: { decisions?: string; scoring?: string; frozen?: string; diagnostics?: string } = {}) => [ o.frozen ? `frozen: ${o.frozen}\n` : '', '## Bars\n- pass rate, higher is better\n', @@ -27,11 +28,12 @@ const prereg = (o: { decisions?: string; scoring?: string; frozen?: string; diag '## Arms\n- claude-opus-5-5 the skill installed\n- claude-opus-5-5#plain no skill\n', '## Comparison\nstack: none\nwhy: the scorer calibration compares prompts, not skill stacks\n', o.scoring ?? SCORING(), - ...['Decoys', 'Stop rules', 'Held-out exposure'].map(s => `## ${s}\n- filled in\n`), + ...['Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`), + LOOP, o.diagnostics ?? '', ].join('\n'); const labels = (n: number, disagree = 0, cls = (i: number) => (i % 2 ? 'pass' : 'fail')) => - Array.from({ length: n }, (_, i) => JSON.stringify({ id: `item-${i}`, human: cls(i), judge: i < disagree ? (cls(i) === 'pass' ? 'fail' : 'pass') : cls(i) })).join('\n') + '\n'; + Array.from({ length: n }, (_, i) => JSON.stringify({ id: `item-${i}`, arm: i < n / 2 ? 'claude-opus-5-5' : 'claude-opus-5-5#plain', human: cls(i), judge: i < disagree ? (cls(i) === 'pass' ? 'fail' : 'pass') : cls(i) })).join('\n') + '\n'; const table = (header: string, ...rows: string[]) => [header, header.replace(/[^|]+/g, '---'), ...rows].join('\n') + '\n'; describe('## Decisions', () => { @@ -89,6 +91,7 @@ describe('judge labels', () => { expect(checkJudgeLabels(scoring, labels(40, 4))).toMatchObject({ ok: true, n: 40, kappa: 0.8 }); expect(checkJudgeLabels(scoring, labels(39)).problems).toEqual(['39 labelled outputs, needs 40']); expect(checkJudgeLabels(scoring, labels(40, 10)).problems).toEqual(['kappa 0.50 is below the bar 0.6']); + expect(checkJudgeLabels({ ...scoring, per_arm: true }, labels(40, 10)).problems.map(p => p.split(':')[0])).toEqual(['kappa 0.50 is below the bar 0.6', 'arm claude-opus-5-5']); expect(checkJudgeLabels(scoring, labels(40, 0, () => 'pass')).problems[0]).toContain('one class'); expect(checkJudgeLabels(scoring, labels(40) + labels(1)).problems).toContain('id item-0 is labelled twice'); expect(checkJudgeLabels({ ...scoring, labels: 60 }, labels(40)).problems).toEqual(['40 labelled outputs, needs 60']); @@ -158,10 +161,10 @@ describe('gstack-eval-plan judge --check and results --labels', () => { test('judge --check prints JUDGE_AGREEMENT and exits 1 with EVAL_JUDGE_UNCHECKED below the bar', () => { const ok = run(['judge', '--check', 'prereg.md', '--labels', 'labels.jsonl'], { 'prereg.md': prereg(), 'labels.jsonl': labels(40, 4) }); expect(ok.code, ok.err).toBe(0); - expect(ok.out).toBe('JUDGE_AGREEMENT: ok judge=gpt-6-astra n=40/40 kappa=0.80 bar=0.6\n'); + expect(ok.out).toBe('JUDGE_ARM: claude-opus-5-5 n=20 kappa=0.60 bar=0.6\nJUDGE_ARM: claude-opus-5-5#plain n=20 kappa=1.00 bar=0.6\nJUDGE_AGREEMENT: ok judge=gpt-6-astra n=40/40 kappa=0.80 bar=0.6\n'); const low = run(['judge', '--check', 'prereg.md', '--labels', 'labels.jsonl'], { 'prereg.md': prereg(), 'labels.jsonl': labels(20) }); expect(low.code).toBe(1); - expect(low.out).toBe('JUDGE_AGREEMENT: unchecked judge=gpt-6-astra n=20/40 kappa=1.00 bar=0.6\n'); + expect(low.out).toBe('JUDGE_ARM: claude-opus-5-5 n=10 kappa=1.00 bar=0.6\nJUDGE_ARM: claude-opus-5-5#plain n=10 kappa=1.00 bar=0.6\nJUDGE_AGREEMENT: unchecked judge=gpt-6-astra n=20/40 kappa=1.00 bar=0.6\n'); expect(low.err).toContain('(EVAL_JUDGE_UNCHECKED)'); expect(run(['judge', '--check', 'prereg.md', '--labels', 'labels.jsonl'], { 'prereg.md': prereg({ scoring: SCORING('none') }), 'labels.jsonl': labels(40) }).code).toBe(2); }); @@ -170,7 +173,7 @@ describe('gstack-eval-plan judge --check and results --labels', () => { const files = { 'prereg.md': prereg(), 'results.md': table('| arm | failures |', '| claude-opus-5-5 | 3 |', '| claude-opus-5-5#plain | 0 |'), 'labels.jsonl': labels(40) }; const r = run(['results', '--check', 'prereg.md', '--labels', 'labels.jsonl', 'results.md'], files); expect(r.code).toBe(1); - expect(r.out).toBe('RESULTS: incomplete no_gstack_rows=0/0 rows=0/0 file=results.md\nJUDGE_AGREEMENT: ok judge=gpt-6-astra n=40/40 kappa=1.00 bar=0.6\n'); + expect(r.out).toBe('RESULTS: incomplete no_gstack_rows=0/0 rows=0/0 file=results.md\nJUDGE_ARM: claude-opus-5-5 n=20 kappa=1.00 bar=0.6\nJUDGE_ARM: claude-opus-5-5#plain n=20 kappa=1.00 bar=0.6\nJUDGE_AGREEMENT: ok judge=gpt-6-astra n=40/40 kappa=1.00 bar=0.6\n'); expect(r.err).toContain('(EVAL_REPORT_UNPLANTED_ZERO)'); expect(r.err).toContain('(EVAL_REPORT_NO_ANSWER_ONLY)'); expect(r.err).not.toContain('(EVAL_REPORT_NO_GSTACK_ROW)'); diff --git a/test/eval-plan-results.test.ts b/test/eval-plan-results.test.ts index 3786453948..9f7d46a614 100644 --- a/test/eval-plan-results.test.ts +++ b/test/eval-plan-results.test.ts @@ -15,7 +15,8 @@ const dirs: string[] = []; afterEach(() => { while (dirs.length) fs.rmSync(dirs.pop()!, { recursive: true, force: true }); }); const RESULT_SECTIONS = '## Decisions\nif the variant passes more items: adopt it\nif there is no difference: keep the default\n\n## Scoring\njudge: none\npaired: yes\ninterval: 95%\nmdd: 2 of 9 items\n'; -const BASE = ['Bars', 'Decoys', 'Stop rules', 'Held-out exposure'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n' + RESULT_SECTIONS; +const LOOP = '\n## Pilot\nshare: 10%\ncounted: no\nran: the part under test shows in each arm\'s own transcripts\njudge: labels checked on each arm\'s pilot outputs\nsupply: three development rows per arm at the planned rate\nunits: every task type, one each\nseed: 7, independent of the number of workers\n\n## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger\n\n## Held-out exposure\n- filled in\nanswers: other git refs and build caches checked on each task machine\n'; +const BASE = ['Bars', 'Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n' + RESULT_SECTIONS + LOOP; const PREREG = BASE + ` ## Arms - claude-opus-5-5#review-g default settings diff --git a/test/fixtures/context-budget.json b/test/fixtures/context-budget.json index f9a594aa81..75c90a31e4 100644 --- a/test/fixtures/context-budget.json +++ b/test/fixtures/context-budget.json @@ -25,7 +25,7 @@ "diagram": 4529, "document-generate": 6027, "document-release": 4469, - "eval-plan": 6271, + "eval-plan": 7057, "freeze": 1163, "gstack": 5793, "gstack-upgrade": 6297, diff --git a/test/pricing-eval-plan.test.ts b/test/pricing-eval-plan.test.ts index fa721ce05f..7aeadbcd4b 100644 --- a/test/pricing-eval-plan.test.ts +++ b/test/pricing-eval-plan.test.ts @@ -39,7 +39,7 @@ describe('lib/pricing', () => { }); test('the default eval-arms tier (smart) is priced out of the box', () => { - for (const model of ['claude-opus-5-5', 'gpt-6.1-sol']) expect(hasPricing(model)).toBe(true); + for (const model of ['claude-opus-5-5', 'gpt-6.1-sol', 'gpt-6.2-sol', 'gpt-6.2-astra']) expect(hasPricing(model)).toBe(true); }); test('claude-haiku-5-5, gpt-6-luna and gemini-4-argon are priced (#3640)', () => { @@ -59,7 +59,10 @@ describe('preregistration', () => { expect(PREREG_SECTIONS).toContain('Comparison'); const filled = t.replace(/^(##\s+.+)$/gm, '$1\n- filled in').replace('## Comparison\n- filled in', '## Comparison\nstack: none\nwhy: one arm, no skill stack') .replace('## Decisions\n- filled in', '## Decisions\nif the bar is met: run the full set\nif the bar is missed: stop and fix the scorer') - .replace('## Scoring\n- filled in', '## Scoring\njudge: none'); + .replace('## Scoring\n- filled in', '## Scoring\njudge: none') + .replace('## Pilot\n- filled in', '## Pilot\nshare: 10%\ncounted: no\nran: shown in each arm\'s outputs\nsupply: three rows per arm\nunits: every task type\nseed: 7') + .replace('## Cost\n- filled in', '## Cost\npaid: $200\nmeter: $0\nledger: the private spend ledger') + .replace('## Held-out exposure\n- filled in', '## Held-out exposure\nanswers: other git refs and build caches checked'); expect(checkPrereg(filled)).toMatchObject({ ok: true, missing: [], empty: [] }); expect(checkPrereg('# nothing here\n').missing).toEqual([...PREREG_SECTIONS]); }); @@ -140,7 +143,7 @@ describe('dry run', () => { expect(small.checks.frontier).toMatchObject({ ok: false, small_tier: ['claude-haiku-4-5', 'claude-sonnet-5-5#no-gstack'], tier_question: null }); const avgIn = Math.ceil((estimateTokens('hello world') + estimateTokens('second row')) / 2); expect(small.checks.frontier.recost_usd['claude-opus-5-5']).toBe(2 * 2 * estimateCostUsd({ input: avgIn, output: REASONING_OUTPUT_FLOOR }, 'claude-opus-5-5')); - expect(small.checks.frontier.recost_usd['gpt-6.1-sol']).toBeGreaterThan(0); + expect(small.checks.frontier.recost_usd['gpt-6.2-sol']).toBeGreaterThan(0); expect(renderDryRun(small)).toContain('CHECK: frontier refused'); const asked = dryRun({ input: rows, arms: ['claude-haiku-4-5'], retryPrompt: retry, tierQuestion: 'does the diet hold on Haiku' }); expect(asked.pass).toBe(true);