Files
gstack/lib/eval-model.ts
T
Garry Tanandcapy-ai[bot] 9a550bca9c gstack picks the newest Opus, Fable, Sol and Astra everywhere (GST-3760) (#4811)
gstack now uses the newest model of each family it picks from: the Codex
second-model review defaults to `gpt-6.2-astra`, plan-review tiers move
to `claude-fable-5-2` and `gpt-6.2-sol`, and eval judges to
`claude-fable-5-2`.

Why: Garry's rule that gstack always uses the latest Astra, Sol, Fable
or Opus; one table now holds each family's newest model, so the next
release is a one-line change.

Nothing to do: models you pinned in your own config keep working.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/adversarial-native#2 reader=adversarial-native
Review-Finding: p1/outside-voice#2 reader=outside-voice
Review-Finding: p1/adversarial-native#1 reader=adversarial-native
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/outside-voice#3 reader=outside-voice
Review-Finding: p1/adversarial-native#4 reader=adversarial-native
Review-Finding: p1/adversarial-native#5 reader=adversarial-native
2026-11-25 02:06:47 +00:00

62 lines
2.6 KiB
TypeScript

/**
* Host-neutral eval/harness model resolution (fork port wave 2, G cluster).
*
* Model IDs were hardcoded at six call sites across the eval helpers and the
* distill bin, so an environment that pins a different model (CI cost
* control, a model migration, an air-gapped proxy alias) had to patch source.
* One resolution point, env-overridable:
*
* GSTACK_EVAL_MODEL_<KIND> (e.g. GSTACK_EVAL_MODEL_WARMUP) — per-kind
* GSTACK_EVAL_MODEL — global
* explicit argument — caller wins
* per-kind default — last resort
*
* Kinds and their defaults:
* capture — the model under test in every Claude session, PTY and Agent SDK
* eval run: CLAUDE_CAPTURE_EVAL_MODEL
* warmup — PTY warm-up ping (cheapest thing that answers): haiku
* distill — free-text distillation (cheap, structured): haiku (pinned)
* judge — LLM-judge rubric calls: CLAUDE_JUDGE_EVAL_MODEL
*/
import { newestModel } from "./model-families";
/** The model under test: Anthropic's best code model (Garry, 2026-10-18). */
export const CLAUDE_CAPTURE_EVAL_MODEL = newestModel("opus");
/**
* The judge is the ruler, not the model under test, and it is the newest Fable
* (Garry, 2026-11-24: "gstack should always be using latest astra, sol, fable or
* opus"). The calibration fixtures in test/fixtures/judge-calibration record
* the earlier Fable they were measured on.
*/
export const CLAUDE_JUDGE_EVAL_MODEL = newestModel("fable");
export const DEFAULT_JUDGE_MAX_TOKENS = 8192;
// `as const satisfies` keeps EvalModelKind the literal union
// 'capture' | 'warmup' | 'distill' — a `Record<string, string>` annotation
// would widen it to string and let any typo through the type gate.
const DEFAULTS = {
// Tests needing a cheaper or historical model pass it explicitly or set
// GSTACK_EVAL_MODEL_CAPTURE / GSTACK_EVAL_MODEL_JUDGE / GSTACK_EVAL_MODEL.
capture: CLAUDE_CAPTURE_EVAL_MODEL,
warmup: "claude-haiku-5-5",
distill: "claude-haiku-5-5",
judge: CLAUDE_JUDGE_EVAL_MODEL,
} as const satisfies Record<string, string>;
export type EvalModelKind = keyof typeof DEFAULTS;
export function resolveEvalModel(
kind: EvalModelKind,
explicit?: string | null,
env: NodeJS.ProcessEnv = process.env,
): string {
if (explicit) return explicit;
const perKind = env[`GSTACK_EVAL_MODEL_${kind.toUpperCase()}`];
if (perKind) return perKind;
if (env.GSTACK_EVAL_MODEL) return env.GSTACK_EVAL_MODEL;
const fallback = DEFAULTS[kind];
if (!fallback) throw new Error(`resolveEvalModel: unknown kind "${kind}"`);
return fallback;
}