mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-23 08:31:44 +01:00
/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
147 lines
9.9 KiB
TypeScript
147 lines
9.9 KiB
TypeScript
/**
|
|
* 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)' });
|
|
});
|
|
});
|