/eval-plan checks follow the plan's own dates and models, and plans name their grader (GST-3464) (#4673)

`/eval-plan dry-run --prereg ` now reads the plan's frozen date and
Models section, so plans frozen before the model-generation rule, and
competitor vendor defaults, pass as the rule allows; priced families
refuse unpriced older generations; and a new `grader:` line is required
for plans frozen from 2026-11-23.

Nothing to do for readers; plans frozen before 2026-11-23 need no
`grader:` line.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=specialist-batched
Review-Finding: p1/red-team#1 reader=red-team
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-22 10:54:45 +00:00
1 parent f7e16a54fc
commit 094263d71b
16 files changed
+217 -40

No files matched your search

+16 -9
View File
@@ -4,7 +4,7 @@
*
* gstack-eval-plan prereg --check <file> [--allow-repo-commands] [--json] | --init <file> [--title <t>] [--quick]
* gstack-eval-plan arms [--arms <model,model>] [--policy-doc <file>] [--input-tokens N] [--output-tokens N] [--json]
* gstack-eval-plan dry-run --input <rows.jsonl> --arms <model,model> [--fields a,b] [--output-budget N]
* gstack-eval-plan dry-run --input <rows.jsonl> --arms <model,model> [--prereg <file>] [--fields a,b] [--output-budget N]
* [--retry-prompt <file>] [--max-rows N] [--tier-question <why>] [--out <dir>] [--json]
* gstack-eval-plan pilot start --out <dir> --cap <usd> --arms <model[#loadout],...> --dry-run <dry-run.json> [--n 3] [--seat-metered <arm,...>]
* gstack-eval-plan pilot settle --out <dir> --attempt <id> --usd <n|unknown>
@@ -34,8 +34,8 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
import { spawnSync } from 'node:child_process';
import { renderModelGenerations, modelGenerationProblems } from '../lib/eval-plan-checks';
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 { frozenDate, renderModelGenerations, modelGenerationProblems } from '../lib/eval-plan-checks';
import { armIdentities, armModel, checkPrereg, DEFAULT_TOKENS, dryRun, pilotReport, preregTemplate, quickLookTemplate, priceGate, releasePilot, renderArms, renderDryRun, renderGatePrice, renderPilotReport, renderPreregDiagnostics, resolveArms, resolvePlanSource, runPreregDiagnostics, sectionBody, 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';
@@ -54,17 +54,19 @@ 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;
no arm, judge, reader or simulator is gpt-4o or a superseded_by row (R116, MODEL_GENERATION
no arm, judge, reader or simulator is gpt-4o, a superseded_by row or an older generation of a priced family (R116, MODEL_GENERATION
lines; a frozen: date before 2026-11-21 keeps its models); vendor-default lines print MODEL_EXCEPTION
prereg --init <file> [--title <t>] [--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 "<why>"] [--out dir] [--json]
dry-run --input rows.jsonl --arms m,m [--prereg f] [--fields a,b] [--output-budget N] [--retry-prompt f] [--max-rows N] [--cap usd] [--tier-question "<why>"] [--out dir] [--json]
stub model over the real rows; checklist: price table, output budget, retry prompt text,
and with --cap reservation-fits-cap (one call: largest row + output budget, priced);
frontier: refuses a plan whose every arm is Haiku or Sonnet unless --tier-question
names what it asks about that tier, and re-costs the plan on frontier prices (R54);
model-generation: refuses an arm that is gpt-4o or a lib/pricing.ts superseded_by row (R116)
model-generation: refuses an arm that is gpt-4o or an older generation (R116); --prereg applies
the plan's vendor-default lines and, when its Arms name every arm, its frozen: date; pilot start
reads them from dry-run.json
pilot start --out dir --cap usd --arms m,m#no-gstack --dry-run dry-run.json [--n 3] [--seat-metered arm,...]
--seat-metered: arms on a subscription with no incremental charge; they reserve $0,
settle unknown, and sit outside the cap and the projection until one settles a charge
@@ -201,13 +203,18 @@ function doDryRun(rest: string[]): number {
const modelRules = lintModels(rest, arms.map(model => ({ model, scope, where: 'dry-run --arms' })), 'dry-run');
const tierQuestion = flag(rest, '--tier-question');
if (tierQuestion?.startsWith('--')) return usage('--tier-question needs the question the preregistration asks about that tier, not another flag');
const r = dryRun({ input, arms, fields: csv(flag(rest, '--fields')), outputBudget: num(rest, '--output-budget'), retryPrompt: flag(rest, '--retry-prompt'), maxRows: num(rest, '--max-rows'), cap: num(rest, '--cap'), modelRules, tierQuestion });
const preregFile = flag(rest, '--prereg');
if (preregFile !== undefined && !fs.existsSync(preregFile)) return usage('--prereg needs the existing preregistration file the run follows');
const preregText = preregFile === undefined ? null : fs.readFileSync(preregFile, 'utf8');
const unnamed = preregText === null ? [] : arms.filter(a => !armIdentities(preregText).includes(a));
const prereg = preregText === null ? undefined : { file: preregFile!, frozen: unnamed.length ? null : frozenDate(preregText), models: sectionBody(preregText, 'Models') };
const r = dryRun({ input, arms, fields: csv(flag(rest, '--fields')), outputBudget: num(rest, '--output-budget'), retryPrompt: flag(rest, '--retry-prompt'), maxRows: num(rest, '--max-rows'), cap: num(rest, '--cap'), modelRules, tierQuestion, prereg });
const out = flag(rest, '--out');
if (out) { fs.mkdirSync(out, { recursive: true }); fs.writeFileSync(path.join(out, 'dry-run.json'), JSON.stringify(r, null, 2) + '\n'); }
if (rest.includes('--json')) process.stdout.write(JSON.stringify(r) + '\n'); else process.stdout.write(renderDryRun(r));
if (rest.includes('--json')) process.stdout.write(JSON.stringify(r) + '\n'); else process.stdout.write(renderDryRun(r) + renderModelGenerations({ ...r.checks.generation, refused: [] }) + (r.checks.generation.exempt ? `MODEL_GENERATION: exempt (frozen ${r.prereg!.frozen} in ${r.prereg!.file}, before R116)\n` : ''));
if (out) process.stdout.write(`DRY_RUN_RECORD: ${path.join(out, 'dry-run.json')}\n`);
if (!r.pass) {
const why = [r.rows === 0 ? 'no rows' : '', r.bad_rows.length ? `${r.bad_rows.length} bad rows` : '', !r.checks.price_table.ok ? `price missing: ${r.checks.price_table.missing.join(',') || 'no arms'}` : '', !r.checks.output_budget.ok ? 'output budget below the reasoning floor' : '', !r.checks.retry_prompt.ok ? 'retry prompt missing' : '', r.checks.reservation_fits_cap && !r.checks.reservation_fits_cap.ok ? `one call exceeds --cap $${r.checks.reservation_fits_cap.cap}` : '', r.checks.model_rules && !r.checks.model_rules.ok ? 'model rules refused an arm (EVAL_MODEL lines above)' : '', !r.checks.frontier.ok ? 'every arm is Haiku or Sonnet (R54; CHECK: frontier above)' : '', !r.checks.generation.ok ? 'an arm is gpt-4o or an older generation (R116; CHECK: model-generation above)' : ''].filter(Boolean).join('; ');
const why = [r.rows === 0 ? 'no rows' : '', r.bad_rows.length ? `${r.bad_rows.length} bad rows` : '', !r.checks.price_table.ok ? `price missing: ${r.checks.price_table.missing.join(',') || 'no arms'}` : '', !r.checks.output_budget.ok ? 'output budget below the reasoning floor' : '', !r.checks.retry_prompt.ok ? 'retry prompt missing' : '', r.checks.reservation_fits_cap && !r.checks.reservation_fits_cap.ok ? `one call exceeds --cap $${r.checks.reservation_fits_cap.cap}` : '', r.checks.model_rules && !r.checks.model_rules.ok ? 'model rules refused an arm (EVAL_MODEL lines above)' : '', !r.checks.frontier.ok ? 'every arm is Haiku or Sonnet (R54; CHECK: frontier above)' : '', !r.checks.generation.ok ? `${modelGenerationProblems(r.checks.generation).join('; ')} (CHECK: model-generation above${!r.prereg ? '; pass --prereg <file> when the plan has a vendor-default line or a frozen: date before 2026-11-21' : unnamed.length && frozenDate(preregText!) ? `; a frozen: date keeps only arms the plan's ## Arms names, and ${preregFile} does not name ${unnamed.join(',')}` : ''})` : ''].filter(Boolean).join('; ');
process.stderr.write(resultLine('gstack-eval-plan dry-run', r.checks.price_table.ok ? 'EVAL_DRY_RUN_FAILED' : 'EVAL_PRICE_MISSING', why) + '\n');
return EXIT.fail;
}
@@ -0,0 +1 @@
**`/eval-plan` checks match the preregistration end to end.** `dry-run --prereg <file>` applies the plan's `vendor-default:` lines and `frozen:` date, so a competitor arm the plan declares, or an arm in a plan frozen before the older-model rule, is no longer refused at the dry run; `pilot start` reads the same record. An unpriced older model of a priced family (`claude-opus-4-5`, `gpt-4.1`, `o1`, `gemini-2.0-flash`) is now refused like the priced ones, with its replacement. Plans frozen from 2026-11-23 also need a `grader:` line under Held-out exposure saying how a grader that runs git treats the agent's repo, or `grader: none`.
+12 -1
View File
@@ -2158,6 +2158,7 @@ checks. Logic in `checkLoop` and `checkQuickLook` (`lib/eval-plan-checks.ts`):
| `## 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` |
| `## Held-out exposure` has a `grader:` line: how a grader that runs git in the agent's repo treats that repo as hostile, or `none` when no grader runs git there (a plan frozen before 2026-11-23 keeps its rules) | `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` |
@@ -2240,7 +2241,17 @@ For R116, `prereg --check` prints `MODEL_GENERATION: refused <model> role=<role>
replacement=<model>` for each refused use, adds `models=refused` to its `PREREG:`
line and exits 1 with `EVAL_MODEL_OLD_GENERATION`. `dry-run` prints `CHECK:
model-generation refused …` and fails, and `pilot start` refuses an
older-generation arm even when its dry run passed on other arms.
older-generation arm even when its dry run passed on other arms. Pass the plan to
`dry-run --prereg <file>` so its `vendor-default:` lines and `frozen:` date apply
there as they do in `prereg --check`; the dry run records them in `dry-run.json`,
and `pilot start` reads them from that record.
A model with no price row is read by its family and major version
(`claude-opus-4-5`, `claude-3-5-sonnet`, `gpt-4.1`, `o1`, `gemini-2.0-flash`). When
its family has rows in `lib/pricing.ts` and its generation is older than the
family's current rows, or than every row when all of them are superseded, it is
refused the same way, with the replacement its family's marked rows name. An id
the check can't read, or a family with no price row, isn't refused.
**Judge labels (R78 amendment).** Garry approved on 2026-11-21: a plan frozen on
or after 2026-11-22, or with no `frozen:` line, checks its model judge against at
+6 -2
View File
@@ -6048,7 +6048,9 @@ edit `.gstack/eval-models.json` in a reviewed PR.
**Meaning.** One of two rules refused a model. R116: a preregistration's arm,
judge, reader or simulator, or a dry-run or pilot arm, is gpt-4o (any variant or
snapshot) or a model `lib/pricing.ts` marks `superseded_by`; the
snapshot), a model `lib/pricing.ts` marks `superseded_by`, or an unpriced id
whose family has rows there and whose generation is older than the family's
current rows; the
`MODEL_GENERATION:` line names the model, its role and the replacement. Or the
eval model rules declare `families` (newest first), and an arm uses an id that
is not the first one in its family.
@@ -6056,7 +6058,9 @@ is not the first one in its family.
**Fix.** Use the replacement the `MODEL_GENERATION:` or `EVAL_MODEL:` line names.
A competitor system tested as its vendor ships it keeps its built-in model with a
`vendor-default: <model> <system>` line in `## Models`; the results must name it.
If the `families` order is wrong, fix it in a reviewed PR.
A dry run applies those lines, and a `frozen:` date before 2026-11-21, only when
you pass the plan with `dry-run --prereg <file>`; the date counts only when the
plan's `## Arms` names every dry-run arm. If the `families` order is wrong, fix it in a reviewed PR.
<a id="eval-model-generation-unresolved"></a>
### `EVAL_MODEL_GENERATION_UNRESOLVED`
+6 -4
View File
@@ -218,8 +218,9 @@ at least one, so `expected` is 1 or more and the summarizer is shown to find it.
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.
or less code, because a shorter diff can come from skipping the test; and the
`answers:` and `grader:` lines under Held-out exposure (`grader: none` when no grader
runs git in the agent's repo; a plan frozen before 2026-11-23 needs no `grader:` line).
A `frozen: YYYY-MM-DD` line before 2026-11-15 keeps the rules it was frozen under
(`result_checks=exempt`); one before 2026-11-21 skips item 3 (`loop_checks=exempt`)
@@ -244,7 +245,8 @@ Models under test are frontier models (`claude-opus-5-5`, `gpt-6.2-sol`, at most
low-cost primary); a Haiku or Sonnet arm only with a stated tier question
(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. No arm, judge, reader or
simulator may be gpt-4o or a model `lib/pricing.ts` marks `superseded_by` (R116): `prereg
simulator may be gpt-4o, a model `lib/pricing.ts` marks `superseded_by`, or an unpriced
older generation of a priced family such as `claude-opus-4-5` (R116): `prereg
--check` prints `MODEL_GENERATION: refused <model> role=<role> replacement=<model>` and
exits 1 (`EVAL_MODEL_OLD_GENERATION`); `dry-run` and `pilot start` refuse such an arm too.
The one exception is a competitor system tested as its vendor ships it: its built-in model
@@ -291,7 +293,7 @@ same as a changed bar.
Run the pipeline over the real development rows with a stub model that costs nothing:
```bash
~/.claude/skills/gstack/bin/gstack-eval-plan dry-run --input <path> --arms <picked-models> --retry-prompt <path> --out <outdir>
~/.claude/skills/gstack/bin/gstack-eval-plan dry-run --input <path> --arms <picked-models> --prereg <prereg-path> --retry-prompt <path> --out <outdir>
```
Add `--fields <id>` when the rows' prompt field is not `prompt`, and `--output-budget` with
+6 -4
View File
@@ -133,8 +133,9 @@ at least one, so `expected` is 1 or more and the summarizer is shown to find it.
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.
or less code, because a shorter diff can come from skipping the test; and the
`answers:` and `grader:` lines under Held-out exposure (`grader: none` when no grader
runs git in the agent's repo; a plan frozen before 2026-11-23 needs no `grader:` line).
A `frozen: YYYY-MM-DD` line before 2026-11-15 keeps the rules it was frozen under
(`result_checks=exempt`); one before 2026-11-21 skips item 3 (`loop_checks=exempt`)
@@ -159,7 +160,8 @@ Models under test are frontier models (`claude-opus-5-5`, `gpt-6.2-sol`, at most
low-cost primary); a Haiku or Sonnet arm only with a stated tier question
(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. No arm, judge, reader or
simulator may be gpt-4o or a model `lib/pricing.ts` marks `superseded_by` (R116): `prereg
simulator may be gpt-4o, a model `lib/pricing.ts` marks `superseded_by`, or an unpriced
older generation of a priced family such as `claude-opus-4-5` (R116): `prereg
--check` prints `MODEL_GENERATION: refused <model> role=<role> replacement=<model>` and
exits 1 (`EVAL_MODEL_OLD_GENERATION`); `dry-run` and `pilot start` refuse such an arm too.
The one exception is a competitor system tested as its vendor ships it: its built-in model
@@ -206,7 +208,7 @@ same as a changed bar.
Run the pipeline over the real development rows with a stub model that costs nothing:
```bash
~/.claude/skills/gstack/bin/gstack-eval-plan dry-run --input <path> --arms <picked-models> --retry-prompt <path> --out <outdir>
~/.claude/skills/gstack/bin/gstack-eval-plan dry-run --input <path> --arms <picked-models> --prereg <prereg-path> --retry-prompt <path> --out <outdir>
```
Add `--fields <id>` when the rows' prompt field is not `prompt`, and `--output-budget` with
+7 -1
View File
@@ -53,6 +53,8 @@ export function modelFamily(model: string): string {
* number. A preregistration frozen before LOOP_CHECKS_SINCE keeps its rules.
*/
export const LOOP_CHECKS_SINCE = '2026-11-21';
/** The Held-out exposure `grader:` line (H2): a plan frozen before this date keeps the rules it was frozen under. */
export const GRADER_CHECK_SINCE = '2026-11-23';
export const PILOT_MAX_SHARE_PCT = 10;
export const INTERIM_LOOK_ABOVE_USD = 500;
export const QUICK_LOOK_MAX_USD = 100;
@@ -73,7 +75,7 @@ export function checkQuickLook(text: string): QuickLookCheck {
}
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 }
export interface LoopSections { pilot: string[] | null; cost: string[] | null; interim: string[] | null; scoring: string[] | null; bars: string[] | null; arms: string[] | null; heldOut: string[] | null; frozen?: string | null }
/** The dated eval-loop checks over a counted run's preregistration sections. */
export function checkLoop(s: LoopSections): LoopCheck {
const errors: LoopCheck['errors'] = [];
@@ -113,6 +115,8 @@ export function checkLoop(s: LoopSections): LoopCheck {
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');
const grader = (s.heldOut ?? []).map(l => /^\s*(?:[-*]\s+)?grader:(.*)$/i.exec(l)?.[1]?.trim().replace(/^`(.*)`$/, '$1')).find(v => v !== undefined);
if (s.heldOut?.length && !(s.frozen && s.frozen < GRADER_CHECK_SINCE) && !(grader && (/^none\b/i.test(grader) || filled(grader)))) add('Held-out exposure', 'grader: how a grader that runs git in the agent\'s repo treats that repo as hostile (eval-plan/SKILL.md, "A grader treats the agent\'s repo as hostile"), or none when no grader runs git there');
return { paid, interim_required, errors };
}
@@ -128,6 +132,8 @@ export function checkLoop(s: LoopSections): LoopCheck {
export const MODEL_GENERATIONS_SINCE = '2026-11-21';
export type ModelRole = 'arm' | 'judge' | 'reader' | 'simulator';
export interface ModelUse { model: string; role: ModelRole; loadout?: string }
/** What dry-run and pilot start read from `--prereg <file>`: its `## Models` lines and `frozen:` date, so a vendor-default line and a freeze date count there as in prereg --check. */
export interface PlanModels { file: string; frozen: string | null; models: string[] | null }
export interface ModelGenerationCheck { ok: boolean; exempt: boolean; refused: Array<{ model: string; role: ModelRole; replacement: string }>; exceptions: Array<{ model: string; system: string; roles: ModelRole[] }>; errors: string[] }
export function checkModelGenerations(o: { arms: string[]; judge?: string | null; models?: string[] | null; frozen?: string | null }): ModelGenerationCheck {
if (o.frozen && o.frozen < MODEL_GENERATIONS_SINCE) return { ok: true, exempt: true, refused: [], exceptions: [], errors: [] };
+11 -10
View File
@@ -19,7 +19,7 @@ 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, checkLoop, checkModelGenerations, checkQuickLook, checkScoring, frozenDate, grandfathered, isQuickLook, loopGrandfathered, type DecisionsCheck, type LoopCheck, type ModelGenerationCheck, type QuickLookCheck, type ScoringCheck } from './eval-plan-checks';
import { checkDecisions, checkLoop, checkModelGenerations, checkQuickLook, checkScoring, frozenDate, grandfathered, isQuickLook, loopGrandfathered, type DecisionsCheck, type LoopCheck, type ModelGenerationCheck, type PlanModels, type QuickLookCheck, type ScoringCheck } from './eval-plan-checks';
// ---------------------------------------------------------------------------
// preregistration
@@ -60,7 +60,7 @@ export function preregTemplate(title = 'Eval preregistration'): string {
<!-- \`judge: none\` when a rule scores every metric; otherwise \`judge: <model>\` from another model family than every arm, \`labels: <n>\` hand-labelled outputs it is checked against (at least 100, or 40 for a plan frozen before 2026-11-22; never held-out rows) and \`agreement: <kappa bar>\` (at least 0.6), \`per-arm: yes\` (agreement read on each arm's outputs, not pooled) and \`effort: <the reasoning effort set in the judge's start>\`; GPT-6 Astra or GPT-6.2 Astra judges Claude arms, Claude Opus 5.5 judges GPT arms. With two or more arms: \`paired: yes\`, \`interval: 95%\` and \`mdd: <the smallest difference this run can detect>\`. -->
## Models
<!-- Optional: every other model the run starts, as \`reader: <model>\` and \`simulator: <model>\` lines. R116 refuses gpt-4o and any model lib/pricing.ts marks \`superseded_by\` in every role, arms and the judge included, and names the replacement. \`vendor-default: <model> <system>\` keeps a competitor system's built-in model when that system (an arm) is tested as its vendor ships it; the check records it and the results must name it. -->
<!-- Optional: every other model the run starts, as \`reader: <model>\` and \`simulator: <model>\` lines. R116 refuses gpt-4o, any model lib/pricing.ts marks \`superseded_by\` and an unpriced older generation of a priced family in every role, arms and the judge included, and names the replacement. \`vendor-default: <model> <system>\` keeps a competitor system's built-in model when that system (an arm) is tested as its vendor ships it; the check records it and the results must name it. -->
## Pilot
<!-- Uncounted, per arm, before its counted run: \`share: <at most 10>%\` of that arm's budget; \`counted: no\`; \`ran:\` how the arm's own outputs show the part under test ran; \`judge:\` the judge's label check on that arm's pilot outputs (with a model judge); \`supply:\` how the units are shown to be suppliable at the planned rate; \`units:\` every unit type the counted run uses, each drawn at least once; \`seed:\` the fixed seed for the draw order, independent of the number of workers. An arm that fails is fixed or left out, and reported as left out. -->
@@ -80,7 +80,7 @@ export function preregTemplate(title = 'Eval preregistration'): string {
## Held-out exposure
<!-- Every held-out set this plan touches: | set | prior exposure (which runs, which models) | reservation (what this run may read) | -->
<!-- Answers on the task machine: how each unit's 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\`). -->
<!-- Grader: when a grader runs git in the agent's repo, how it treats that repo as hostile: a sanitized copy of .git with no repo, system or global config, hooks, attributes, textconv or signature display; original index timestamps; no API keys in its environment; a test that plants each setting. -->
<!-- \`grader:\` how a grader that runs git in the agent's repo treats that repo as hostile, or \`grader: none\` when none does: a sanitized copy of .git with no repo, system or global config, hooks, attributes, textconv or signature display; original index timestamps; no API keys in its environment; a test that plants each setting. -->
<!-- Optional: a \`## Diagnostics\` section declares the summarizer (\`summarizer: <command naming {fixture}>\`), its synthetic records (\`fixture: <path>\`) and one | diagnostic | expected | row per diagnostic; \`prereg --check --allow-repo-commands\` runs it. A count reported as zero needs its diagnostic declared here with a planted case (expected 1 or more). -->
`;
}
@@ -99,7 +99,7 @@ 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 {
export function sectionBody(text: string, name: string): string[] | null {
const lines = text.split('\n');
const headings = lines.map((l, i) => ({ i, m: /^#{1,6}\s+(.+?)\s*$/.exec(l) })).filter(x => x.m) as Array<{ i: number; m: RegExpExecArray }>;
const idx = headings.findIndex(h => h.m[1]!.toLowerCase().replace(/[^a-z]/g, '') === name.toLowerCase().replace(/[^a-z]/g, ''));
@@ -187,7 +187,7 @@ export function checkPrereg(text: string): PreregCheck {
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), frozenDate(text));
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 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'), frozen: frozenDate(text) });
const models = checkModelGenerations({ arms: armIdentities(text), judge: scoring.judge, models: section('Models'), frozen: frozenDate(text) });
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 && models.ok;
return { ok, models, present, missing, empty, comparison, no_gstack, diagnostics, decisions, scoring, frozen: frozenDate(text), grandfathered: exempt, loop, loop_grandfathered: loopExempt, quick: null };
@@ -349,12 +349,13 @@ export interface DryRunResult {
model_rules?: { ok: boolean; source: string; refused: string[] };
/** R54: Haiku and Sonnet are not models under test; arms on them alone are refused unless the plan asks about that tier. */
frontier: { ok: boolean; small_tier: string[]; tier_question: string | null; recost_usd: Record<string, number> };
/** R116: no arm is gpt-4o or a model lib/pricing.ts marks superseded_by. */
/** R116: no arm is gpt-4o or a model lib/pricing.ts marks superseded_by, unless the --prereg plan's vendor-default line or frozen date keeps it. */
generation: ModelGenerationCheck;
};
prereg?: PlanModels;
per_item_usd: Record<string, number | null>; excluded_billing: readonly string[]; pass: boolean; stub: 'stub-model (no network, $0)';
}
export interface DryRunOptions { input: string; arms: string[]; fields?: string[]; outputBudget?: number; retryPrompt?: string; maxRows?: number; cap?: number; modelRules?: ModelRulesCheck; tierQuestion?: string }
export interface DryRunOptions { input: string; arms: string[]; fields?: string[]; outputBudget?: number; retryPrompt?: string; maxRows?: number; cap?: number; modelRules?: ModelRulesCheck; tierQuestion?: string; prereg?: PlanModels }
/** 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.2-sol'] as const;
@@ -401,9 +402,9 @@ export function dryRun(o: DryRunOptions): DryRunResult {
const smallTier = o.arms.filter(a => isSmallTierModel(armModel(a)));
const recost = Object.fromEntries(FRONTIER_MODELS.map(m => [m, rows * o.arms.length * estimateCostUsd({ input: avgIn, output: budget }, m)]));
checks.frontier = { ok: smallTier.length < o.arms.length || !!o.tierQuestion?.trim(), small_tier: smallTier, tier_question: o.tierQuestion?.trim() || null, recost_usd: recost };
checks.generation = checkModelGenerations({ arms: o.arms });
checks.generation = checkModelGenerations({ arms: o.arms, models: o.prereg?.models, frozen: o.prereg?.frozen });
return {
schema_version: 1, input: o.input, rows, bad_rows: bad, est_input_tokens: inputTokens, est_output_tokens: rows * budget, arms: o.arms, checks, per_item_usd: perItem,
schema_version: 1, input: o.input, rows, bad_rows: bad, est_input_tokens: inputTokens, est_output_tokens: rows * budget, arms: o.arms, checks, per_item_usd: perItem, ...(o.prereg ? { prereg: o.prereg } : {}),
excluded_billing: EXCLUDED_BILLING_CATEGORIES, pass: rows > 0 && bad.length === 0 && checks.price_table.ok && checks.output_budget.ok && checks.retry_prompt.ok && (checks.reservation_fits_cap?.ok ?? true) && (checks.model_rules?.ok ?? true) && checks.frontier.ok && checks.generation.ok, stub: 'stub-model (no network, $0)',
};
}
@@ -453,7 +454,7 @@ export function startPilot(o: PilotStartOptions): { record: PilotRecord; error?:
const dry = JSON.parse(fs.readFileSync(o.dryRun, 'utf8')) as DryRunResult;
if (!dry.pass) return { record: null as unknown as PilotRecord, error: { code: 'EVAL_DRY_RUN_FAILED', message: `${o.dryRun} did not pass; the pilot never starts on a failed dry run` } };
if (o.arms.length && o.arms.every(a => isSmallTierModel(armModel(a))) && !dry.checks.frontier?.tier_question) return { record: null as unknown as PilotRecord, error: { code: 'EVAL_DRY_RUN_FAILED', message: `every pilot arm is Haiku or Sonnet and ${o.dryRun} records no --tier-question (R54, docs/TESTING_INTERNALS.md#frontier-models-under-test)` } };
const stale = checkModelGenerations({ arms: o.arms }).refused; if (stale.length) return { record: null as unknown as PilotRecord, error: { code: 'EVAL_MODEL_OLD_GENERATION', message: stale.map(a => `${a.model} is an older generation; use ${a.replacement} (R116)`).join('; ') } };
const stale = checkModelGenerations({ arms: o.arms, models: dry.prereg?.models, frozen: o.arms.every(a => dry.arms.includes(a)) ? dry.prereg?.frozen : null }).refused; if (stale.length) return { record: null as unknown as PilotRecord, error: { code: 'EVAL_MODEL_OLD_GENERATION', message: stale.map(a => `${a.model} is an older generation; use ${a.replacement} (R116)`).join('; ') } };
const tokens = o.tokens ?? { input: dry.rows ? Math.ceil(dry.est_input_tokens / dry.rows) : DEFAULT_TOKENS.input, output: dry.checks.output_budget.budget };
const seat = o.seatMetered ?? [];
const stray = seat.filter(a => !o.arms.includes(a));
+34 -2
View File
@@ -148,11 +148,43 @@ export function hasPricing(model: string | undefined): boolean {
/** gpt-4o in any variant, snapshot or provider form (`openrouter:openai/gpt-4o`, `gpt-4o-mini-2024-07-18`, `chatgpt-4o-latest`), priced or not. */
const GPT_4O = /^(?:chatgpt-4o|gpt-4o)(?:$|-)/;
/** The current model that replaces `model` when it is gpt-4o or a row marked `superseded_by` (R116), else null. */
/**
* A model id's family and major generation: `claude-<tier>-<major>` or the older `claude-<major>-<tier>`, `gpt-<major>`,
* `o<major>` and `gemini-<major>-<tier>`, with `small` for a mini or nano size; null for any other id.
*/
function generationOf(id: string): { family: string; major: number; small: boolean } | null {
const small = /(?:^|-)(?:mini|nano)(?:-|$)/.test(id);
const m = /^claude-(opus|sonnet|haiku|fable)-(\d+)(?:-|$)/.exec(id) ?? /^claude-(\d+)(?:[-.]\d+)?-(opus|sonnet|haiku|fable)(?:-|$)/.exec(id);
if (m) return { family: `claude-${/\d/.test(m[1]!) ? m[2] : m[1]}`, major: Number(/\d/.test(m[1]!) ? m[1] : m[2]), small };
const g = /^(gpt-|o)(\d+)(?:\.\d+)?(?:-|$)/.exec(id);
if (g) return { family: g[1] === 'o' ? 'o' : 'gpt', major: Number(g[2]), small };
const ge = /^gemini-(\d+)(?:\.\d+)?-([a-z]+)/.exec(id);
return ge ? { family: `gemini-${ge[2]}`, major: Number(ge[1]), small } : null;
}
/**
* The replacement for an unpriced id whose family has rows here and whose major generation is older than the family's
* current rows (or than every row, when all of them are superseded): the superseded_by of the family's newest marked row of
* the same size, else its newest current row. A newer or unknown id, or a family with no row, is null.
*/
function olderGeneration(model: string): string | null {
const id = model.trim().toLowerCase().split(/[:/]/).map(s => s.replace(/-\d{8}$/, '')).find(s => generationOf(s)) ?? '';
const gen = generationOf(id);
if (!gen) return null;
const rows = Object.entries(PRICING).flatMap(([row, p]) => { const g = generationOf(row); return g?.family === gen.family ? [{ row, p, g }] : []; }).sort((a, b) => b.g.major - a.g.major);
if (!rows.length) return null;
const current = rows.filter(r => !r.p.superseded_by);
if (gen.major >= (current.length ? current[0]!.g.major : rows[0]!.g.major + 1)) return null;
const marked = rows.filter(r => r.p.superseded_by);
return (marked.find(r => r.g.small === gen.small) ?? marked[0])?.p.superseded_by ?? current[0]!.row;
}
/** The current model that replaces `model` when it is gpt-4o, a row marked `superseded_by` or an unpriced older generation of a priced family (R116), else null. */
export function currentReplacement(model: string): string | null {
const segments = model.trim().toLowerCase().split(/[:/]/);
if (segments.some(s => GPT_4O.test(s))) return segments.some(s => /4o-mini/.test(s)) ? 'gpt-6-luna' : PRICING['gpt-4o']!.superseded_by!;
return pricingRow(model)?.superseded_by ?? null;
const row = pricingRow(model);
return row ? row.superseded_by ?? null : olderGeneration(model);
}
const WARNED = new Set<string>();
+11 -1
View File
@@ -7,7 +7,7 @@
*/
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 { checkJudgeLabels, GRADER_CHECK_SINCE, LOOP_CHECKS_SINCE } from '../lib/eval-plan-checks';
import { checkResults } from '../lib/eval-plan-report';
const PILOT: Record<string, string> = { 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' };
@@ -98,6 +98,16 @@ describe('smaller is scored with tests (G11) and no answers on the machine (G13)
expect(checkPrereg(plan({ arms, bars: '- pass rate, higher is better\n- regression test added, co-primary, higher is better' })).ok).toBe(true);
});
test(`from ${GRADER_CHECK_SINCE}, held-out exposure says how a grader running git treats the agent's repo, or none`, () => {
const hostile = 'answers: other git refs checked on each task machine\ngrader: a sanitized copy of .git with no config, hooks or attributes';
const scoring = 'judge: gpt-6.2-astra\nlabels: 100\nagreement: 0.6\nper-arm: yes\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items';
expect(messages(plan({ frozen: GRADER_CHECK_SINCE }))).toEqual(['Held-out exposure: grader:']);
expect(messages(plan({ frozen: GRADER_CHECK_SINCE, heldOut: 'answers: other git refs checked\ngrader: tbd' }))).toEqual(['Held-out exposure: grader:']);
expect(checkPrereg(plan({ frozen: GRADER_CHECK_SINCE, scoring, heldOut: hostile })).ok).toBe(true);
expect(checkPrereg(plan({ frozen: GRADER_CHECK_SINCE, scoring, heldOut: 'answers: other git refs checked\n- grader: none, the scorer runs no git' })).ok).toBe(true);
expect(checkPrereg(plan({ frozen: '2026-11-22', scoring })).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:']);
+71 -1
View File
@@ -20,7 +20,7 @@ const dirs: string[] = [];
afterEach(() => { while (dirs.length) fs.rmSync(dirs.pop()!, { recursive: true, force: true }); });
const tmp = () => { const d = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-model-gen-')); dirs.push(d); return d; };
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 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\ngrader: none, the scorer runs no git in the agent\'s repo\n';
const prereg = (o: { arms?: string[]; judge?: string; models?: string; frozen?: string } = {}) => [
o.frozen ? `frozen: ${o.frozen}\n` : '',
'## Bars\n- pass rate, higher is better\n',
@@ -61,6 +61,22 @@ describe('lib/pricing.ts generation marks', () => {
expect(currentReplacement('anthropic/claude-opus-4-7')).toBe('claude-opus-5-5');
for (const current of ['claude-opus-5-5', 'gpt-6.2-sol', 'gpt-6-astra', 'gpt-6.2-astra', 'gpt-6.1-sol', 'claude-fable-5-1', 'gemini-3.6-flash', 'gpt-6-luna', 'particle-1', 'no-such-model', 'gpt-40-turbo']) expect(currentReplacement(current), current).toBeNull();
});
test('an unpriced older generation of a priced family is refused like its marked rows; unpriced current and newer ids are not', () => {
const older: Record<string, string> = {
'claude-opus-4-5': 'claude-opus-5-5', 'anthropic/claude-opus-4-6': 'claude-opus-5-5', 'claude-3-opus-20240229': 'claude-opus-5-5',
'claude-sonnet-4-5-20250929': 'claude-sonnet-5-5', 'claude-3-5-sonnet-20241022': 'claude-sonnet-5-5', 'claude-3-5-haiku': 'claude-haiku-5-5',
'gpt-5.5': 'gpt-6.2-sol', 'openai/gpt-5.3-codex': 'gpt-6.2-sol', 'gpt-4.1': 'gpt-6.2-sol', 'gpt-4.1-mini': 'gpt-6-luna', 'gpt-5-nano': 'gpt-6-luna',
'o1': 'gpt-6.2-sol', 'o3-pro': 'gpt-6.2-sol', 'o3-mini': 'gpt-6-luna',
'gemini-2.0-flash': 'gemini-3.8-flash', 'google/gemini-1.5-pro-002': 'gemini-4-argon', 'gemini-3-pro': 'gemini-4-argon',
};
for (const [model, replacement] of Object.entries(older)) expect(currentReplacement(model), model).toBe(replacement);
for (const current of ['claude-fable-5-2', 'claude-opus-5', 'gpt-6-terra', 'gpt-7', 'gemini-4-neon', 'gemini-3.7-flash', 'claude-haiku-6-0', 'deepseek-v3', 'gemini-embedding-2']) expect(currentReplacement(current), current).toBeNull();
expect(checkModelGenerations({ arms: ['claude-opus-5-5', 'claude-opus-4-5#plain'], judge: 'gpt-5.5' }).refused).toEqual([
{ model: 'claude-opus-4-5', role: 'arm', replacement: 'claude-opus-5-5' },
{ model: 'gpt-5.5', role: 'judge', replacement: 'gpt-6.2-sol' },
]);
});
});
describe('checkModelGenerations', () => {
@@ -143,4 +159,58 @@ describe('dry run and pilot start', () => {
const pilot = startPilot({ out: path.join(d, 'pilot'), cap: 5, n: 1, arms: ['claude-opus-4-7'], dryRun: dry });
expect(pilot.error).toEqual({ code: 'EVAL_MODEL_OLD_GENERATION', message: 'claude-opus-4-7 is an older generation; use claude-opus-5-5 (R116)' });
});
const files = (plan: string) => ({ 'prereg.md': plan, 'rows.jsonl': JSON.stringify({ prompt: 'hello world' }) + '\n', 'retry.txt': 'retry\n' });
const dryArgs = (arms: string, ...more: string[]) => ['dry-run', '--input', 'rows.jsonl', '--arms', arms, '--retry-prompt', 'retry.txt', ...more];
test('dry-run --prereg keeps a vendor-default arm the plan declares, and still refuses every other older arm', () => {
const plan = prereg({ arms: ['claude-opus-5-5', 'gpt-4o#mem0'], judge: 'gemini-4-argon', models: 'vendor-default: gpt-4o Mem0 1.2 as its vendor ships it' });
expect(cli(['prereg', '--check', 'prereg.md'], { 'prereg.md': plan }).code).toBe(0);
const bare = cli(dryArgs('claude-opus-5-5,gpt-4o#mem0'), files(plan));
expect(bare.code).toBe(1);
expect(bare.err).toContain('pass --prereg <file> when the plan has a vendor-default line');
const kept = cli(dryArgs('claude-opus-5-5,gpt-4o#mem0', '--prereg', 'prereg.md'), files(plan));
expect(kept.code, kept.err).toBe(0);
expect(kept.out).toContain('DRY_RUN_RESULT: pass');
expect(kept.out).toContain('MODEL_EXCEPTION: gpt-4o vendor-default system="Mem0 1.2 as its vendor ships it" roles=arm');
const other = cli(dryArgs('claude-opus-5-5,gpt-4o#mem0,gpt-4o', '--prereg', 'prereg.md'), files(plan));
expect(other.code).toBe(1);
expect(other.out).toContain('CHECK: model-generation refused gpt-4o (use gpt-6.2-sol)');
});
test('dry-run --prereg honours a plan frozen before R116, and pilot start reads both from dry-run.json', () => {
const frozen = prereg({ arms: ['claude-opus-5-5', 'claude-opus-4-7#plain'], frozen: '2026-11-20' });
const d = tmp();
for (const [name, text] of Object.entries(files(frozen))) fs.writeFileSync(path.join(d, name), text);
const run = (args: string[]) => spawnSync(BIN, args, { cwd: d, encoding: 'utf8', timeout: 60_000 });
const kept = run(dryArgs('claude-opus-5-5,claude-opus-4-7#plain', '--prereg', 'prereg.md', '--out', 'dry'));
expect(kept.status, kept.stderr).toBe(0);
expect(kept.stdout).toContain('MODEL_GENERATION: exempt (frozen 2026-11-20 in prereg.md, before R116)');
const pilot = startPilot({ out: path.join(d, 'pilot'), cap: 5, n: 1, arms: ['claude-opus-5-5', 'claude-opus-4-7#plain'], dryRun: path.join(d, 'dry', 'dry-run.json') });
expect(pilot.error).toBeUndefined();
const vendor = prereg({ arms: ['claude-opus-5-5', 'gpt-4o#mem0'], judge: 'gemini-4-argon', models: 'vendor-default: gpt-4o Mem0 1.2 as shipped' });
fs.writeFileSync(path.join(d, 'prereg.md'), vendor);
expect(run(dryArgs('claude-opus-5-5,gpt-4o#mem0', '--prereg', 'prereg.md', '--out', 'dry2')).status).toBe(0);
const dry2 = path.join(d, 'dry2', 'dry-run.json');
expect(startPilot({ out: path.join(d, 'p2'), cap: 5, n: 1, arms: ['claude-opus-5-5', 'gpt-4o#mem0'], dryRun: dry2 }).error).toBeUndefined();
expect(startPilot({ out: path.join(d, 'p3'), cap: 5, n: 1, arms: ['gpt-4o'], dryRun: dry2 }).error?.code).toBe('EVAL_MODEL_OLD_GENERATION');
});
test('dry-run --prereg names a malformed vendor-default line instead of blaming an arm', () => {
const r = cli(dryArgs('claude-opus-5-5,gpt-6.2-sol', '--prereg', 'prereg.md'), files(prereg({ arms: ['claude-opus-5-5', 'gpt-6.2-sol'], models: 'vendor-default: gpt-4o' })));
expect(r.code).toBe(1);
expect(r.err).toContain('vendor-default: gpt-4o needs the model and the competitor system');
expect(r.err).not.toContain('an arm is gpt-4o');
});
test('a frozen: date exempts only arms the plan names, in dry-run and in pilot start', () => {
const forged = cli(dryArgs('gpt-4o,claude-opus-5-5', '--prereg', 'p.md'), { ...files(''), 'p.md': 'frozen: 2026-11-01\n' });
expect(forged.code).toBe(1);
expect(forged.out).toContain('CHECK: model-generation refused gpt-4o (use gpt-6.2-sol)');
expect(forged.err).toContain('p.md does not name gpt-4o,claude-opus-5-5');
const d = tmp();
for (const [name, text] of Object.entries(files(prereg({ arms: ['claude-opus-5-5', 'claude-opus-4-7#plain'], frozen: '2026-11-20' })))) fs.writeFileSync(path.join(d, name), text);
expect(spawnSync(BIN, dryArgs('claude-opus-5-5,claude-opus-4-7#plain', '--prereg', 'prereg.md', '--out', 'dry'), { cwd: d, encoding: 'utf8', timeout: 60_000 }).status).toBe(0);
expect(startPilot({ out: path.join(d, 'pilot'), cap: 5, n: 1, arms: ['claude-opus-5-5', 'gpt-4o'], dryRun: path.join(d, 'dry', 'dry-run.json') }).error?.code).toBe('EVAL_MODEL_OLD_GENERATION');
});
});
+1 -1
View File
@@ -21,7 +21,7 @@ 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 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 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\ngrader: none, the scorer runs no git in the agent\'s repo\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';
+1 -1
View File
@@ -14,7 +14,7 @@ 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 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 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\ngrader: none, the scorer runs no git in the agent\'s repo\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',
+32 -1
View File
@@ -19,7 +19,7 @@ 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 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 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\ngrader: none, the scorer runs no git in the agent\'s repo\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}`;
/** A freeze date before the R78 amendment's 100-label bar (2026-11-22), so these fixtures keep testing the 40-label rules they were written for. */
const JUDGE_40_FROZEN = '2026-11-21';
@@ -103,6 +103,37 @@ describe(`R78 amendment: a plan frozen on or after ${JUDGE_LABELS_RAISED_SINCE}
expect(checkJudgeLabels(early, labels(40, 4))).toMatchObject({ ok: true, need_n: 40 });
expect(checkJudgeLabels({ judge: 'gpt-6-astra', labels: 40, agreement: 0.6, errors: [] }, labels(40, 4)).need_n).toBe(100);
});
const cli = (args: string[], files: Record<string, string>) => {
const d = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-judge-bar-')); dirs.push(d);
for (const [name, text] of Object.entries(files)) fs.writeFileSync(path.join(d, name), text);
const r = spawnSync(BIN, args, { cwd: d, encoding: 'utf8', timeout: 60_000 });
return { code: r.status, out: r.stdout ?? '', err: r.stderr ?? '' };
};
test('prereg --check on the command line: 40 labels pass the day before and fail from the date, where 100 pass', () => {
expect(cli(['prereg', '--check', 'p.md'], { 'p.md': prereg({ frozen: '2026-11-21' }) }).code).toBe(0);
const late = cli(['prereg', '--check', 'p.md'], { 'p.md': prereg({ frozen: JUDGE_LABELS_RAISED_SINCE }) });
expect(late.code).toBe(1);
expect(late.out).toContain('PREREG: incomplete');
expect(late.err).toContain('PREREG_INCOMPLETE');
expect(late.err).toContain('scoring: labels: needs at least 100 hand-labelled outputs the judge is checked against (40 only for a plan frozen before 2026-11-22)');
expect(cli(['prereg', '--check', 'p.md'], { 'p.md': prereg({ frozen: JUDGE_LABELS_RAISED_SINCE, scoring: SCORING('gpt-6-astra', scoring100) }) }).code).toBe(0);
});
test('judge --check on the command line: a plan frozen from the date needs 100 labelled rows; one frozen before keeps 40', () => {
const late = prereg({ frozen: JUDGE_LABELS_RAISED_SINCE, scoring: SCORING('gpt-6-astra', scoring100) });
const short = cli(['judge', '--check', 'p.md', '--labels', 'l.jsonl'], { 'p.md': late, 'l.jsonl': labels(40, 4) });
expect(short.code).toBe(1);
expect(short.err).toContain('EVAL_JUDGE_UNCHECKED');
expect(short.err).toContain('40 labelled outputs, needs 100');
const full = cli(['judge', '--check', 'p.md', '--labels', 'l.jsonl', '--json'], { 'p.md': late, 'l.jsonl': labels(100, 10) });
expect(full.code, full.err).toBe(0);
expect(JSON.parse(full.out)).toMatchObject({ ok: true, n: 100, need_n: 100, need_kappa: 0.6 });
const early = cli(['judge', '--check', 'p.md', '--labels', 'l.jsonl', '--json'], { 'p.md': prereg({ frozen: '2026-11-21' }), 'l.jsonl': labels(40, 4) });
expect(early.code, early.err).toBe(0);
expect(JSON.parse(early.out)).toMatchObject({ ok: true, n: 40, need_n: 40 });
});
});
describe('judge labels', () => {
+1 -1
View File
@@ -15,7 +15,7 @@ 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 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 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\ngrader: none, the scorer runs no git in the agent\'s repo\n';
const BASE = ['Bars', 'Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`).join('\n') + '\n' + RESULT_SECTIONS + LOOP;
const PREREG = BASE + `
## Arms
+1 -1
View File
@@ -62,7 +62,7 @@ describe('preregistration', () => {
.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');
.replace('## Held-out exposure\n- filled in', '## Held-out exposure\nanswers: other git refs and build caches checked\ngrader: none, the scorer runs no git');
expect(checkPrereg(filled)).toMatchObject({ ok: true, missing: [], empty: [] });
expect(checkPrereg('# nothing here\n').missing).toEqual([...PREREG_SECTIONS]);
});