Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

fix(scoring): providerClass learns the gpt-5.6 rungs — terra=mid, luna=small (#291)

justrache150743e504e
diff --git a/src/fitness_strata_tests.zig b/src/fitness_strata_tests.zig
index bad15bf9..e7831f48 100644
--- a/src/fitness_strata_tests.zig
+++ b/src/fitness_strata_tests.zig
@@ -44,9 +44,10 @@ const mixed_archive =
test "#376: a fitness row's stratum is the resolved model, and a missing one is `unknown`" {
try std.testing.expectEqualStrings("gpt-5.6-luna", policy.stratumOf("gpt-5.6-luna"));
try std.testing.expectEqualStrings("gpt-5.6-terra", policy.stratumOf("gpt-5.6-terra"));
- // The two models scoring.providerClass cannot tell apart (both "frontier")
- // are distinct strata here — that separation is the whole increment.
- try std.testing.expect(!std.mem.eql(u8, policy.stratumOf("gpt-5.6-sol"), policy.stratumOf("gpt-5.6-luna")));
+ // Two models scoring.providerClass still pools (sol and bare gpt-5.6,
+ // both "frontier") are distinct strata here — that separation is the
+ // whole increment.
+ try std.testing.expect(!std.mem.eql(u8, policy.stratumOf("gpt-5.6-sol"), policy.stratumOf("gpt-5.6")));
// A row that names no model is its own bucket, never an empty string that
// would compare equal to another absent one by accident.
try std.testing.expectEqualStrings("unknown", policy.stratumOf(""));
diff --git a/src/route_phase.zig b/src/route_phase.zig
index c963f2b2..4a1e6e57 100644
--- a/src/route_phase.zig
+++ b/src/route_phase.zig
@@ -7,8 +7,9 @@
//! prompt variants of one phase against each other and files the winner under
//! the prompt fingerprint. A phase whose tasks could differ in model would
//! attribute the model's effect to the genome — and nothing downstream could
-//! have caught it, since scoring.providerClass buckets gpt-5.6-sol, -terra
-//! and -luna identically (route_policy.stratumOf tells that story in full).
+//! have caught it, since scoring.providerClass then bucketed gpt-5.6-sol,
+//! -terra and -luna identically (route_policy.stratumOf tells that story in
+//! full).
//!
//! The confound is PER-TASK variation, not the model. This module applies the
//! #372 policy exactly once for a whole phase:
diff --git a/src/route_policy.zig b/src/route_policy.zig
index 542c5103..c029ec5b 100644
--- a/src/route_policy.zig
+++ b/src/route_policy.zig
@@ -233,9 +233,11 @@ pub fn tierLabelFor(provider_id: []const u8, model: []const u8) []const u8 {
/// model the worker actually ran on.
///
/// Until now the only routing axis a fitness row carried was
-/// scoring.providerClass, whose needle table buckets gpt-5.6-sol, -terra and
-/// -luna IDENTICALLY as "frontier" (the pinned, deliberate disagreement test
-/// in subagent_selection.zig). A rung-only difference was therefore invisible
+/// scoring.providerClass, whose needle table then bucketed gpt-5.6-sol,
+/// -terra and -luna IDENTICALLY as "frontier" (closed since — terra/luna are
+/// tier-distinct needles now — though a class still pools distinct models:
+/// sol and bare gpt-5.6 share "frontier"). A rung-only difference was
+/// therefore invisible
/// to every comparison built on it — which is precisely why #290 had to
/// forbid phase workers from varying their model at all: nothing downstream
/// could have told the model's contribution from the prompt's.
diff --git a/src/scoring.zig b/src/scoring.zig
index 98539d0f..f7bd9517 100644
--- a/src/scoring.zig
+++ b/src/scoring.zig
@@ -39,8 +39,12 @@ pub fn providerClass(model: []const u8) []const u8 {
.{ .needle = "-mini", .tier = "small" }, // -mini suffix, not "minimax"/"gemini"
.{ .needle = "lite", .tier = "small" },
.{ .needle = "nano", .tier = "small" },
+ // gpt-5.x rungs (#291): family-agnostic like "haiku"/"flash" so a
+ // future gpt-5.7-terra keeps its tier; must precede "gpt-5".
+ .{ .needle = "terra", .tier = "mid" },
+ .{ .needle = "luna", .tier = "small" },
.{ .needle = "opus", .tier = "frontier" },
- .{ .needle = "gpt-5", .tier = "frontier" },
+ .{ .needle = "gpt-5", .tier = "frontier" }, // sol and bare gpt-5.x stay frontier
.{ .needle = "deepseek-v4", .tier = "frontier" },
.{ .needle = "grok-4", .tier = "frontier" },
.{ .needle = "glm-5", .tier = "frontier" },
@@ -255,6 +259,9 @@ test "score signing message is canonical and cross-language stable" {
test "providerClass buckets models by capability tier" {
try std.testing.expectEqualStrings("frontier", providerClass("claude-opus-4-8"));
try std.testing.expectEqualStrings("frontier", providerClass("gpt-5.5"));
+ try std.testing.expectEqualStrings("frontier", providerClass("gpt-5.6-sol"));
+ try std.testing.expectEqualStrings("mid", providerClass("gpt-5.6-terra")); // rung needle beats "gpt-5"
+ try std.testing.expectEqualStrings("small", providerClass("gpt-5.6-luna"));
try std.testing.expectEqualStrings("frontier", providerClass("deepseek-v4-pro"));
try std.testing.expectEqualStrings("frontier", providerClass("grok-4.3"));
try std.testing.expectEqualStrings("small", providerClass("claude-haiku-4-5"));
diff --git a/src/subagent.zig b/src/subagent.zig
index e2064802..2e62dbf9 100644
--- a/src/subagent.zig
+++ b/src/subagent.zig
@@ -506,9 +506,10 @@ pub fn scoreVariants(
// A tournament must vary exactly ONE axis: variants that did not all run on
// the same MODEL rank the model as much as the prompt, and filing that under
// the prompt fingerprint writes model effects into the genome archive (#290).
- // #376 tightened the key from the capability class — which cannot tell
- // gpt-5.6-sol from -luna — to the resolved model, catching a rung-only
- // difference too. Bail before a judge: unscoreable round.
+ // #376 tightened the key from the capability class — which pools distinct
+ // models under one label (sol and bare gpt-5.6 are both "frontier") — to
+ // the resolved model, catching a rung-only difference too. Bail before a
+ // judge: unscoreable round.
for (1..vn) |k| {
if (!std.mem.eql(u8, subagent_run.variantStratum(seat.provider, vidx[0]), subagent_run.variantStratum(seat.provider, vidx[k]))) {
if (ctx.tracer) |tr| tr.note("fleet", "tournament skipped: variants span routing strata");
diff --git a/src/subagent_run.zig b/src/subagent_run.zig
index c649359c..3461942d 100644
--- a/src/subagent_run.zig
+++ b/src/subagent_run.zig
@@ -180,13 +180,14 @@ pub fn variantProviderClass(seat: Provider, i: usize) []const u8 {
/// #376 — the routing STRATUM variant `i` was observed in: the resolved model
/// itself, not its capability bucket.
///
-/// providerClass cannot separate gpt-5.6-sol from -terra/-luna (all three are
-/// "frontier"), so the matched-tournament guard in scoreVariants was blind to
-/// a rung-only difference — the documented #291 gap that made phase routing
-/// unsafe. Keyed on this it is not: a phase whose variants somehow spanned two
-/// models is refused as unscoreable, and every fitness row records the same
-/// value so a cross-run comparison can stratify by it (fitness_strata.zig)
-/// rather than averaging over rungs.
+/// providerClass once bucketed gpt-5.6-sol/-terra/-luna identically as
+/// "frontier" (the #291 gap, closed since), and a class stays coarser than a
+/// model regardless — "frontier" pools sol with bare gpt-5.6 — so a
+/// matched-tournament guard keyed on it was blind to a rung-only difference,
+/// which made phase routing unsafe. Keyed on this it is not: a phase whose
+/// variants somehow spanned two models is refused as unscoreable, and every
+/// fitness row records the same value so a cross-run comparison can stratify
+/// by it (fitness_strata.zig) rather than averaging over rungs.
pub fn variantStratum(seat: Provider, i: usize) []const u8 {
_ = i;
return route_policy.stratumOf(seat.model);
diff --git a/src/subagent_selection.zig b/src/subagent_selection.zig
index 0ccfe628..9e28c734 100644
--- a/src/subagent_selection.zig
+++ b/src/subagent_selection.zig
@@ -274,22 +274,24 @@ test "default ladder never crosses a provider boundary implicitly" {
test "ladder rungs vs providerClass: documented, intentional disagreement (#291)" {
// #291 requires ladder tier labels to match scoring.providerClass()
// output for the same models, "or report the discrepancy rather than
- // papering over it." providerClass's needle table buckets the whole
- // gpt-5.x family (sol/terra/luna alike) as "frontier" — it has no
- // name-based way to split terra/luna out — and deepseek-v4-flash as
- // "small" via its "flash" needle, even though the ladder treats flash as
- // deepseek's only cheaper (mid) rung. This test pins that the mismatch
- // is real and known today, not a bug the ladder introduced; it is
- // reported rather than silently patched into scoring.zig's needle
- // table, which other, unrelated callers (DGM fitness scoring/fleet
- // niche gating) also depend on.
+ // papering over it." The gpt family now agrees end-to-end with the
+ // ladder, like claude: "terra"/"luna" are tier-distinct needles in
+ // providerClass (as opus/sonnet/haiku are), so pullElites and fleet
+ // propose events keyed on the class are no longer rung-blind — a terra
+ // root pulls "mid" elites, not elites grown on sol.
try std.testing.expectEqualStrings("frontier", @import("scoring.zig").providerClass("gpt-5.6-sol"));
- try std.testing.expectEqualStrings("frontier", @import("scoring.zig").providerClass("gpt-5.6-terra")); // ladder rung: mid
- try std.testing.expectEqualStrings("frontier", @import("scoring.zig").providerClass("gpt-5.6-luna")); // ladder rung: small
+ try std.testing.expectEqualStrings("mid", @import("scoring.zig").providerClass("gpt-5.6-terra")); // ladder rung: mid
+ try std.testing.expectEqualStrings("small", @import("scoring.zig").providerClass("gpt-5.6-luna")); // ladder rung: small
+ // The one remaining disagreement, still reported rather than papered
+ // over: the ladder treats deepseek-v4-flash as deepseek's only cheaper
+ // rung (mid), while providerClass's "flash" needle states its absolute
+ // capability (small). Relative-vs-absolute semantics, not a bug — the
+ // needle table's other callers (DGM fitness scoring/fleet niche gating)
+ // want the absolute answer.
try std.testing.expectEqualStrings("frontier", @import("scoring.zig").providerClass("deepseek-v4-pro"));
try std.testing.expectEqualStrings("small", @import("scoring.zig").providerClass("deepseek-v4-flash")); // ladder rung: mid
- // Claude already agrees end-to-end (opus/sonnet/haiku are tier-distinct
- // needles in providerClass, matching the ladder one-for-one).
+ // Claude agrees end-to-end (opus/sonnet/haiku are tier-distinct needles
+ // in providerClass, matching the ladder one-for-one).
try std.testing.expectEqualStrings("frontier", @import("scoring.zig").providerClass("claude-opus-4-8"));
try std.testing.expectEqualStrings("mid", @import("scoring.zig").providerClass("claude-sonnet-4-6"));
try std.testing.expectEqualStrings("small", @import("scoring.zig").providerClass("claude-haiku-4-5"));
diff --git a/src/subagent_tier_ladder.zig b/src/subagent_tier_ladder.zig
index 2b7ad1ac..921b1dea 100644
--- a/src/subagent_tier_ladder.zig
+++ b/src/subagent_tier_ladder.zig
@@ -12,8 +12,9 @@
//! `frontier`/`mid`/`small` here are the ladder's OWN rung labels; they are
//! NOT guaranteed to equal scoring.providerClass(name) for that literal
//! model string — see the "ladder rungs vs providerClass" pinned test in
-//! subagent_selection.zig for the documented (intentional, not papered
-//! over) disagreement on the gpt-5.6 family and deepseek-v4-flash.
+//! subagent_selection.zig: the gpt-5.6 family now agrees end-to-end, leaving
+//! deepseek-v4-flash as the documented (intentional, not papered over)
+//! disagreement.
const std = @import("std");
const pricing = @import("pricing.zig");