Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

Eval plans can check a code judge against a third model's labels, with frozen anchors (GST-3833) (#4824)

Garry Tan2eb3e5ad12a7
diff --git a/bin/gstack-doctor-components.sh b/bin/gstack-doctor-components.sh
index 581eb6ccd..d65dead58 100644
--- a/bin/gstack-doctor-components.sh
+++ b/bin/gstack-doctor-components.sh
@@ -452,6 +452,7 @@ gstack_result_anchor() {
PREREG_NO_GSTACK_ARM) printf '%s' 'prereg-no-gstack-arm' ;;
EVAL_REPORT_NO_GSTACK_ROW) printf '%s' 'eval-report-no-gstack-row' ;;
EVAL_JUDGE_UNCHECKED) printf '%s' 'eval-judge-unchecked' ;;
+ EVAL_REPORT_THIRD_MODEL_UNNAMED) printf '%s' 'eval-report-third-model-unnamed' ;;
EVAL_REPORT_UNPLANTED_ZERO) printf '%s' 'eval-report-unplanted-zero' ;;
EVAL_REPORT_NO_ANSWER_ONLY) printf '%s' 'eval-report-no-answer-only' ;;
EVAL_QUICK_LOOK_NO_NUMBER) printf '%s' 'eval-quick-look-no-number' ;;
diff --git a/bin/gstack-eval-plan b/bin/gstack-eval-plan
index f193f3257..275121b5a 100755
--- a/bin/gstack-eval-plan
+++ b/bin/gstack-eval-plan
@@ -10,8 +10,9 @@
* gstack-eval-plan pilot settle --out <dir> --attempt <id> --usd <n|unknown>
* gstack-eval-plan pilot release --out <dir> --attempt <id>
* gstack-eval-plan pilot report --out <dir> --total <items> [--workers W] [--json]
- * gstack-eval-plan results --check <prereg> <results.md> [--labels <labels.jsonl>] [--json]
- * gstack-eval-plan judge --check <prereg> --labels <labels.jsonl> [--json]
+ * gstack-eval-plan results --check <prereg> <results.md> [--labels <labels.jsonl>] [--anchors <anchors.jsonl>] [--json]
+ * gstack-eval-plan judge --check <prereg> --labels <labels.jsonl> [--anchors <anchors.jsonl>] [--json]
+ * gstack-eval-plan anchors --hash <anchors.jsonl>
* gstack-eval-plan price-gate --gate-file <file> | --gate "<exact gate command>" [--plan-file <file>] [--base <branch>] [--cap-usd N]
* [--smoke-cap-usd N] [--allow-unpriced "<reason>"] [--out <dir>] [--json]
*
@@ -37,7 +38,7 @@ import { spawnSync } from 'node:child_process';
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 { checkJudgeLabels, hashAnchors, renderJudgeLabels } from '../lib/eval-plan-checks';
import { checkModelRules, EVAL_SCOPES, type EvalScope, type ModelRulesCheck } from '../lib/eval-models';
import { EXIT, exitTableHelp } from '../lib/headless-artifacts';
import { resultLine } from '../lib/result-codes';
@@ -72,13 +73,17 @@ const HELP = `gstack-eval-plan — preregistration, priced arms, $0 dry run, pri
settle unknown, and sit outside the cap and the projection until one settles a charge
pilot settle --out dir --attempt id --usd <n|unknown> pilot release --out dir --attempt id
pilot report --out dir --total items [--workers W] [--json] spend table + per-arm extrapolation with a 95% band, then the approval ask
- results --check <prereg> <results.md> [--labels labels.jsonl] [--json]
+ results --check <prereg> <results.md> [--labels labels.jsonl] [--anchors anchors.jsonl] [--json]
one table in the results file has a filled row for every Arms identity, each no-gstack arm
beside its variants; a model judge's labels pass; a zero in any results table comes from a
Diagnostics counter with a planted case; a failures column has an answer-only column beside
- it; reads text only (docs/TESTING_INTERNALS.md#result-checks)
- judge --check <prereg> --labels labels.jsonl [--json]
- Cohen's kappa of the preregistered judge against {"id","human","judge"} hand labels
+ it; labels by a third model (labels-by:) need the line "judge checked against <model>, a third
+ model, not against people"; reads text only (docs/TESTING_INTERNALS.md#result-checks)
+ judge --check <prereg> --labels labels.jsonl [--anchors anchors.jsonl] [--json]
+ Cohen's kappa of the preregistered judge against {"id","human","judge"} hand labels; with a
+ labels-by: model (R126, code judges only), its {"id","expected","label"} anchor answers meet anchor-pass:
+ and hash to the plan's anchors-digest:
+ anchors --hash <anchors.jsonl> ANCHORS: n=<n> sha256=<hex> for frozen {"id","expected"} rows: the plan's anchors-digest: value
price-gate --gate-file <file> | --gate "<exact gate command>" [--plan-file f] [--base b] [--cap-usd N] [--smoke-cap-usd N] [--allow-unpriced "<reason>"] [--out dir] [--json]
price a paid gate from its GSTACK_EVAL_CALLS v1 call-plan file (--plan-file, else the base
policy's price_file at HEAD); checks the gate/head/input binding, executes nothing, writes a
@@ -160,10 +165,12 @@ function doPrereg(rest: string[]): number {
function doResults(rest: string[]): number {
const prereg = flag(rest, '--check');
const labels = flag(rest, '--labels');
- const results = rest.filter(a => !a.startsWith('--') && a !== prereg && a !== labels)[0];
+ const anchors = flag(rest, '--anchors');
+ const results = rest.filter(a => !a.startsWith('--') && a !== prereg && a !== labels && a !== anchors)[0];
if (!prereg || !results || !fs.existsSync(prereg) || !fs.existsSync(results)) return usage('results needs --check <existing prereg> <existing results file>');
if (labels !== undefined && !fs.existsSync(labels)) return usage('results --labels needs an existing labels file');
- const r = checkResults(fs.readFileSync(prereg, 'utf8'), fs.readFileSync(results, 'utf8'), labels === undefined ? null : fs.readFileSync(labels, 'utf8'));
+ if (anchors !== undefined && !fs.existsSync(anchors)) return usage('results --anchors needs an existing anchors file');
+ const r = checkResults(fs.readFileSync(prereg, 'utf8'), fs.readFileSync(results, 'utf8'), labels === undefined ? null : fs.readFileSync(labels, 'utf8'), anchors === undefined ? null : fs.readFileSync(anchors, 'utf8'));
if (rest.includes('--json')) process.stdout.write(JSON.stringify({ prereg, results, ...r }) + '\n');
else process.stdout.write(`RESULTS: ${r.ok ? 'ok' : 'incomplete'} no_gstack_rows=${r.no_gstack.filter(id => r.found.includes(id)).length}/${r.no_gstack.length} rows=${r.found.length}/${r.required.length} file=${results}\n`);
if (r.judge && !rest.includes('--json')) process.stdout.write(renderJudgeLabels(r.judge));
@@ -174,16 +181,27 @@ function doResults(rest: string[]): number {
function doJudge(rest: string[]): number {
const prereg = flag(rest, '--check');
const labels = flag(rest, '--labels');
+ const anchors = flag(rest, '--anchors');
if (!prereg || !labels || !fs.existsSync(prereg) || !fs.existsSync(labels)) return usage('judge needs --check <existing prereg> --labels <existing labels file>');
+ if (anchors !== undefined && !fs.existsSync(anchors)) return usage('judge --anchors needs an existing anchors file');
const preregText = fs.readFileSync(prereg, 'utf8');
const { scoring } = checkPrereg(preregText);
if (!scoring.judge || scoring.judge.toLowerCase() === 'none') return usage('judge --check needs a preregistration whose ## Scoring names a judge model');
- const r = checkJudgeLabels(scoring, fs.readFileSync(labels, 'utf8'), armIdentities(preregText));
+ const r = checkJudgeLabels(scoring, fs.readFileSync(labels, 'utf8'), armIdentities(preregText), anchors === undefined ? null : fs.readFileSync(anchors, 'utf8'));
process.stdout.write(rest.includes('--json') ? JSON.stringify({ prereg, labels, ...r }) + '\n' : renderJudgeLabels(r));
if (!r.ok) { process.stderr.write(resultLine('gstack-eval-plan judge', 'EVAL_JUDGE_UNCHECKED', r.problems.join('; ')) + '\n'); return EXIT.fail; }
return EXIT.ok;
}
+function doAnchors(rest: string[]): number {
+ const file = flag(rest, '--hash');
+ if (!file || !fs.existsSync(file)) return usage('anchors needs --hash <existing anchors file>');
+ const r = hashAnchors(fs.readFileSync(file, 'utf8'));
+ if (r.problems.length) { process.stderr.write(resultLine('gstack-eval-plan anchors', 'EVAL_JUDGE_UNCHECKED', r.problems.join('; ')) + '\n'); return EXIT.fail; }
+ process.stdout.write(`ANCHORS: n=${r.n} sha256=${r.sha256}\n`);
+ return EXIT.ok;
+}
+
function doArms(rest: string[]): number {
const tokens = { input: num(rest, '--input-tokens', DEFAULT_TOKENS.input)!, output: num(rest, '--output-tokens', DEFAULT_TOKENS.output)! };
const scope = scopeOf(rest);
@@ -306,6 +324,7 @@ function main(argv: string[]): number {
if (cmd === 'price-gate') return doPriceGate(rest);
if (cmd === 'results') return doResults(rest);
if (cmd === 'judge') return doJudge(rest);
+ if (cmd === 'anchors') return doAnchors(rest);
return usage(`unknown command ${cmd}`);
} catch (e: any) {
if (e instanceof SpendCapExceeded) { process.stderr.write(resultLine(`gstack-eval-plan ${cmd}`, 'EVAL_BUDGET_EXHAUSTED', e.message) + '\n'); return EXIT.fail; }
diff --git a/changelog.d/eval-plan-third-model-labels-for-code-judges.md b/changelog.d/eval-plan-third-model-labels-for-code-judges.md
new file mode 100644
index 000000000..718b41862
--- /dev/null
+++ b/changelog.d/eval-plan-third-model-labels-for-code-judges.md
@@ -0,0 +1 @@
+**`/eval-plan` lets a judge that grades code be checked against a third model's labels instead of people's (R126).** A plan's `## Scoring` can now say `labels-by: google/gemini-4-neon` (another third family, such as `x-ai/grok-4.7`, when Gemini is the judge or an arm) with `label-kind: code`, `blind: yes`, and frozen known-answer anchors (`anchors:`, `anchor-pass:` and the `anchors-digest:` digest that `gstack-eval-plan anchors --hash` prints). `judge --check --anchors` counts the labeller's labels only after it meets its anchor pass line, and `results --check` wants the results to say "judge checked against <model>, a third model, not against people". Judges of anything other than code, quality and taste included, still need people's or construction labels, and the label count and kappa bar are unchanged.
diff --git a/docs/TESTING_INTERNALS.md b/docs/TESTING_INTERNALS.md
index bfcf1e3ad..8b8a30ec0 100644
--- a/docs/TESTING_INTERNALS.md
+++ b/docs/TESTING_INTERNALS.md
@@ -2129,7 +2129,8 @@ refusal from `bin/gstack-eval-plan` (logic in `lib/eval-plan-checks.ts` and
|---|---|---|
| `## Decisions`: one `if <result>: <what we do>` line per possible result, at least two, with different actions | `prereg --check`, before anything is spent | `PREREG_INCOMPLETE` |
| `## Scoring`: `judge: none`, or a judge model from another family than every arm with `labels:` (100 or more; 40 for a plan frozen before 2026-11-22) and `agreement:` (kappa 0.6 or more); with two or more arms, `paired: yes`, `interval: 95%` and `mdd:` stated before the run | `prereg --check` | `PREREG_INCOMPLETE` |
-| The judge's Cohen's kappa against `{"id", "human", "judge"}` hand labels, at the preregistered count and bar | `judge --check` before the approval ask; `results --check --labels` before any number goes out | `EVAL_JUDGE_UNCHECKED` |
+| The judge's Cohen's kappa against `{"id", "human", "judge"}` hand labels, at the preregistered count and bar; with a `labels-by:` model (R126, code judges only), its `--anchors` answers meet `anchor-pass:` first | `judge --check` before the approval ask; `results --check --labels` before any number goes out | `EVAL_JUDGE_UNCHECKED` |
+| With a `labels-by:` model, the results file says `judge checked against <model>, a third model, not against people` | `results --check` | `EVAL_REPORT_THIRD_MODEL_UNNAMED` |
| A zero in any results table comes from a column named after a `## Diagnostics` counter whose synthetic fixture plants at least one case (expected 1 or more) | `results --check` | `EVAL_REPORT_UNPLANTED_ZERO` |
| A results table with a failures column also has an `answer-only` column: failures by the grader's own rule on the final answer | `results --check` | `EVAL_REPORT_NO_ANSWER_ONLY` |
@@ -2266,6 +2267,38 @@ least 100 hand-labelled outputs before the judge's numbers count. The kappa bar
stays 0.6. A plan frozen earlier keeps 40. `prereg --check`, `judge --check` and
`results --check` all read the bar from the plan's `frozen:` date.
+**Third-model labels for code judges (R126).** Garry, 2026-11-25: "Nah let's
+just use Gemini neon as another model here and don't use humans". A judge that
+grades code may be checked against labels a third-family model made instead of
+people's, at the same count and kappa bar. `## Scoring` then says:
+
+- `labels-by: google/gemini-4-neon`: the labeller, as `<provider>/<model>`,
+ from a family neither the judge nor any arm shares. Gemini 4 Neon is the
+ labeller unless Gemini is the judge or an arm (then another third family,
+ such as `x-ai/grok-4.7`), or a `labeller-fallback:` line names the run
+ where Neon missed its anchor pass line.
+- `label-kind: code`: the judge grades code. Labels for anything else,
+ quality and taste calls included (R124), stay with people, construction
+ (`labels-by: construction`) or a rule (`labels-by: rule`); `labels-by:`
+ absent means people.
+- `blind: yes`: the labeller sees each output with no judge verdict and no
+ arm name.
+- `anchors: <n>`, `anchor-pass: <k>` and `anchors-digest: <hex>`:
+ known-answer anchors, items whose label is fixed by construction, frozen
+ with the plan; how many the labeller must answer right before any of its
+ labels count; and the digest `gstack-eval-plan anchors --hash <file>`
+ prints for the frozen `{"id", "expected"}` rows.
+
+`judge --check --anchors <file>` scores the labeller's `{"id", "expected",
+"label"}` answers first (`JUDGE_ANCHORS:`); a "can't tell" is a miss, and
+ids or expected answers that don't hash to `anchors-digest:` are refused. The
+results file then carries `judge checked against <model>, a third model, not
+against people`, which `judge --check` prints as `JUDGE_RESULTS_LINE:`.
+Why the anchors are required: on the /cso check, Neon answered yes on only 1
+to 2 of 12 oracle anchors and "can't tell" on 25 to 32 of 104 reports while
+agreeing on the reports it did answer. Agreement alone hid that; the anchors
+caught it.
+
## Running evals as an agent: detach
Moved verbatim from CLAUDE.md (#2096 size limit). The short rule stays in
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index 93da0fdc0..d0ab63865 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -5424,17 +5424,41 @@ that are all one class (agreement is undefined), a repeated id, or a Cohen's
kappa between the hand labels and the judge below the preregistered bar (at
least 0.6). With `per-arm: yes` in `## Scoring`, it also refuses a label row
with no `arm`, rows naming an arm not in `## Arms`, an arm with no rows, or
-any arm whose own kappa is below the bar (its `JUDGE_ARM:` line). Until it
-passes, the judge's numbers do not count.
+any arm whose own kappa is below the bar (its `JUDGE_ARM:` line). When
+`labels-by:` names a third-family model (R126, code judges only), it also
+refuses a missing `--anchors` file, anchor ids or expected answers that
+don't hash to the plan's `anchors-digest:`, an anchor count other than the
+frozen `anchors:` count, an anchor id that is also a label row, or fewer
+right answers than `anchor-pass:` (its `JUDGE_ANCHORS:` line). Until it passes,
+the judge's numbers do not count.
**Fix.** Label outputs by hand from development or calibration rows, never
held-out ones, as JSONL rows `{"id", "human", "judge"}` (plus `"arm"` with
`per-arm: yes`), covering every kind of output the judge scores and every
-arm, and pass the file with `--labels`. A judge below
+arm, and pass the file with `--labels`. For a judge that grades code, the
+labels may come from the third-family `labels-by:` model instead: pass its
+answers on the frozen known-answer anchors as `{"id", "expected", "label"}`
+rows with `--anchors`. A labeller that misses its pass line is replaced by
+another third family or by people; its labels never count. A judge below
its bar is replaced or its prompt fixed and relabelled; the bar is not
lowered. The rule is in
[docs/TESTING_INTERNALS.md](TESTING_INTERNALS.md#result-checks).
+<a id="eval-report-third-model-unnamed"></a>
+### `EVAL_REPORT_THIRD_MODEL_UNNAMED`
+
+**Meaning.** The preregistration's `## Scoring` has `labels-by:` naming a
+model, so the judge was checked against labels a third-family model made
+(R126), and the results file does not say so. A reader who sees "the judge
+agreed with its labels" assumes people made them.
+
+**Fix.** Add the line `judge checked against <model>, a third model, not
+against people` to the results file, with the `labels-by:` model (for
+example `judge checked against google/gemini-4-neon, a third model, not
+against people`). `judge --check` prints the exact line as
+`JUDGE_RESULTS_LINE:`. The rule is in
+[docs/TESTING_INTERNALS.md](TESTING_INTERNALS.md#result-checks).
+
<a id="eval-report-unplanted-zero"></a>
### `EVAL_REPORT_UNPLANTED_ZERO`
diff --git a/eval-plan/SKILL.md b/eval-plan/SKILL.md
index df28ed923..ba4b58eaf 100644
--- a/eval-plan/SKILL.md
+++ b/eval-plan/SKILL.md
@@ -213,7 +213,8 @@ at least one, so `expected` is 1 or more and the summarizer is shown to find it.
2. **A checked judge.** A model judge comes from another model family than every arm,
is checked against at least 100 hand-labelled outputs (40 for a plan frozen before
2026-11-22; never held-out rows) at a kappa of 0.6 or better, and the comparison is paired with a 95% interval and its
- smallest detectable difference stated now.
+ smallest detectable difference stated now. Only a judge that grades code may use blind labels from a
+ third-family model, with frozen known-answer anchors (R126, docs/TESTING_INTERNALS.md#result-checks).
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
@@ -362,7 +363,7 @@ then:
```
Give each label row its `"arm"`: with `per-arm: yes`, each `JUDGE_ARM:` line must meet the
-bar on its own. Start every judge or reader subagent with its model and reasoning effort
+bar on its own. A `labels-by:` model's anchor answers go in with `--anchors <path>`. Start every judge or reader subagent with its model and reasoning effort
set; left unset, it inherits its parent's, and a reader that inherited the highest effort
cost about four times the default. `JUDGE_AGREEMENT: ok` continues. `EVAL_JUDGE_UNCHECKED` (exit 1) means too few labels,
one class, or kappa below the bar: replace the judge or fix its prompt, then
@@ -423,6 +424,7 @@ leaves the run (a report, a READY block, a PR body), check it:
- `EVAL_REPORT_NO_GSTACK_ROW` names the arm whose filled row is missing from the table
that holds the others; add it. A preregistration with `stack: none` needs no row.
- `EVAL_JUDGE_UNCHECKED`: a model judge's numbers count only with `--labels` passing.
+- `EVAL_REPORT_THIRD_MODEL_UNNAMED`: model-made labels need the `JUDGE_RESULTS_LINE:` text in the results.
- `EVAL_REPORT_UNPLANTED_ZERO`: a zero in any results table, in a column not named after
a Diagnostics counter with a planted case. Declare and run it, or report the zero as
unverified, outside the tables.
diff --git a/eval-plan/SKILL.md.tmpl b/eval-plan/SKILL.md.tmpl
index d4a9663b7..4e04504a7 100644
--- a/eval-plan/SKILL.md.tmpl
+++ b/eval-plan/SKILL.md.tmpl
@@ -128,7 +128,8 @@ at least one, so `expected` is 1 or more and the summarizer is shown to find it.
2. **A checked judge.** A model judge comes from another model family than every arm,
is checked against at least 100 hand-labelled outputs (40 for a plan frozen before
2026-11-22; never held-out rows) at a kappa of 0.6 or better, and the comparison is paired with a 95% interval and its
- smallest detectable difference stated now.
+ smallest detectable difference stated now. Only a judge that grades code may use blind labels from a
+ third-family model, with frozen known-answer anchors (R126, docs/TESTING_INTERNALS.md#result-checks).
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
@@ -277,7 +278,7 @@ then:
```
Give each label row its `"arm"`: with `per-arm: yes`, each `JUDGE_ARM:` line must meet the
-bar on its own. Start every judge or reader subagent with its model and reasoning effort
+bar on its own. A `labels-by:` model's anchor answers go in with `--anchors <path>`. Start every judge or reader subagent with its model and reasoning effort
set; left unset, it inherits its parent's, and a reader that inherited the highest effort
cost about four times the default. `JUDGE_AGREEMENT: ok` continues. `EVAL_JUDGE_UNCHECKED` (exit 1) means too few labels,
one class, or kappa below the bar: replace the judge or fix its prompt, then
@@ -331,6 +332,7 @@ leaves the run (a report, a READY block, a PR body), check it:
- `EVAL_REPORT_NO_GSTACK_ROW` names the arm whose filled row is missing from the table
that holds the others; add it. A preregistration with `stack: none` needs no row.
- `EVAL_JUDGE_UNCHECKED`: a model judge's numbers count only with `--labels` passing.
+- `EVAL_REPORT_THIRD_MODEL_UNNAMED`: model-made labels need the `JUDGE_RESULTS_LINE:` text in the results.
- `EVAL_REPORT_UNPLANTED_ZERO`: a zero in any results table, in a column not named after
a Diagnostics counter with a planted case. Declare and run it, or report the zero as
unverified, outside the tables.
diff --git a/lib/eval-plan-checks.ts b/lib/eval-plan-checks.ts
index 86dd12d1c..a64206511 100644
--- a/lib/eval-plan-checks.ts
+++ b/lib/eval-plan-checks.ts
@@ -7,6 +7,7 @@
* `frozen:` date is before RESULT_CHECKS_SINCE keeps the rules it was frozen
* under. Reads text only; executes nothing.
*/
+import { createHash } from 'node:crypto';
import { currentReplacement } from './pricing';
export const RESULT_CHECKS_SINCE = '2026-11-15';
@@ -16,6 +17,17 @@ export const JUDGE_LABELS_RAISED_SINCE = '2026-11-22';
export const JUDGE_RAISED_MIN_LABELS = 100;
export const judgeMinLabels = (frozen: string | null) => (frozen !== null && frozen < JUDGE_LABELS_RAISED_SINCE ? JUDGE_MIN_LABELS : JUDGE_RAISED_MIN_LABELS);
export const JUDGE_MIN_KAPPA = 0.6;
+/**
+ * R126 (Garry, 2026-11-25: "Nah let's just use Gemini neon as another model here and don't use humans"): a judge that
+ * grades code may be checked against labels made blind by a third-family model, a family neither the judge nor any arm
+ * shares, at the same count and kappa bar, but only when the plan freezes known-answer anchors (items whose label is fixed
+ * by construction) with a pass line the labeller meets before its labels count. Gemini 4 Neon is the labeller unless Gemini
+ * is the judge or an arm, or a labeller-fallback: line names the run where it missed its anchor pass line. Labels for
+ * anything other than code, quality and taste included (R124), come from people, construction or a rule.
+ */
+export const MODEL_LABELLER_DEFAULT = 'google/gemini-4-neon';
+export const LABEL_SOURCES = ['people', 'construction', 'rule'] as const;
+export const thirdModelLine = (model: string) => `judge checked against ${model}, a third model, not against people`;
const PLACEHOLDER = /^(?:|-+|—|n\/a|none|tbd|todo|\?)\.?$/i;
const keyValues = (body: string[]) => {
@@ -186,12 +198,14 @@ export function checkDecisions(body: string[] | null): DecisionsCheck {
return { outcomes, errors };
}
-export interface ScoringCheck { judge: string | null; labels: number | null; agreement: number | null; errors: string[]; per_arm?: boolean; min_labels?: number }
+export interface ModelLabeller { model: string; anchors: number | null; anchor_pass: number | null; anchors_digest: string | null }
+export interface ScoringCheck { judge: string | null; labels: number | null; agreement: number | null; errors: string[]; per_arm?: boolean; min_labels?: number; labeller?: ModelLabeller | null }
/**
* `## Scoring`: `judge: none` or the judge model; a model judge needs `labels:`
* (at least judgeMinLabels(frozen): 100, or 40 for a plan frozen before 2026-11-22) and `agreement:` (a kappa bar of at least 0.6) and a family no
* arm shares. Two or more arms need `paired: yes`, `interval: 95%` and `mdd:`,
- * the smallest difference the run can detect.
+ * the smallest difference the run can detect. `labels-by:` is people when absent;
+ * a model there is a third-family labeller under R126 (MODEL_LABELLER_DEFAULT).
*/
export function checkScoring(body: string[] | null, arms: string[], frozen: string | null = null): ScoringCheck {
const min_labels = judgeMinLabels(frozen);
@@ -201,9 +215,15 @@ export function checkScoring(body: string[] | null, arms: string[], frozen: stri
const labels = firstNumber(kv.labels);
const agreement = firstNumber(kv.agreement);
const errors: string[] = [];
+ let labeller: ModelLabeller | null = null;
if (!judge) errors.push('no judge: line (judge: none, or the judge model)');
else if (judge.toLowerCase() !== 'none') {
- if (labels === null || labels < min_labels) errors.push(`labels: needs at least ${min_labels} hand-labelled outputs the judge is checked against${min_labels > JUDGE_MIN_LABELS ? ` (${JUDGE_MIN_LABELS} only for a plan frozen before ${JUDGE_LABELS_RAISED_SINCE})` : ''}`);
+ const by = (kv['labels-by'] ?? 'people').trim();
+ if (!(LABEL_SOURCES as readonly string[]).includes(by.toLowerCase())) {
+ labeller = { model: by, anchors: firstNumber(kv.anchors), anchor_pass: firstNumber(kv['anchor-pass']), anchors_digest: /^[0-9a-f]{64}$/i.test(kv['anchors-digest'] ?? '') ? kv['anchors-digest']!.toLowerCase() : null };
+ errors.push(...labellerErrors(labeller, kv, judge, arms));
+ }
+ if (labels === null || labels < min_labels) errors.push(`labels: needs at least ${min_labels} ${labeller ? '' : 'hand-'}labelled outputs the judge is checked against${min_labels > JUDGE_MIN_LABELS ? ` (${JUDGE_MIN_LABELS} only for a plan frozen before ${JUDGE_LABELS_RAISED_SINCE})` : ''}`);
if (agreement === null || agreement < JUDGE_MIN_KAPPA || agreement > 1) errors.push(`agreement: needs a kappa bar from ${JUDGE_MIN_KAPPA} to 1`);
const family = modelFamily(judge);
for (const arm of [...new Set(arms)]) if (modelFamily(arm) === family) errors.push(`judge ${judge} is the same model family (${family}) as arm ${arm}; use a judge from another family`);
@@ -213,10 +233,28 @@ export function checkScoring(body: string[] | null, arms: string[], frozen: stri
if (firstNumber(kv.interval) !== 95) errors.push('interval: 95% (the interval every comparison is reported with)');
if (PLACEHOLDER.test(kv.mdd ?? '')) errors.push('mdd: the smallest difference this run can detect, stated before the run');
}
- return { judge, labels, agreement, errors, per_arm: /^yes\b/i.test(kv['per-arm'] ?? ''), min_labels };
+ return { judge, labels, agreement, errors, per_arm: /^yes\b/i.test(kv['per-arm'] ?? ''), min_labels, labeller };
}
-export interface JudgeLabelCheck { ok: boolean; judge: string; n: number; kappa: number | null; need_n: number; need_kappa: number; problems: string[]; arms: Array<{ arm: string; n: number; kappa: number | null }> }
+/** R126: what a model labeller in `## Scoring` needs before its labels can stand in for people's. */
+function labellerErrors(l: ModelLabeller, kv: Record<string, string>, judge: string, arms: string[]): string[] {
+ if (!/^[a-z0-9][a-z0-9.-]*\/[a-z0-9][a-z0-9.:-]*$/i.test(l.model)) return [`labels-by: says people, construction or rule, or for a judge that grades code names a third-family model as <provider>/<model>, such as ${MODEL_LABELLER_DEFAULT} (R126)`];
+ const errors: string[] = [];
+ const family = modelFamily(l.model);
+ if (!/^code\b/i.test(kv['label-kind'] ?? '')) errors.push(`label-kind: code (model-made labels count only for a judge that grades code; labels for anything else, quality and taste included, come from people, construction or a rule) (R126, R124)`);
+ const families = [modelFamily(judge), ...new Set(arms.map(modelFamily))];
+ if (families.includes(family)) errors.push(`labels-by: ${l.model} is the same model family (${family}) as the judge or an arm; the labeller comes from a third family`);
+ const geminiInPlay = families.includes(modelFamily(MODEL_LABELLER_DEFAULT));
+ if (l.model.toLowerCase() !== MODEL_LABELLER_DEFAULT && !geminiInPlay && !filled(kv['labeller-fallback'])) errors.push(`labels-by: ${MODEL_LABELLER_DEFAULT} labels unless Gemini is the judge or an arm, or a labeller-fallback: line names the run where it missed its anchor pass line`);
+ if (!/^yes\b/i.test(kv.blind ?? '')) errors.push('blind: yes (the labeller sees each output with no judge verdict and no arm name)');
+ if (l.anchors === null || l.anchors < 1 || !filled(kv.anchors)) errors.push('anchors: <n> frozen known-answer anchors (items whose label is fixed by construction) the labeller answers before its labels count, and where they are frozen');
+ if (l.anchor_pass === null || l.anchor_pass < 1 || (l.anchors !== null && l.anchor_pass > l.anchors)) errors.push('anchor-pass: <k>, how many anchors the labeller must answer right before its labels count (1 to the anchors: count)');
+ if (l.anchors_digest === null) errors.push('anchors-digest: the 64-hex digest gstack-eval-plan anchors --hash prints for the frozen anchor ids and expected answers, so the answers are scored against the set frozen with the plan');
+ return errors;
+}
+
+export interface AnchorCheck { labeller: string; n: number; right: number; need_n: number | null; need_right: number | null; frozen: boolean }
+export interface JudgeLabelCheck { ok: boolean; judge: string; n: number; kappa: number | null; need_n: number; need_kappa: number; problems: string[]; arms: Array<{ arm: string; n: number; kappa: number | null }>; labels_by?: string; anchors?: AnchorCheck | null }
/** Cohen's kappa over paired categorical labels; null when chance agreement is total (every label one class). */
export function cohensKappa(pairs: Array<[string, string]>): number | null {
@@ -229,8 +267,51 @@ export function cohensKappa(pairs: Array<[string, string]>): number | null {
return pe === 1 ? null : (agree / n - pe) / (1 - pe);
}
-/** Score the preregistered judge against a JSONL file of `{"id", "human", "judge"}` rows. */
-export function checkJudgeLabels(scoring: ScoringCheck, labelsText: string, planArms: string[] = []): JudgeLabelCheck {
+const scalar = (v: unknown) => (typeof v === 'string' && v.trim() !== '') || typeof v === 'number' || typeof v === 'boolean';
+/** The anchor rows of a JSONL file: `{"id", "expected"}`, plus `"label"` (the labeller's answer) when `answered`. */
+function anchorRows(text: string, answered: boolean) {
+ const rows: Array<{ id: string; expected: string; label: string }> = [];
+ const problems: string[] = [];
+ const ids = new Set<string>();
+ text.split('\n').forEach((line, i) => {
+ if (!line.trim()) return;
+ let row: { id?: unknown; expected?: unknown; label?: unknown } | null = null;
+ try { row = JSON.parse(line); } catch { row = null; }
+ if (!row || typeof row !== 'object' || ![row.id, row.expected, ...(answered ? [row.label] : [])].every(scalar)) { problems.push(`anchors line ${i + 1}: needs {"id", "expected"${answered ? ', "label"' : ''}}, each a string, number or boolean`); return; }
+ const id = String(row.id);
+ if (ids.has(id)) { problems.push(`anchor ${id} appears twice`); return; }
+ ids.add(id);
+ rows.push({ id, expected: String(row.expected), label: String(row.label) });
+ });
+ return { rows, problems };
+}
+/** sha256 of the anchor ids and expected answers, order-free: what `anchors-digest:` freezes in the plan. */
+export const anchorSetDigest = (rows: Array<{ id: string; expected: string }>) =>
+ createHash('sha256').update(rows.map(r => JSON.stringify([r.id, r.expected])).sort().join('\n')).digest('hex');
+/** `gstack-eval-plan anchors --hash`: the digest of a frozen anchor file of `{"id", "expected"}` rows. */
+export function hashAnchors(text: string): { n: number; sha256: string; problems: string[] } {
+ const { rows, problems } = anchorRows(text, false);
+ return { n: rows.length, sha256: anchorSetDigest(rows), problems };
+}
+
+/**
+ * Score the labeller's answers on the frozen known-answer anchors, JSONL rows `{"id", "expected", "label"}` whose ids
+ * and expected answers must hash to the plan's `anchors-digest:`. A "can't tell" or any other answer is a miss.
+ */
+export function checkAnchors(l: ModelLabeller, anchorsText: string | null, labelIds: Set<string>): { check: AnchorCheck | null; problems: string[] } {
+ if (anchorsText === null) return { check: null, problems: [`labels-by: ${l.model} is a model; pass --anchors <file> with its answers on the ${l.anchors ?? 'preregistered'} frozen known-answer anchors, and its labels count only at anchor-pass: ${l.anchor_pass ?? '?'} or better (R126)`] };
+ const { rows, problems } = anchorRows(anchorsText, true);
+ for (const r of rows) if (labelIds.has(r.id)) problems.push(`anchor ${r.id} is also a label row; anchors do not count toward the labels`);
+ if (anchorSetDigest(rows) !== l.anchors_digest) problems.push(`the anchor ids and expected answers hash to ${anchorSetDigest(rows)}, not the frozen anchors-digest ${l.anchors_digest ?? '(none)'}; score the labeller on the anchors frozen with the plan`);
+ const right = rows.filter(r => r.label === r.expected).length;
+ const check: AnchorCheck = { labeller: l.model, n: rows.length, right, need_n: l.anchors, need_right: l.anchor_pass, frozen: anchorSetDigest(rows) === l.anchors_digest };
+ if (l.anchors !== null && rows.length !== l.anchors) problems.push(`${rows.length} anchors answered, the plan froze ${l.anchors}`);
+ if (l.anchor_pass === null || right < l.anchor_pass) problems.push(`${l.model} answered ${right} of ${rows.length} anchors right, below the pass line ${l.anchor_pass ?? '?'}; its labels do not count`);
+ return { check, problems };
+}
+
+/** Score the preregistered judge against a JSONL file of `{"id", "human", "judge"}` rows (with a model labeller, its labels sit in "human" and its anchor answers pass separately). */
+export function checkJudgeLabels(scoring: ScoringCheck, labelsText: string, planArms: string[] = [], anchorsText: string | null = null): JudgeLabelCheck {
const need_n = Math.max(scoring.min_labels ?? JUDGE_RAISED_MIN_LABELS, scoring.labels ?? 0);
const need_kappa = Math.max(JUDGE_MIN_KAPPA, scoring.agreement ?? 0);
const problems: string[] = [];
@@ -263,7 +344,10 @@ export function checkJudgeLabels(scoring: ScoringCheck, labelsText: string, plan
if (unknown.length) problems.push(`label rows name arms that are not in ## Arms: ${unknown.join(', ')}`);
}
if (scoring.per_arm) for (const a of arms) if (a.kappa === null || a.kappa < need_kappa) problems.push(`arm ${a.arm}: kappa ${a.kappa === null ? 'undefined' : a.kappa.toFixed(2)} on its ${a.n} labels is below the bar ${need_kappa}; the judge does not pass on this arm's outputs`);
- return { ok: problems.length === 0, judge: scoring.judge ?? 'none', n: pairs.length, kappa, need_n, need_kappa, problems, arms };
+ if (!scoring.labeller) return { ok: problems.length === 0, judge: scoring.judge ?? 'none', n: pairs.length, kappa, need_n, need_kappa, problems, arms };
+ const anchors = checkAnchors(scoring.labeller, anchorsText, ids);
+ problems.push(...anchors.problems);
+ return { ok: problems.length === 0, judge: scoring.judge ?? 'none', n: pairs.length, kappa, need_n, need_kappa, problems, arms, labels_by: scoring.labeller.model, anchors: anchors.check };
}
-export const renderJudgeLabels = (c: JudgeLabelCheck) => c.arms.map(a => `JUDGE_ARM: ${a.arm} n=${a.n} kappa=${a.kappa === null ? 'undefined' : a.kappa.toFixed(2)} bar=${c.need_kappa}\n`).join('') + `JUDGE_AGREEMENT: ${c.ok ? 'ok' : 'unchecked'} judge=${c.judge} n=${c.n}/${c.need_n} kappa=${c.kappa === null ? 'undefined' : c.kappa.toFixed(2)} bar=${c.need_kappa}\n`;
+export const renderJudgeLabels = (c: JudgeLabelCheck) => (c.anchors ? `JUDGE_ANCHORS: ${c.anchors.need_right !== null && c.anchors.right >= c.anchors.need_right && c.anchors.n === c.anchors.need_n && c.anchors.frozen ? 'ok' : 'missed'} labeller=${c.anchors.labeller} right=${c.anchors.right}/${c.anchors.n} pass=${c.anchors.need_right ?? '?'} frozen=${c.anchors.frozen ? 'match' : 'mismatch'}\n` : '') + c.arms.map(a => `JUDGE_ARM: ${a.arm} n=${a.n} kappa=${a.kappa === null ? 'undefined' : a.kappa.toFixed(2)} bar=${c.need_kappa}\n`).join('') + `JUDGE_AGREEMENT: ${c.ok ? 'ok' : 'unchecked'} judge=${c.judge} n=${c.n}/${c.need_n} kappa=${c.kappa === null ? 'undefined' : c.kappa.toFixed(2)} bar=${c.need_kappa}${c.labels_by ? ` labels_by=${c.labels_by}` : ''}\n` + (c.labels_by ? `JUDGE_RESULTS_LINE: ${thirdModelLine(c.labels_by)}\n` : '');
diff --git a/lib/eval-plan-report.ts b/lib/eval-plan-report.ts
index af569cdec..aca706dad 100644
--- a/lib/eval-plan-report.ts
+++ b/lib/eval-plan-report.ts
@@ -7,10 +7,12 @@
* (docs/TESTING_INTERNALS.md#result-checks) hold back a model judge's numbers
* until its hand labels pass, a zero from a counter never shown to find a
* planted case, and a failures column with no answer-only reading beside it.
+ * Labels a third model made (R126) count only with its anchor answers passing,
+ * and the results then say the judge was checked against that model, not people.
* Reads text only; executes nothing.
*/
import { armIdentities, checkPrereg } from './eval-plan';
-import { checkJudgeLabels, modelGenerationProblems, type JudgeLabelCheck } from './eval-plan-checks';
+import { checkJudgeLabels, modelGenerationProblems, thirdModelLine, type JudgeLabelCheck } from './eval-plan-checks';
import type { ResultCodeName } from './result-codes';
export interface ResultsIssue { code: ResultCodeName; message: string }
@@ -41,7 +43,7 @@ export function resultTables(text: string): ResultTable[] {
return tables;
}
-export function checkResults(preregText: string, resultsText: string, labelsText: string | null = null): ResultsCheck {
+export function checkResults(preregText: string, resultsText: string, labelsText: string | null = null, anchorsText: string | null = null): ResultsCheck {
const prereg = checkPrereg(preregText);
const issues: ResultsIssue[] = [];
const tables = resultTables(resultsText);
@@ -67,9 +69,11 @@ export function checkResults(preregText: string, resultsText: string, labelsText
for (const e of errors) issues.push({ code: 'PREREG_INCOMPLETE', message: `## ${section}: ${e}` });
}
if (prereg.scoring.judge && prereg.scoring.judge.toLowerCase() !== 'none') {
- judge = labelsText === null ? null : checkJudgeLabels(prereg.scoring, labelsText, arms);
+ judge = labelsText === null ? null : checkJudgeLabels(prereg.scoring, labelsText, arms, anchorsText);
if (!judge) issues.push({ code: 'EVAL_JUDGE_UNCHECKED', message: `the preregistration names judge ${prereg.scoring.judge}; pass --labels <hand labels.jsonl>` });
else if (!judge.ok) issues.push({ code: 'EVAL_JUDGE_UNCHECKED', message: judge.problems.join('; ') });
+ const labeller = prereg.scoring.labeller?.model;
+ if (labeller && !resultsText.toLowerCase().includes(thirdModelLine(labeller).toLowerCase())) issues.push({ code: 'EVAL_REPORT_THIRD_MODEL_UNNAMED', message: `the judge's labels came from ${labeller}; the results say "${thirdModelLine(labeller)}"` });
}
const planted = new Set((prereg.diagnostics?.expected ?? []).filter(e => e.count >= 1).map(e => e.name.toLowerCase()));
for (const t of tables) {
diff --git a/lib/eval-plan.ts b/lib/eval-plan.ts
index cd8082847..9b5e1f2de 100644
--- a/lib/eval-plan.ts
+++ b/lib/eval-plan.ts
@@ -58,7 +58,7 @@ export function preregTemplate(title = 'Eval preregistration'): string {
<!-- Required with \`stack: loaded\`: \`arms:\` one \`<model>#no-gstack\` Arms line per model; \`inputs:\` the same rows and fixture; \`prompt:\` the task only (no SKILL.md, preamble, hooks or installed skills); \`panel:\` the same E2E kind, trials and judge; \`report:\` its row beside the variants; \`masking:\` how the run agent is kept from gstack (an empty directory bind-mounted over ~/.capy/drive/user-garry-tan and ~/.capy/drive/org-gstack-gbrain before it starts, or a container that sees no Capy drive); \`install:\` no gstack at ~/.local/share/gstack or ~/.claude/skills; \`audit:\` the per-arm drive-read audit (an arm that read a gstack skill file is contaminated and gets zero credit). -->
## Scoring
-<!-- \`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>\`. -->
+<!-- \`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. \`labels-by:\` is people when absent (or \`construction\`, \`rule\`); only a judge that grades code may name a third-family model there (R126: \`labels-by: google/gemini-4-neon\`, \`label-kind: code\`, \`blind: yes\`, \`anchors: <n frozen known-answer anchors>\`, \`anchor-pass: <k right before its labels count>\`, \`anchors-digest: <gstack-eval-plan anchors --hash of the frozen anchors>\`), and the results then say "judge checked against <model>, a third model, not against people". 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, 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. -->
diff --git a/lib/result-codes-eval.ts b/lib/result-codes-eval.ts
index ac6e6ba28..335d0f481 100644
--- a/lib/result-codes-eval.ts
+++ b/lib/result-codes-eval.ts
@@ -33,8 +33,14 @@ export const EVAL_RESULT_CODES = {
// The result checks (docs/TESTING_INTERNALS.md#result-checks).
EVAL_JUDGE_UNCHECKED: {
anchor: 'eval-judge-unchecked',
- summary: 'the preregistration names a model judge, and its hand labels are missing, fewer than the bar, all one class, or agree with the judge below the kappa bar',
- fix: 'label at least the preregistered number of outputs by hand (never held-out rows), write them as {"id", "human", "judge"} JSONL, and pass them with --labels; a judge below its bar is replaced or its numbers are not published',
+ summary: 'the preregistration names a model judge, and its labels are missing, fewer than the bar, all one class, or agree with the judge below the kappa bar, or a third-model labeller (R126) has no anchor answers or misses its anchor pass line',
+ fix: 'label at least the preregistered number of outputs by hand (never held-out rows), or for a code judge by the third-family labels-by: model, write them as {"id", "human", "judge"} JSONL, and pass them with --labels (a model labeller also passes its anchor answers with --anchors); a judge below its bar is replaced or its numbers are not published',
+ },
+ // R126 (Garry, 2026-11-25): a code judge checked against a third model's labels says so in its results.
+ EVAL_REPORT_THIRD_MODEL_UNNAMED: {
+ anchor: 'eval-report-third-model-unnamed',
+ summary: 'the judge was checked against labels a third-family model made, and the results file does not say so',
+ fix: 'add the line "judge checked against <model>, a third model, not against people" to the results file, naming the labels-by: model, then rerun results --check',
},
EVAL_REPORT_UNPLANTED_ZERO: {
anchor: 'eval-report-unplanted-zero',
diff --git a/test/eval-plan-result-checks.test.ts b/test/eval-plan-result-checks.test.ts
index 1d5f50877..b4eedd361 100644
--- a/test/eval-plan-result-checks.test.ts
+++ b/test/eval-plan-result-checks.test.ts
@@ -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, JUDGE_LABELS_RAISED_SINCE, modelFamily } from '../lib/eval-plan-checks';
+import { anchorSetDigest, checkDecisions, checkJudgeLabels, checkScoring, cohensKappa, JUDGE_LABELS_RAISED_SINCE, MODEL_LABELLER_DEFAULT, modelFamily, thirdModelLine } from '../lib/eval-plan-checks';
import { checkResults } from '../lib/eval-plan-report';
const BIN = path.resolve(import.meta.dir, '..', 'bin', 'gstack-eval-plan');
@@ -238,3 +238,133 @@ describe('gstack-eval-plan judge --check and results --labels', () => {
expect(noLabels.err).toContain('(EVAL_JUDGE_UNCHECKED)');
});
});
+
+describe('R126: a code judge may be checked against blind labels a third-family model made, with frozen anchors', () => {
+ const arms = ['claude-opus-5-5', 'claude-opus-5-5#plain'];
+ const FROZEN = anchorSetDigest(Array.from({ length: 12 }, (_, i) => ({ id: `anchor-${i}`, expected: 'bug' })));
+ const NEON = `labels-by: google/gemini-4-neon\nlabel-kind: code\nblind: yes\nanchors: 12 frozen in anchors.jsonl\nanchor-pass: 11\nanchors-digest: ${FROZEN}\n`;
+ const scoring100 = (extra: string, judge = 'gpt-6-astra') => SCORING(judge, 'labels: 100\nagreement: 0.6\nper-arm: yes\neffort: high\npaired: yes\ninterval: 95%\nmdd: 3 of 20 items\n' + extra);
+ const late = (extra: string, judge?: string) => prereg({ frozen: '2026-11-25', scoring: scoring100(extra, judge) });
+ const errs = (extra: string, judge?: string) => checkPrereg(late(extra, judge)).scoring.errors;
+ const anchors = (n: number, right: number, start = 0) => Array.from({ length: n }, (_, i) => JSON.stringify({ id: `anchor-${start + i}`, expected: 'bug', label: i < right ? 'bug' : "can't tell" })).join('\n') + '\n';
+
+ test('Gemini 4 Neon labelling code, blind, with frozen anchors and a pass line passes, and is recorded as the labeller', () => {
+ const s = checkPrereg(late(NEON)).scoring;
+ expect(s.errors).toEqual([]);
+ expect(s.labeller).toEqual({ model: MODEL_LABELLER_DEFAULT, anchors: 12, anchor_pass: 11, anchors_digest: FROZEN });
+ expect(checkPrereg(late(`labels-by: \`google/gemini-4-neon\`\nlabel-kind: code\nblind: yes\nanchors: 12\nanchor-pass: 12\nanchors-digest: ${FROZEN}\n`)).ok).toBe(true);
+ });
+
+ test('people, construction, rule or no labels-by line keep the hand-label rules unchanged', () => {
+ for (const by of ['', 'labels-by: people\n', 'labels-by: construction\n', 'labels-by: Rule\n']) {
+ const s = checkPrereg(late(by)).scoring;
+ expect(s.errors, by).toEqual([]);
+ expect(s.labeller, by).toBeNull();
+ }
+ expect(errs('', 'gpt-6-astra').length).toBe(0);
+ expect(checkPrereg(prereg({ frozen: JUDGE_LABELS_RAISED_SINCE })).scoring.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)']);
+ });
+
+ test('a model labeller for anything but code is refused, quality and taste included', () => {
+ const kind = 'label-kind: code (model-made labels count only for a judge that grades code; labels for anything else, quality and taste included, come from people, construction or a rule) (R126, R124)';
+ expect(errs(NEON.replace('label-kind: code\n', ''))).toEqual([kind]);
+ for (const k of ['prose', 'quality', 'taste', 'ui']) expect(errs(NEON.replace('label-kind: code', `label-kind: ${k}`)), k).toEqual([kind]);
+ });
+
+ test('the labeller comes from a family neither the judge nor any arm shares', () => {
+ expect(errs(NEON, 'google/gemini-4-carbon')).toEqual(['labels-by: google/gemini-4-neon is the same model family (google) as the judge or an arm; the labeller comes from a third family']);
+ expect(errs(NEON.replace('google/gemini-4-neon', 'openai/gpt-6.2-sol'))).toContain('labels-by: openai/gpt-6.2-sol is the same model family (openai) as the judge or an arm; the labeller comes from a third family');
+ expect(errs(NEON.replace('google/gemini-4-neon', 'anthropic/claude-sonnet-5-5'))).toContain('labels-by: anthropic/claude-sonnet-5-5 is the same model family (anthropic) as the judge or an arm; the labeller comes from a third family');
+ });
+
+ test('Grok 4.7 or another third family labels only when Gemini is the judge or an arm, or Neon missed its anchors', () => {
+ const grok = NEON.replace('google/gemini-4-neon', 'x-ai/grok-4.7');
+ expect(errs(grok)).toEqual(['labels-by: google/gemini-4-neon labels unless Gemini is the judge or an arm, or a labeller-fallback: line names the run where it missed its anchor pass line']);
+ expect(errs(grok, 'google/gemini-4-carbon')).toEqual([]);
+ expect(errs(grok + 'labeller-fallback: run neon-anchors-1 answered 2 of 12\n')).toEqual([]);
+ expect(errs(grok + 'labeller-fallback: tbd\n').length).toBe(1);
+ });
+
+ test('anchors, a pass line, blind labelling and a <provider>/<model> id are each required', () => {
+ expect(errs(NEON.replace('blind: yes\n', ''))).toEqual(['blind: yes (the labeller sees each output with no judge verdict and no arm name)']);
+ const anchorsErr = 'anchors: <n> frozen known-answer anchors (items whose label is fixed by construction) the labeller answers before its labels count, and where they are frozen';
+ const passErr = 'anchor-pass: <k>, how many anchors the labeller must answer right before its labels count (1 to the anchors: count)';
+ expect(errs(NEON.replace('anchors: 12 frozen in anchors.jsonl\n', ''))).toEqual([anchorsErr]);
+ expect(errs(NEON.replace('anchors: 12 frozen in anchors.jsonl', 'anchors: 0'))).toEqual([anchorsErr, passErr]);
+ expect(errs(NEON.replace('anchor-pass: 11\n', ''))).toEqual([passErr]);
+ expect(errs(NEON.replace('anchor-pass: 11', 'anchor-pass: 13'))).toEqual([passErr]);
+ const shaErr = 'anchors-digest: the 64-hex digest gstack-eval-plan anchors --hash prints for the frozen anchor ids and expected answers, so the answers are scored against the set frozen with the plan';
+ expect(errs(NEON.replace(`anchors-digest: ${FROZEN}\n`, ''))).toEqual([shaErr]);
+ expect(errs(NEON.replace(FROZEN, FROZEN.slice(0, 40)))).toEqual([shaErr]);
+ for (const by of ['gemini-4-neon', 'neon', 'people, final ties by a model', 'models']) {
+ expect(errs(NEON.replace('google/gemini-4-neon', by)), by).toEqual(['labels-by: says people, construction or rule, or for a judge that grades code names a third-family model as <provider>/<model>, such as google/gemini-4-neon (R126)']);
+ }
+ });
+
+ test('judge --check counts a model labeller only once its anchor answers meet the pass line', () => {
+ const s = checkPrereg(late(NEON)).scoring;
+ expect(checkJudgeLabels(s, labels(100, 10), arms).problems).toEqual(["labels-by: google/gemini-4-neon is a model; pass --anchors <file> with its answers on the 12 frozen known-answer anchors, and its labels count only at anchor-pass: 11 or better (R126)"]);
+ expect(checkJudgeLabels(s, labels(100, 10), arms, anchors(12, 11))).toMatchObject({ ok: true, labels_by: MODEL_LABELLER_DEFAULT, anchors: { right: 11, n: 12, need_right: 11 } });
+ expect(checkJudgeLabels(s, labels(100, 10), arms, anchors(12, 2)).problems).toEqual(['google/gemini-4-neon answered 2 of 12 anchors right, below the pass line 11; its labels do not count']);
+ expect(checkJudgeLabels(s, labels(100, 10), arms, anchors(11, 11)).problems).toContain('11 anchors answered, the plan froze 12');
+ expect(checkJudgeLabels(s, labels(100, 10), arms, anchors(12, 12, 0).replace(/anchor-0/, 'item-0')).problems).toContain('anchor item-0 is also a label row; anchors do not count toward the labels');
+ expect(checkJudgeLabels(s, labels(40, 4), arms, anchors(12, 12)).problems).toEqual(['40 labelled outputs, needs 100']);
+ });
+
+ test('anchor answers are scored against the set frozen with the plan, and bad rows are refused', () => {
+ const s = checkPrereg(late(NEON)).scoring;
+ const rewritten = anchors(12, 2).replace(/"expected":"bug","label":"can't tell"/g, '"expected":"can\'t tell","label":"can\'t tell"');
+ const r = checkJudgeLabels(s, labels(100, 10), arms, rewritten);
+ expect(r.ok).toBe(false);
+ expect(r.anchors).toMatchObject({ right: 12, frozen: false });
+ expect(r.problems).toEqual([`the anchor ids and expected answers hash to ${anchorSetDigest(rewritten.trim().split('\n').map(l => JSON.parse(l)))}, not the frozen anchors-digest ${FROZEN}; score the labeller on the anchors frozen with the plan`]);
+ const dup = anchors(12, 12) + JSON.stringify({ id: 'anchor-0', expected: 'bug', label: 'bug' }) + '\n';
+ expect(checkJudgeLabels(s, labels(100, 10), arms, dup).problems).toEqual(['anchor anchor-0 appears twice']);
+ const bad = anchors(12, 12) + 'not json\n' + JSON.stringify({ id: 'anchor-x', expected: 'bug' }) + '\n';
+ expect(checkJudgeLabels(s, labels(100, 10), arms, bad).problems).toEqual(['anchors line 13: needs {"id", "expected", "label"}, each a string, number or boolean', 'anchors line 14: needs {"id", "expected", "label"}, each a string, number or boolean']);
+ });
+
+ test('results --check wants the third-model line in the results file', () => {
+ const rows = table('| arm | passed |', '| claude-opus-5-5 | 7/9 |', '| claude-opus-5-5#plain | 5/9 |');
+ const line = thirdModelLine(MODEL_LABELLER_DEFAULT);
+ expect(line).toBe('judge checked against google/gemini-4-neon, a third model, not against people');
+ expect(checkResults(late(NEON), rows, labels(100, 10), anchors(12, 12)).issues).toEqual([{ code: 'EVAL_REPORT_THIRD_MODEL_UNNAMED', message: `the judge's labels came from google/gemini-4-neon; the results say "${line}"` }]);
+ expect(checkResults(late(NEON), rows + '\nThe ' + line + '.\n', labels(100, 10), anchors(12, 12))).toMatchObject({ ok: true, issues: [] });
+ expect(checkResults(late(NEON), rows + '\n' + line + '\n', labels(100, 10)).issues.map(i => i.code)).toEqual(['EVAL_JUDGE_UNCHECKED']);
+ expect(checkResults(late(''), rows, labels(100, 10)).ok).toBe(true);
+ });
+
+ const cli = (args: string[], files: Record<string, string>) => {
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-third-model-')); 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('on the command line: judge --check reads --anchors and prints the results line; results --check reads --anchors too', () => {
+ const files = { 'p.md': late(NEON), 'l.jsonl': labels(100, 10), 'a.jsonl': anchors(12, 11), 'r.md': table('| arm | passed |', '| claude-opus-5-5 | 7/9 |', '| claude-opus-5-5#plain | 5/9 |') + '\n' + thirdModelLine(MODEL_LABELLER_DEFAULT) + '\n' };
+ const ok = cli(['judge', '--check', 'p.md', '--labels', 'l.jsonl', '--anchors', 'a.jsonl'], files);
+ expect(ok.code, ok.err).toBe(0);
+ expect(ok.out.split('\n')[0]).toBe('JUDGE_ANCHORS: ok labeller=google/gemini-4-neon right=11/12 pass=11 frozen=match');
+ expect(ok.out).toContain('JUDGE_AGREEMENT: ok judge=gpt-6-astra n=100/100 kappa=0.80 bar=0.6 labels_by=google/gemini-4-neon\n');
+ expect(ok.out).toContain('JUDGE_RESULTS_LINE: judge checked against google/gemini-4-neon, a third model, not against people\n');
+ const missed = cli(['judge', '--check', 'p.md', '--labels', 'l.jsonl', '--anchors', 'a.jsonl'], { ...files, 'a.jsonl': anchors(12, 2) });
+ expect(missed.code).toBe(1);
+ expect(missed.out.split('\n')[0]).toBe('JUDGE_ANCHORS: missed labeller=google/gemini-4-neon right=2/12 pass=11 frozen=match');
+ expect(missed.err).toContain('(EVAL_JUDGE_UNCHECKED)');
+ expect(cli(['judge', '--check', 'p.md', '--labels', 'l.jsonl'], files).code).toBe(1);
+ const results = cli(['results', '--check', 'p.md', 'r.md', '--labels', 'l.jsonl', '--anchors', 'a.jsonl'], files);
+ expect(results.code, results.err).toBe(0);
+ expect(results.out.split('\n')[0]).toBe('RESULTS: ok no_gstack_rows=0/0 rows=0/0 file=r.md');
+ const unnamed = cli(['results', '--check', 'p.md', 'r.md', '--labels', 'l.jsonl', '--anchors', 'a.jsonl'], { ...files, 'r.md': table('| arm | passed |', '| claude-opus-5-5 | 7/9 |', '| claude-opus-5-5#plain | 5/9 |') });
+ expect(unnamed.code).toBe(1);
+ expect(unnamed.err).toContain('(EVAL_REPORT_THIRD_MODEL_UNNAMED)');
+ expect(cli(['judge', '--check', 'p.md', '--labels', 'l.jsonl', '--anchors', 'none.jsonl'], files).code).toBe(2);
+ expect(cli(['results', '--check', 'p.md', 'r.md', '--labels', 'l.jsonl', '--anchors', 'none.jsonl'], files).code).toBe(2);
+ const frozen = cli(['anchors', '--hash', 'f.jsonl'], { 'f.jsonl': Array.from({ length: 12 }, (_, i) => JSON.stringify({ id: `anchor-${11 - i}`, expected: 'bug' })).join('\n') + '\n' });
+ expect(frozen.code, frozen.err).toBe(0);
+ expect(frozen.out).toBe(`ANCHORS: n=12 sha256=${FROZEN}\n`);
+ expect(cli(['anchors', '--hash', 'f.jsonl'], { 'f.jsonl': 'not json\n' }).code).toBe(1);
+ });
+});
+
diff --git a/test/fixtures/context-budget.json b/test/fixtures/context-budget.json
index 78f0b5e55..ae486d869 100644
--- a/test/fixtures/context-budget.json
+++ b/test/fixtures/context-budget.json
@@ -26,7 +26,7 @@
"diagram": 4529,
"document-generate": 6027,
"document-release": 4469,
- "eval-plan": 7057,
+ "eval-plan": 7804,
"freeze": 1163,
"gstack": 5793,
"gstack-upgrade": 6297,