mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 09:01:28 +01:00
/eval-plan refuses gpt-4o and older-generation models in every role, and asks for 100 judge labels from 2026-11-22 (GST-3384) (#4630)
/eval-plan now refuses gpt-4o and older-generation models in every role a plan picks (arms, judge, readers, simulators) and names the replacement; a competitor tested as its vendor ships it keeps its built-in model on its own arm. Why: eval numbers should come from current frontier models, and from 2026-11-22 a model judge must agree with 100 hand labels, not 40. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: lib/eval-plan-checks.ts:153:functional-contract reader=qa Review-Finding: p1/red-team#2 reader=red-team
This commit is contained in:
1 parent
79eea6d5fc
commit
5db285c1a4
71 files changed
+458
-139
No files matched your search
@@ -55,7 +55,7 @@ function exercise(spec: Spec) {
|
||||
maxTurns: 12, timeoutMs: 240_000 });
|
||||
}
|
||||
for (const { request } of facts.judgeRequests) {
|
||||
expect(request).toMatchObject({ model: 'claude-haiku-4-5-20251001', max_tokens: 8192 });
|
||||
expect(request).toMatchObject({ model: 'claude-haiku-5-5', max_tokens: 8192 });
|
||||
}
|
||||
for (const input of facts.inputs) {
|
||||
expect(input).toMatchObject({ model: 'fixture-model', maxTurns: 12, tools: ['Read', 'Write', 'AskUserQuestion'],
|
||||
|
||||
@@ -14,8 +14,8 @@ describe("resolveEvalModel", () => {
|
||||
});
|
||||
test("defaults per kind", () => {
|
||||
expect(resolveEvalModel("capture", null, {} as never)).toBe(CLAUDE_CAPTURE_EVAL_MODEL);
|
||||
expect(resolveEvalModel("warmup", null, {} as never)).toBe("claude-haiku-4-5");
|
||||
expect(resolveEvalModel("distill", null, {} as never)).toBe("claude-haiku-4-5-20251001");
|
||||
expect(resolveEvalModel("warmup", null, {} as never)).toBe("claude-haiku-5-5");
|
||||
expect(resolveEvalModel("distill", null, {} as never)).toBe("claude-haiku-5-5");
|
||||
expect(resolveEvalModel("judge", null, {} as never)).toBe(CLAUDE_JUDGE_EVAL_MODEL);
|
||||
});
|
||||
test("unknown kind throws instead of silently defaulting", () => {
|
||||
|
||||
@@ -15,8 +15,10 @@ const COST: Record<string, string> = { paid: '$200', meter: '$40', ledger: 'the
|
||||
const INTERIM: Record<string, string> = { 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<string, string>) => Object.entries(o).map(([k, v]) => `${k}: ${v}`).join('\n');
|
||||
const without = (o: Record<string, string>, k: string) => Object.fromEntries(Object.entries(o).filter(([key]) => key !== k));
|
||||
/** 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';
|
||||
const plan = (o: { pilot?: Record<string, string>; cost?: Record<string, string>; interim?: Record<string, string> | null; scoring?: string; arms?: string; bars?: string; heldOut?: string; frozen?: string } = {}) => [
|
||||
o.frozen ? `frozen: ${o.frozen}\n` : '',
|
||||
`frozen: ${o.frozen ?? JUDGE_40_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`,
|
||||
@@ -54,7 +56,7 @@ describe('## Scoring per arm and effort (R78, G14)', () => {
|
||||
});
|
||||
|
||||
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 scoring = { judge: 'gpt-6.2-astra', labels: 40, agreement: 0.6, errors: [], per_arm: true, min_labels: 40 };
|
||||
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));
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* R116 (Garry, 2026-11-21): /eval-plan refuses gpt-4o and every model
|
||||
* lib/pricing.ts marks superseded_by, in every role a plan chooses (arm,
|
||||
* judge, reader, simulator), naming the role and the current replacement. A
|
||||
* competitor system's vendor default is an explicit, recorded exception
|
||||
* (docs/TESTING_INTERNALS.md#frontier-models-under-test).
|
||||
*/
|
||||
import { afterEach, describe, expect, test } from 'bun:test';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import * as fs from 'node:fs';
|
||||
import * as os from 'node:os';
|
||||
import * as path from 'node:path';
|
||||
import { checkPrereg, dryRun, renderDryRun, startPilot } from '../lib/eval-plan';
|
||||
import { checkModelGenerations, MODEL_GENERATIONS_SINCE } from '../lib/eval-plan-checks';
|
||||
import { checkResults } from '../lib/eval-plan-report';
|
||||
import { currentReplacement, PRICING } from '../lib/pricing';
|
||||
|
||||
const BIN = path.resolve(import.meta.dir, '..', 'bin', 'gstack-eval-plan');
|
||||
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 prereg = (o: { arms?: string[]; judge?: string; models?: string; frozen?: string } = {}) => [
|
||||
o.frozen ? `frozen: ${o.frozen}\n` : '',
|
||||
'## Bars\n- 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', 'claude-opus-5-5#plain']).map(a => `- ${a} settings`).join('\n')}\n`,
|
||||
'## Comparison\nstack: none\nwhy: the scorer calibration compares prompts, not skill stacks\n',
|
||||
`## Scoring\njudge: ${o.judge ?? 'gpt-6-astra'}\nlabels: 100\nagreement: 0.6\nper-arm: yes\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items\n`,
|
||||
o.models ? `## Models\n${o.models}\n` : '',
|
||||
...['Decoys', 'Stop rules'].map(s => `## ${s}\n- filled in\n`),
|
||||
LOOP,
|
||||
].join('\n');
|
||||
const cli = (args: string[], files: Record<string, string>) => {
|
||||
const d = tmp();
|
||||
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 ?? '' };
|
||||
};
|
||||
|
||||
describe('lib/pricing.ts generation marks', () => {
|
||||
test('every superseded_by names a priced row that is itself current', () => {
|
||||
const marked = Object.entries(PRICING).filter(([, row]) => row.superseded_by);
|
||||
expect(marked.length).toBeGreaterThan(0);
|
||||
for (const [model, row] of marked) {
|
||||
const next = PRICING[row.superseded_by!];
|
||||
expect(next, `${model} -> ${row.superseded_by}`).toBeDefined();
|
||||
expect(next!.superseded_by, `${row.superseded_by} is itself superseded`).toBeUndefined();
|
||||
}
|
||||
});
|
||||
|
||||
test('gpt-4o in every form, and dated or prefixed older ids, resolve to their replacement; point releases stay current', () => {
|
||||
expect(currentReplacement('gpt-4o')).toBe('gpt-6.2-sol');
|
||||
expect(currentReplacement('openrouter:openai/gpt-4o')).toBe('gpt-6.2-sol');
|
||||
expect(currentReplacement('chatgpt-4o-latest')).toBe('gpt-6.2-sol');
|
||||
expect(currentReplacement('gpt-4o-2024-05-13')).toBe('gpt-6.2-sol');
|
||||
expect(currentReplacement('openai/gpt-4o-mini')).toBe('gpt-6-luna');
|
||||
expect(currentReplacement('ft:gpt-4o-mini-2024-07-18:org::id')).toBe('gpt-6-luna');
|
||||
expect(currentReplacement('claude-haiku-4-5-20251001')).toBe('claude-haiku-5-5');
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
||||
describe('checkModelGenerations', () => {
|
||||
test('negative control: Opus 5.5 and GPT-6.2 Sol arms with a GPT-6 Astra judge pass', () => {
|
||||
const c = checkModelGenerations({ arms: ['claude-opus-5-5', 'gpt-6.2-sol#no-gstack'], judge: 'gpt-6-astra', models: ['reader: claude-opus-5-5', 'simulator: gpt-6.2-sol'] });
|
||||
expect(c).toEqual({ ok: true, exempt: false, refused: [], exceptions: [], errors: [] });
|
||||
});
|
||||
|
||||
test('refuses each role and names the replacement', () => {
|
||||
const c = checkModelGenerations({ arms: ['claude-sonnet-4-6', 'claude-sonnet-4-6#no-gstack'], judge: 'gpt-4o', models: ['- reader: claude-haiku-4-5-20251001, claude-opus-5-5', 'simulators: openai/gpt-4o-mini'] });
|
||||
expect(c.ok).toBe(false);
|
||||
expect(c.refused).toEqual([
|
||||
{ model: 'claude-sonnet-4-6', role: 'arm', replacement: 'claude-sonnet-5-5' },
|
||||
{ model: 'gpt-4o', role: 'judge', replacement: 'gpt-6.2-sol' },
|
||||
{ model: 'claude-haiku-4-5-20251001', role: 'reader', replacement: 'claude-haiku-5-5' },
|
||||
{ model: 'openai/gpt-4o-mini', role: 'simulator', replacement: 'gpt-6-luna' },
|
||||
]);
|
||||
});
|
||||
|
||||
test('a vendor default covers the competitor arm only, and needs the system it ships with', () => {
|
||||
const c = checkModelGenerations({ arms: ['claude-opus-5-5', 'gpt-4o-mini#mem0'], judge: 'gpt-4o-mini', models: ['vendor-default: gpt-4o-mini — Mem0 1.2 as its vendor ships it'] });
|
||||
expect(c.exceptions).toEqual([{ model: 'gpt-4o-mini', system: 'Mem0 1.2 as its vendor ships it', roles: ['arm'] }]);
|
||||
expect(c.refused).toEqual([{ model: 'gpt-4o-mini', role: 'judge', replacement: 'gpt-6-luna' }]);
|
||||
const others = checkModelGenerations({ arms: ['openrouter:openai/gpt-4o-mini#mem0', 'gpt-4o-mini', 'gpt-4o-mini#no-gstack'], models: ['vendor-default: gpt-4o-mini Mem0 1.2 as shipped'] });
|
||||
expect(others.refused).toEqual([{ model: 'gpt-4o-mini', role: 'arm', replacement: 'gpt-6-luna' }]);
|
||||
expect(others.exceptions[0]!.roles).toEqual(['arm']);
|
||||
const bare = checkModelGenerations({ arms: ['gpt-4o#mem0'], models: ['vendor-default: gpt-4o'] });
|
||||
expect(bare.ok).toBe(false);
|
||||
expect(bare.errors[0]).toContain('competitor system');
|
||||
});
|
||||
|
||||
test(`a plan frozen before ${MODEL_GENERATIONS_SINCE} keeps its models`, () => {
|
||||
expect(checkModelGenerations({ arms: ['gpt-4o'], judge: 'gpt-4o', frozen: '2026-11-20' })).toMatchObject({ ok: true, exempt: true });
|
||||
expect(checkModelGenerations({ arms: ['gpt-4o'], frozen: MODEL_GENERATIONS_SINCE }).ok).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('gstack-eval-plan prereg --check', () => {
|
||||
test('negative control: a current plan prints no MODEL lines and passes', () => {
|
||||
const r = cli(['prereg', '--check', 'prereg.md'], { 'prereg.md': prereg() });
|
||||
expect(r.code, r.err).toBe(0);
|
||||
expect(r.out).not.toContain('MODEL_');
|
||||
expect(checkPrereg(prereg()).models.ok).toBe(true);
|
||||
});
|
||||
|
||||
test('a gpt-4o judge is refused with the role and the replacement', () => {
|
||||
const r = cli(['prereg', '--check', 'prereg.md'], { 'prereg.md': prereg({ judge: 'gpt-4o' }) });
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain(' models=refused ');
|
||||
expect(r.out).toContain('MODEL_GENERATION: refused gpt-4o role=judge replacement=gpt-6.2-sol');
|
||||
expect(r.err).toContain('EVAL_MODEL_OLD_GENERATION');
|
||||
expect(r.err).toContain('gpt-4o as judge is an older generation; use gpt-6.2-sol (R116)');
|
||||
});
|
||||
|
||||
test('a vendor-default exception passes and is recorded; the results must name it', () => {
|
||||
const text = prereg({ arms: ['claude-opus-5-5', 'gpt-4o-mini#mem0'], judge: 'gemini-4-argon', models: 'reader: claude-opus-5-5\nvendor-default: gpt-4o-mini Mem0 1.2 as its vendor ships it' });
|
||||
const r = cli(['prereg', '--check', 'prereg.md', '--json'], { 'prereg.md': text });
|
||||
expect(r.code, r.err).toBe(0);
|
||||
expect(JSON.parse(r.out).models.exceptions).toEqual([{ model: 'gpt-4o-mini', system: 'Mem0 1.2 as its vendor ships it', roles: ['arm'] }]);
|
||||
const plain = cli(['prereg', '--check', 'prereg.md'], { 'prereg.md': text });
|
||||
expect(plain.out).toContain('MODEL_EXCEPTION: gpt-4o-mini vendor-default system="Mem0 1.2 as its vendor ships it" roles=arm');
|
||||
const issues = (results: string) => checkResults(text, results).issues.filter(i => i.code === 'EVAL_MODEL_OLD_GENERATION');
|
||||
expect(issues('| arm | pass |\n|---|---|\n| claude-opus-5-5 | 12/20 |\n')[0]!.message).toContain('never name gpt-4o-mini');
|
||||
expect(issues('| arm | pass |\n|---|---|\n| claude-opus-5-5 | 12/20 |\n| gpt-4o-mini#mem0 (vendor default gpt-4o-mini) | 9/20 |\n')).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('dry run and pilot start', () => {
|
||||
test('a gpt-4o arm fails the dry run, and pilot start refuses an older-generation arm', () => {
|
||||
const d = tmp();
|
||||
const rows = path.join(d, 'rows.jsonl'); fs.writeFileSync(rows, JSON.stringify({ prompt: 'hello world' }) + '\n');
|
||||
const retry = path.join(d, 'retry.txt'); fs.writeFileSync(retry, 'retry\n');
|
||||
const stale = dryRun({ input: rows, arms: ['claude-opus-5-5', 'gpt-4o'], retryPrompt: retry });
|
||||
expect(stale.pass).toBe(false);
|
||||
expect(renderDryRun(stale)).toContain('CHECK: model-generation refused gpt-4o (use gpt-6.2-sol)');
|
||||
const current = dryRun({ input: rows, arms: ['claude-opus-5-5', 'gpt-6.2-sol'], retryPrompt: retry });
|
||||
expect(current.pass).toBe(true);
|
||||
expect(renderDryRun(current)).not.toContain('model-generation');
|
||||
const dry = path.join(d, 'dry.json'); fs.writeFileSync(dry, JSON.stringify(current));
|
||||
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)' });
|
||||
});
|
||||
});
|
||||
@@ -11,7 +11,7 @@ import * as fs from 'node:fs';
|
||||
import * as os from 'node:os';
|
||||
import * as path from 'node:path';
|
||||
import { checkPrereg } from '../lib/eval-plan';
|
||||
import { checkDecisions, checkJudgeLabels, checkScoring, cohensKappa, modelFamily } from '../lib/eval-plan-checks';
|
||||
import { checkDecisions, checkJudgeLabels, checkScoring, cohensKappa, JUDGE_LABELS_RAISED_SINCE, modelFamily } from '../lib/eval-plan-checks';
|
||||
import { checkResults } from '../lib/eval-plan-report';
|
||||
|
||||
const BIN = path.resolve(import.meta.dir, '..', 'bin', 'gstack-eval-plan');
|
||||
@@ -21,8 +21,10 @@ afterEach(() => { while (dirs.length) fs.rmSync(dirs.pop()!, { recursive: 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 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';
|
||||
const prereg = (o: { decisions?: string; scoring?: string; frozen?: string; diagnostics?: string } = {}) => [
|
||||
o.frozen ? `frozen: ${o.frozen}\n` : '',
|
||||
`frozen: ${o.frozen ?? JUDGE_40_FROZEN}\n`,
|
||||
'## Bars\n- pass rate, higher is better\n',
|
||||
o.decisions ?? DECISIONS,
|
||||
'## Arms\n- claude-opus-5-5 the skill installed\n- claude-opus-5-5#plain no skill\n',
|
||||
@@ -54,13 +56,13 @@ describe('## Decisions', () => {
|
||||
describe('## Scoring', () => {
|
||||
const arms = ['claude-opus-5-5', 'claude-opus-5-5#plain'];
|
||||
test('a judge from another family with 40 labels, kappa 0.6 and the paired statistics passes', () => {
|
||||
expect(checkScoring(SCORING().split('\n').slice(1), arms).errors).toEqual([]);
|
||||
expect(checkScoring(SCORING().split('\n').slice(1), arms, JUDGE_40_FROZEN).errors).toEqual([]);
|
||||
});
|
||||
|
||||
test('a same-family judge, too few labels, a low kappa bar or missing statistics fail', () => {
|
||||
expect(checkScoring(SCORING('claude-fable-5-2').split('\n').slice(1), arms).errors.join()).toContain('same model family (anthropic)');
|
||||
expect(checkScoring(SCORING('gpt-6-astra', 'labels: 39\nagreement: 0.6\npaired: yes\ninterval: 95%\nmdd: 3\n').split('\n').slice(1), arms).errors[0]).toContain('at least 40');
|
||||
expect(checkScoring(SCORING('gpt-6-astra', 'labels: 40\nagreement: 0.5\npaired: yes\ninterval: 95%\nmdd: 3\n').split('\n').slice(1), arms).errors[0]).toContain('kappa bar');
|
||||
expect(checkScoring(SCORING('claude-fable-5-2').split('\n').slice(1), arms, JUDGE_40_FROZEN).errors.join()).toContain('same model family (anthropic)');
|
||||
expect(checkScoring(SCORING('gpt-6-astra', 'labels: 39\nagreement: 0.6\npaired: yes\ninterval: 95%\nmdd: 3\n').split('\n').slice(1), arms, JUDGE_40_FROZEN).errors[0]).toContain('at least 40');
|
||||
expect(checkScoring(SCORING('gpt-6-astra', 'labels: 40\nagreement: 0.5\npaired: yes\ninterval: 95%\nmdd: 3\n').split('\n').slice(1), arms, JUDGE_40_FROZEN).errors[0]).toContain('kappa bar');
|
||||
expect(checkScoring(['judge: none'], arms).errors).toEqual(['paired: yes (every comparison is reported on paired items)', 'interval: 95% (the interval every comparison is reported with)', 'mdd: the smallest difference this run can detect, stated before the run']);
|
||||
expect(checkScoring(['judge: none'], ['claude-opus-5-5']).errors).toEqual([]);
|
||||
expect(checkScoring(['labels: 40'], arms).errors[0]).toContain('no judge: line');
|
||||
@@ -79,8 +81,32 @@ describe('## Scoring', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe(`R78 amendment: a plan frozen on or after ${JUDGE_LABELS_RAISED_SINCE} checks its judge on 100 labels`, () => {
|
||||
const scoring100 = 'labels: 100\nagreement: 0.6\nper-arm: yes\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items\n';
|
||||
test('the day before keeps 40; the day itself and a plan with no frozen: line need 100', () => {
|
||||
expect(checkPrereg(prereg({ frozen: '2026-11-21' })).scoring).toMatchObject({ errors: [], min_labels: 40 });
|
||||
for (const frozen of [JUDGE_LABELS_RAISED_SINCE, '2026-12-01']) {
|
||||
const s = checkPrereg(prereg({ frozen })).scoring;
|
||||
expect(s.min_labels).toBe(100);
|
||||
expect(s.errors).toEqual(['labels: needs at least 100 hand-labelled outputs the judge is checked against (40 only for a plan frozen before 2026-11-22)']);
|
||||
expect(checkPrereg(prereg({ frozen, scoring: SCORING('gpt-6-astra', scoring100) })).ok).toBe(true);
|
||||
}
|
||||
expect(checkScoring(SCORING().split('\n').slice(1), ['claude-opus-5-5'], null).min_labels).toBe(100);
|
||||
});
|
||||
|
||||
test('judge --check counts against the bar of the freeze date; kappa stays 0.6', () => {
|
||||
const labels100 = labels(100, 10);
|
||||
const late = checkPrereg(prereg({ frozen: JUDGE_LABELS_RAISED_SINCE, scoring: SCORING('gpt-6-astra', scoring100) })).scoring;
|
||||
expect(checkJudgeLabels(late, labels(40, 4)).problems).toEqual(['40 labelled outputs, needs 100']);
|
||||
expect(checkJudgeLabels(late, labels100)).toMatchObject({ ok: true, n: 100, need_n: 100, need_kappa: 0.6 });
|
||||
const early = checkPrereg(prereg({ frozen: '2026-11-21' })).scoring;
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
describe('judge labels', () => {
|
||||
const scoring = { judge: 'gpt-6-astra', labels: 40, agreement: 0.6, errors: [] };
|
||||
const scoring = { judge: 'gpt-6-astra', labels: 40, agreement: 0.6, errors: [], min_labels: 40 };
|
||||
test("Cohen's kappa: perfect, chance and undefined agreement", () => {
|
||||
expect(cohensKappa([['a', 'a'], ['b', 'b']])).toBe(1);
|
||||
expect(cohensKappa([['a', 'a'], ['a', 'b'], ['b', 'a'], ['b', 'b']])).toBe(0);
|
||||
|
||||
@@ -88,7 +88,7 @@ export interface RecommendationScore {
|
||||
* Call an Anthropic model with a prompt, extract JSON response.
|
||||
* Jittered exponential backoff over three 429 retries. Model resolves via
|
||||
* lib/eval-model's `judge` kind (CLAUDE_JUDGE_EVAL_MODEL); pass a model id
|
||||
* (e.g. claude-haiku-4-5-20251001) for cheaper bounded judgments like
|
||||
* (e.g. claude-haiku-5-5) for cheaper bounded judgments like
|
||||
* judgeRecommendation.
|
||||
*/
|
||||
// Default judge model: CLAUDE_JUDGE_EVAL_MODEL, kept apart from the model under
|
||||
@@ -582,7 +582,7 @@ Respond with ONLY valid JSON:
|
||||
|
||||
const out = await callJudge<{ reason_substance: number; reasoning: string }>(
|
||||
prompt,
|
||||
'claude-haiku-4-5-20251001',
|
||||
'claude-haiku-5-5',
|
||||
{ signal, jsonSchema: RECOMMENDATION_JUDGE_SCHEMA },
|
||||
);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import { resolveClaudeBinary } from './binary';
|
||||
// Used by polling loops as a fallback after N seconds with no terminal
|
||||
// classification. On 'waiting' verdict, return outcome='asked' early.
|
||||
//
|
||||
// Cost: ~$0.0005 per call using claude haiku 4.5. Cached by snapshot hash so
|
||||
// Cost: ~$0.0005 per call using claude haiku 5.5 (the warmup default). Cached by snapshot hash so
|
||||
// identical TTY frames don't re-charge. All verdicts logged to
|
||||
// ~/.gstack/analytics/pty-judge.jsonl for offline analysis.
|
||||
// ────────────────────────────────────────────────────────────────────────────
|
||||
@@ -82,7 +82,7 @@ export function logPtySnapshot(visible: string, ctx: { testName: string; elapsed
|
||||
/**
|
||||
* Ask Claude Haiku 4.5 to classify a TTY snapshot as waiting/working/hung.
|
||||
*
|
||||
* Implementation: spawns `claude -p --model claude-haiku-4-5` synchronously
|
||||
* Implementation: spawns `claude -p --model <resolveEvalModel("warmup"), claude-haiku-5-5 by default>` synchronously
|
||||
* with the prompt piped via stdin. Uses subscription auth (no API key env
|
||||
* required). 30-second timeout; returns 'unknown' on any failure mode
|
||||
* (timeout, malformed JSON, missing claude binary). Asynchronous: a PTY
|
||||
|
||||
@@ -206,7 +206,7 @@ describe('frontier Claude judge compatibility', () => {
|
||||
expect(score.reason_substance).toBe(4);
|
||||
expect(score.reason_text).toBe('at 1/10 every dimension has gaps and none are obviously safe to skip.');
|
||||
expect(create.mock.calls[0][0].output_config).toEqual({ format: { type: 'json_schema', schema: RECOMMENDATION_JUDGE_SCHEMA } });
|
||||
expect(create.mock.calls[0][0].model).toBe('claude-haiku-4-5-20251001');
|
||||
expect(create.mock.calls[0][0].model).toBe('claude-haiku-5-5');
|
||||
});
|
||||
|
||||
test('the captured unescaped reply is unparseable free-form text and fails without a score', async () => {
|
||||
|
||||
@@ -138,14 +138,14 @@ describe('dry run', () => {
|
||||
const rows = path.join(d, 'rows.jsonl');
|
||||
fs.writeFileSync(rows, [JSON.stringify({ prompt: 'hello world' }), JSON.stringify({ prompt: 'second row' })].join('\n') + '\n');
|
||||
const retry = path.join(d, 'retry.txt'); fs.writeFileSync(retry, 'retry\n');
|
||||
const small = dryRun({ input: rows, arms: ['claude-haiku-4-5', 'claude-sonnet-5-5#no-gstack'], retryPrompt: retry });
|
||||
const small = dryRun({ input: rows, arms: ['claude-haiku-5-5', 'claude-sonnet-5-5#no-gstack'], retryPrompt: retry });
|
||||
expect(small.pass).toBe(false);
|
||||
expect(small.checks.frontier).toMatchObject({ ok: false, small_tier: ['claude-haiku-4-5', 'claude-sonnet-5-5#no-gstack'], tier_question: null });
|
||||
expect(small.checks.frontier).toMatchObject({ ok: false, small_tier: ['claude-haiku-5-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.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' });
|
||||
const asked = dryRun({ input: rows, arms: ['claude-haiku-5-5'], retryPrompt: retry, tierQuestion: 'does the diet hold on Haiku' });
|
||||
expect(asked.pass).toBe(true);
|
||||
expect(renderDryRun(asked)).toContain('CHECK: frontier ok (tier question');
|
||||
const mixed = dryRun({ input: rows, arms: ['claude-opus-5-5', 'claude-sonnet-5-5'], retryPrompt: retry });
|
||||
@@ -156,10 +156,10 @@ describe('dry run', () => {
|
||||
expect(renderDryRun(frontier)).not.toContain('CHECK: frontier');
|
||||
expect(['claude-opus-5-5', 'gpt-6.1-sol', 'gpt-6-luna', 'gemini-3.8-flash'].some(isSmallTierModel)).toBe(false);
|
||||
const dryFile = (name: string, r: unknown) => { const f = path.join(d, name); fs.writeFileSync(f, JSON.stringify(r)); return f; };
|
||||
const swapped = startPilot({ out: path.join(d, 'swapped'), cap: 5, n: 1, arms: ['claude-haiku-4-5'], dryRun: dryFile('frontier.json', frontier) });
|
||||
const swapped = startPilot({ out: path.join(d, 'swapped'), cap: 5, n: 1, arms: ['claude-haiku-5-5'], dryRun: dryFile('frontier.json', frontier) });
|
||||
expect(swapped.error?.code).toBe('EVAL_DRY_RUN_FAILED');
|
||||
expect(fs.existsSync(path.join(d, 'swapped'))).toBe(false);
|
||||
expect(startPilot({ out: path.join(d, 'asked'), cap: 5, n: 1, arms: ['claude-haiku-4-5'], dryRun: dryFile('asked.json', asked) }).error).toBeUndefined();
|
||||
expect(startPilot({ out: path.join(d, 'asked'), cap: 5, n: 1, arms: ['claude-haiku-5-5'], dryRun: dryFile('asked.json', asked) }).error).toBeUndefined();
|
||||
expect(startPilot({ out: path.join(d, 'mixed'), cap: 5, n: 1, arms: ['claude-opus-5-5', 'claude-sonnet-5-5'], dryRun: dryFile('frontier2.json', frontier) }).error).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -168,7 +168,7 @@ describe('dry run', () => {
|
||||
try {
|
||||
const rows = path.join(host.base, 'rows.jsonl'); fs.writeFileSync(rows, JSON.stringify({ prompt: 'hello world' }) + '\n');
|
||||
const retry = path.join(host.base, 'retry.txt'); fs.writeFileSync(retry, 'retry\n');
|
||||
const run = (...extra: string[]) => spawnSync(BIN, ['dry-run', '--input', rows, '--arms', 'claude-haiku-4-5', '--retry-prompt', retry, ...extra], { cwd: host.base, env: host.env, encoding: 'utf8', timeout: 30_000 });
|
||||
const run = (...extra: string[]) => spawnSync(BIN, ['dry-run', '--input', rows, '--arms', 'claude-haiku-5-5', '--retry-prompt', retry, ...extra], { cwd: host.base, env: host.env, encoding: 'utf8', timeout: 30_000 });
|
||||
const flagAnswer = run('--tier-question', '--json');
|
||||
expect(flagAnswer.status).not.toBe(0);
|
||||
expect(flagAnswer.stderr).toContain('--tier-question needs the question');
|
||||
@@ -231,23 +231,23 @@ describe('priced pilot', () => {
|
||||
test('#3653: each arm is projected on its own, so arms at different prices that fit the cap are not told they exceed it', () => {
|
||||
const d = tmp();
|
||||
const out = path.join(d, 'mixed');
|
||||
const s = startPilot({ out, cap: 2, n: 3, arms: ['gpt-6-astra', 'gpt-5.4-mini'], dryRun: passingDryRun(d) });
|
||||
const s = startPilot({ out, cap: 2, n: 3, arms: ['gpt-6-astra', 'gpt-6-luna'], dryRun: passingDryRun(d) });
|
||||
expect(s.error).toBeUndefined();
|
||||
const usd: Record<string, number[]> = { 'gpt-6-astra': [0.001, 0.001, 0.001], 'gpt-5.4-mini': [0.10, 0.11, 0.12] };
|
||||
const usd: Record<string, number[]> = { 'gpt-6-astra': [0.001, 0.001, 0.001], 'gpt-6-luna': [0.10, 0.11, 0.12] };
|
||||
for (const a of s.record.attempts) settlePilot(out, a.attempt, usd[a.model]![a.row - 1]!);
|
||||
const r = pilotReport(out, { total: 10, workers: 1 });
|
||||
expect(r.projection.projected_usd).toBeCloseTo(1.11, 6);
|
||||
expect(r.projection.band_usd![0]).toBeCloseTo(1.11 - 4.303 * 0.01 / Math.sqrt(3) * 10, 4);
|
||||
expect(r.projection.band_usd![1]).toBeCloseTo(1.11 + 4.303 * 0.01 / Math.sqrt(3) * 10, 4);
|
||||
expect(r.projection.verdict).toBe('within');
|
||||
expect(r.projection.arms.map(a => [a.arm, a.n])).toEqual([['gpt-6-astra', 3], ['gpt-5.4-mini', 3]]);
|
||||
expect(renderPilotReport(r)).toContain('PILOT_ARM: arm=gpt-5.4-mini n=3 per_item=$0.1100');
|
||||
expect(r.projection.arms.map(a => [a.arm, a.n])).toEqual([['gpt-6-astra', 3], ['gpt-6-luna', 3]]);
|
||||
expect(renderPilotReport(r)).toContain('PILOT_ARM: arm=gpt-6-luna n=3 per_item=$0.1100');
|
||||
});
|
||||
|
||||
test('#3653: a priced arm mean is never multiplied across an arm settled unknown', () => {
|
||||
const d = tmp();
|
||||
const out = path.join(d, 'partial');
|
||||
const s = startPilot({ out, cap: 10, n: 3, arms: ['gpt-6-astra', 'gpt-5.4-mini'], dryRun: passingDryRun(d) });
|
||||
const s = startPilot({ out, cap: 10, n: 3, arms: ['gpt-6-astra', 'gpt-6-luna'], dryRun: passingDryRun(d) });
|
||||
for (const a of s.record.attempts) settlePilot(out, a.attempt, a.model === 'gpt-6-astra' ? 0.0003 : 'unknown');
|
||||
const r = pilotReport(out, { total: 400 });
|
||||
expect(r.projection.projected_usd).toBeCloseTo(0.12, 6);
|
||||
@@ -261,12 +261,12 @@ describe('priced pilot', () => {
|
||||
test('#3653: a declared seat-metered arm holds none of the cap, stays out of the verdict and gets its own line', () => {
|
||||
const d = tmp();
|
||||
const dry = passingDryRun(d);
|
||||
const est = startPilot({ out: path.join(d, 'probe'), cap: 100, n: 1, arms: ['gpt-6-astra', 'gpt-5.4-mini'], dryRun: dry }).record.attempts;
|
||||
const astra = est.find(a => a.model === 'gpt-6-astra')!.estimate_usd, mini = est.find(a => a.model === 'gpt-5.4-mini')!.estimate_usd;
|
||||
const est = startPilot({ out: path.join(d, 'probe'), cap: 100, n: 1, arms: ['gpt-6-astra', 'gpt-6-luna'], dryRun: dry }).record.attempts;
|
||||
const astra = est.find(a => a.model === 'gpt-6-astra')!.estimate_usd, mini = est.find(a => a.model === 'gpt-6-luna')!.estimate_usd;
|
||||
const cap = Number((3 * mini + 2 * astra).toFixed(4));
|
||||
expect(startPilot({ out: path.join(d, 'undeclared'), cap, n: 3, arms: ['gpt-5.4-mini', 'gpt-6-astra'], dryRun: dry }).error?.code).toBe('EVAL_BUDGET_EXHAUSTED');
|
||||
expect(startPilot({ out: path.join(d, 'undeclared'), cap, n: 3, arms: ['gpt-6-luna', 'gpt-6-astra'], dryRun: dry }).error?.code).toBe('EVAL_BUDGET_EXHAUSTED');
|
||||
const out = path.join(d, 'seat');
|
||||
const s = startPilot({ out, cap, n: 3, arms: ['gpt-5.4-mini', 'gpt-6-astra'], seatMetered: ['gpt-6-astra'], dryRun: dry });
|
||||
const s = startPilot({ out, cap, n: 3, arms: ['gpt-6-luna', 'gpt-6-astra'], seatMetered: ['gpt-6-astra'], dryRun: dry });
|
||||
expect(s.error).toBeUndefined();
|
||||
expect(s.record.seat_metered).toEqual(['gpt-6-astra']);
|
||||
expect(s.record.attempts.filter(a => a.model === 'gpt-6-astra').map(a => a.estimate_usd)).toEqual([0, 0, 0]);
|
||||
@@ -292,7 +292,7 @@ describe('priced pilot', () => {
|
||||
expect(charged.seat_metered).toEqual([]);
|
||||
expect(charged.projection.arms.map(a => [a.arm, a.n])).toEqual([['gpt-6-astra', 1]]);
|
||||
expect(charged.projection.verdict).toBe('unknown');
|
||||
expect(() => startPilot({ out: path.join(d, 'stray'), cap: 10, n: 1, arms: ['gpt-6-astra'], seatMetered: ['gpt-5.4-mini'], dryRun: dry })).toThrow('--seat-metered');
|
||||
expect(() => startPilot({ out: path.join(d, 'stray'), cap: 10, n: 1, arms: ['gpt-6-astra'], seatMetered: ['gpt-6-luna'], dryRun: dry })).toThrow('--seat-metered');
|
||||
const switched = path.join(d, 'switched');
|
||||
startPilot({ out: switched, cap: 1, n: 3, arms: ['gpt-6-astra'], seatMetered: ['gpt-6-astra'], dryRun: dry });
|
||||
expect(() => startPilot({ out: switched, cap: 1, n: 3, arms: ['gpt-6-astra'], dryRun: dry })).toThrow('needs a new --out');
|
||||
@@ -317,14 +317,14 @@ describe('priced pilot', () => {
|
||||
|
||||
test('#3653: a seat-metered arm still needs a price row, as the dry run does', () => {
|
||||
const d = tmp();
|
||||
const s = startPilot({ out: path.join(d, 'seat'), cap: 1, n: 2, arms: ['gpt-5.4-mini', 'seat-only-model'], seatMetered: ['seat-only-model'], dryRun: passingDryRun(d) });
|
||||
const s = startPilot({ out: path.join(d, 'seat'), cap: 1, n: 2, arms: ['gpt-6-luna', 'seat-only-model'], seatMetered: ['seat-only-model'], dryRun: passingDryRun(d) });
|
||||
expect(s.error?.code).toBe('EVAL_PRICE_MISSING');
|
||||
});
|
||||
|
||||
test('#3653: pilot start --seat-metered reaches the ledger through the CLI', () => {
|
||||
const d = tmp();
|
||||
const out = path.join(d, 'cli');
|
||||
const r = spawnSync(BIN, ['pilot', 'start', '--out', out, '--cap', '10', '--arms', 'gpt-5.4-mini,gpt-6-astra', '--seat-metered', 'gpt-6-astra', '--dry-run', passingDryRun(d)], { cwd: d, encoding: 'utf8', timeout: 30_000 });
|
||||
const r = spawnSync(BIN, ['pilot', 'start', '--out', out, '--cap', '10', '--arms', 'gpt-6-luna,gpt-6-astra', '--seat-metered', 'gpt-6-astra', '--dry-run', passingDryRun(d)], { cwd: d, encoding: 'utf8', timeout: 30_000 });
|
||||
expect(r.status).toBe(0);
|
||||
expect(r.stdout).toContain('PILOT_ATTEMPT: pilot-gpt-6-astra-1 model=gpt-6-astra estimate=$0.0000');
|
||||
expect(JSON.parse(fs.readFileSync(path.join(out, 'pilot.json'), 'utf8')).seat_metered).toEqual(['gpt-6-astra']);
|
||||
|
||||
@@ -24,7 +24,7 @@ import { describeIfSelected, testIfSelected } from './helpers/e2e-helpers';
|
||||
import { launchClaudePty, selectPtyNumberedOption } from './helpers/claude-pty-runner';
|
||||
import { closePacketReadAfterNotice, guardRunNeedsJournal, prepareGuardSession, startDispatchRelay, stoppedAtPhaseBoundary } from './helpers/autoplan-guard-pty';
|
||||
|
||||
const MODEL = 'claude-haiku-4-5-20251001';
|
||||
const MODEL = 'claude-haiku-5-5';
|
||||
|
||||
describeIfSelected('autoplan publication guard live PTY', ['autoplan-guard-pty'], () => {
|
||||
testIfSelected('autoplan-guard-pty', async () => {
|
||||
|
||||
@@ -23,7 +23,7 @@ import { resolveClaudeCommand } from '../lib/claude-bin';
|
||||
import { readOwnedClaudePublicTranscript, readPlanCountTranscript } from '../lib/claude-public-transcript';
|
||||
|
||||
const ROOT = path.resolve(import.meta.dir, '..');
|
||||
const CANARY_MODEL = 'claude-haiku-4-5-20251001';
|
||||
const CANARY_MODEL = 'claude-haiku-5-5';
|
||||
const PINNED = /@anthropic-ai\/claude-code@(\d+\.\d+\.\d+)/.exec(
|
||||
fs.readFileSync(path.join(ROOT, '.github/docker/Dockerfile.ci'), 'utf8'))?.[1];
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { launchClaudePty, resolveClaudeBinary, selectPtyNumberedOption } from '.
|
||||
import { prepareGuardSession } from './helpers/autoplan-guard-pty';
|
||||
import { padBeforeCompactBoundary } from './helpers/journal-padding';
|
||||
|
||||
const MODEL = 'claude-haiku-4-5-20251001';
|
||||
const MODEL = 'claude-haiku-5-5';
|
||||
const PADDED_BYTES = 101 * 1024 * 1024;
|
||||
|
||||
describeIfSelected('autoplan long-session guard', ['autoplan-long-session'], () => {
|
||||
|
||||
@@ -24,7 +24,7 @@ import { resolveClaudeCommand } from '../lib/claude-bin';
|
||||
import { readOwnedClaudePublicTranscript } from '../lib/claude-public-transcript';
|
||||
import { schemaDrift, type HookPayload } from './helpers/schema-canary';
|
||||
|
||||
const CANARY_MODEL = 'claude-haiku-4-5-20251001';
|
||||
const CANARY_MODEL = 'claude-haiku-5-5';
|
||||
const PACKAGE = '@anthropic-ai/claude-code';
|
||||
|
||||
describeIfSelected('autoplan schema canary (latest Claude Code)', ['autoplan-schema-canary'], () => {
|
||||
|
||||
@@ -45,7 +45,7 @@ const evalCollector = createEvalCollector('e2e-hermetic');
|
||||
|
||||
// Cheap + deterministic: the canaries assert environment facts, not model
|
||||
// quality, so the smallest model is the right tool.
|
||||
const CANARY_MODEL = 'claude-haiku-4-5-20251001';
|
||||
const CANARY_MODEL = 'claude-haiku-5-5';
|
||||
|
||||
/** Extract concatenated tool_result text from the stream-json transcript. */
|
||||
function toolResultText(transcript: any[]): string {
|
||||
|
||||
Reference in new issue
Block a user