Skip to content

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

Python

Honor the updated subscription context default

justrach65310a5191a8
diff --git a/docs/adr/0292-sol-subscription-context-is-500k.md b/docs/adr/0292-sol-subscription-context-is-500k.md
new file mode 100644
index 00000000..54bb6121
--- /dev/null
+++ b/docs/adr/0292-sol-subscription-context-is-500k.md
@@ -0,0 +1,31 @@
+# 0292. Sol's subscription context default is 500k
+
+Status: accepted 2026-10-18.
+
+## Context
+
+The blanket subscription input cap predates GPT-6.1 Sol. It reduced even a
+500,000-token account catalog row to 270,000, causing early compaction.
+The [upstream announcement](https://x.com/thsottiaux/status/2109430343346581527)
+raises this model's Codex and Work default from 272k to 500k. The larger
+advertised maximum is a separate value, not a reason to select it
+automatically.
+
+## Decision
+
+Use 500,000 for the exact `gpt-6.1-sol` model on `codex` and `chatgpt-new`,
+in both offline rows and the subscription clamp. Continue honoring smaller
+provider catalog windows. Keep other subscription models at the existing
+conservative cap. Leave direct API and gateway windows unchanged.
+
+The shared provider context remains authoritative for the engine, children,
+REPL and ACP context reporting. Keep the compaction percentage unchanged:
+its default 80% now starts compaction at 400,000 for this subscription model.
+
+## Consequences
+
+Long sessions retain more history without opting into the maximum window.
+A stale smaller account catalog stays conservative until refreshed. This
+change does not increase account quotas or promise that larger sessions use
+the same amount of subscription allowance. Revisit the cap only with new
+route-specific evidence, not a name-only API maximum.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index ee038786..0da42470 100644
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@ -295,6 +295,8 @@ record only when you need the evidence or the edge cases.
| [0282](0282-claude-system-breakpoint-closes-before-the-repo-context.md) | On Claude, the system prompt is two text blocks with the same bytes: the cache breakpoint closes the static instructions, before the project instructions and layout, so every repo shares the tools + instructions prefix. |
| [0283](0283-agents-prepare-and-linked.md) | New task worktrees symlink the gitignored paths `.agents/linked` lists from the main checkout and run `.agents/prepare` when `.graff/workspace.toml` names no setup script. |
+| [0292](0292-sol-subscription-context-is-500k.md) | GPT-6.1 Sol uses a 500k subscription window on Codex and ChatGPT sign-in; smaller catalog windows still win, other models retain their conservative caps, and API maxima do not widen subscription defaults. |
+
## When to write one
Write an ADR when a decision is load-bearing and non-obvious: it was reached
diff --git a/src/oauth_chatgpt_tests.zig b/src/oauth_chatgpt_tests.zig
index d15a7ae2..9dce8000 100644
--- a/src/oauth_chatgpt_tests.zig
+++ b/src/oauth_chatgpt_tests.zig
@@ -77,9 +77,9 @@ test "ChatGPT sign-in: the chatgpt-new provider is a flat-rate plan on the publi
try std.testing.expect(spec.sub_login);
try std.testing.expectEqualStrings("https://api.openai.com/v1/responses", spec.url);
try std.testing.expectEqual(@import("billing.zig").Billing.sub, @import("billing.zig").forSeat("chatgpt-new", "gpt-6.1-sol", .login));
- // The route caps input like the Codex backend and refuses /responses/compact.
- try std.testing.expectEqual(@import("pricing.zig").codex_context_window, @import("pricing.zig").contextFor("chatgpt-new", "gpt-6.1-sol"));
- const p: provider.Provider = .{ .id = "chatgpt-new", .kind = .responses, .auth = .bearer, .url = spec.url, .api_key = "", .model = "gpt-6.1-sol", .context = 270_000 };
+ // The route uses the verified subscription default, not the API maximum.
+ try std.testing.expectEqual(@as(u64, 500_000), @import("pricing.zig").contextFor("chatgpt-new", "gpt-6.1-sol"));
+ const p: provider.Provider = .{ .id = "chatgpt-new", .kind = .responses, .auth = .bearer, .url = spec.url, .api_key = "", .model = "gpt-6.1-sol", .context = 500_000 };
try std.testing.expectEqual(@import("agent_server_compact.zig").ManualRoute.in_stream, @import("agent_server_compact.zig").manualRoute(p));
}
diff --git a/src/pricing.zig b/src/pricing.zig
index 52ef12f9..7c5eac34 100644
--- a/src/pricing.zig
+++ b/src/pricing.zig
@@ -177,13 +177,12 @@ pub const CatalogPrice = struct { in: f64, out: f64, cache: f64, high_at: u64 =
pub const ModelProtocol = enum { provider_default, kimi, anthropic };
pub const ThinkingSupport = enum { unknown, no, both, only };
-// Hard cap on the usable input for ANY codex (ChatGPT-account) model. The
-// backend enforces ~272k input for every gpt-5.x regardless of what the /models
-// catalog advertises (e.g. 372k for sol/terra/luna, which is NOT honored for
-// input). contextFor() clamps every codex resolution path to this so
-// auto-compaction (80%) fires before the backend's "input exceeds the context
-// window" rejection. 270k -> compaction at 216k, ~56k below the ~272k wall.
+// Conservative subscription input cap for older/unverified models: their
+// advertised total window may exceed what the backend accepts as input.
pub const codex_context_window: u64 = 270_000;
+// Use GPT-6.1 Sol's announced subscription default, not the API's larger
+// maximum (ADR 0292).
+pub const sol_subscription_context_window: u64 = 500_000;
pub const model_table = @import("pricing_models.zig").rows;
@@ -307,19 +306,20 @@ pub var context_overlay: []const ModelInfo = &.{};
pub fn contextFor(provider_id: []const u8, model: []const u8) u64 {
// The ChatGPT plan route caps input like the Codex backend it shares.
const is_codex = std.mem.eql(u8, provider_id, "codex") or std.mem.eql(u8, provider_id, "chatgpt-new");
+ const subscription_cap = if (std.mem.eql(u8, model, "gpt-6.1-sol")) sol_subscription_context_window else codex_context_window;
// Provider-specific baked row is authoritative (gateway gpt-5.5 = 400k, not
// the API's 1.05M), so it wins over the fresh name-only overlay below.
for (models()) |m| {
if (std.mem.eql(u8, m.provider, provider_id) and std.mem.eql(u8, m.name, model))
- return if (is_codex) @min(m.context, codex_context_window) else m.context;
+ return if (is_codex) @min(m.context, subscription_cap) else m.context;
}
// Fresh overlay (models.dev refresh), then the baked name-only fallback. A
// name-only window may exceed what the Codex backend honors — cap codex.
for (context_overlay) |m| {
- if (std.mem.eql(u8, m.name, model)) return if (is_codex) @min(m.context, codex_context_window) else m.context;
+ if (std.mem.eql(u8, m.name, model)) return if (is_codex) @min(m.context, subscription_cap) else m.context;
}
for (models()) |m| {
- if (std.mem.eql(u8, m.name, model)) return if (is_codex) @min(m.context, codex_context_window) else m.context;
+ if (std.mem.eql(u8, m.name, model)) return if (is_codex) @min(m.context, subscription_cap) else m.context;
}
return default_context;
}
diff --git a/src/pricing_models.zig b/src/pricing_models.zig
index a7aa875a..4a703e51 100644
--- a/src/pricing_models.zig
+++ b/src/pricing_models.zig
@@ -59,7 +59,7 @@ pub const rows = [_]ModelInfo{
// These rows keep Codex usable when auth or discovery is unavailable.
.{ .provider = "codex", .name = "gpt-6-astra", .context = 272_000, .default_effort = "medium", .default_verbosity = "low" },
.{ .provider = "codex", .name = "gpt-6-sol", .context = 272_000, .default_effort = "medium", .default_verbosity = "low" },
- .{ .provider = "codex", .name = "gpt-6.1-sol", .context = 272_000, .default_effort = "low", .default_verbosity = "low" },
+ .{ .provider = "codex", .name = "gpt-6.1-sol", .context = 500_000, .default_effort = "low", .default_verbosity = "low" },
.{ .provider = "codex", .name = "gpt-6-luna", .context = 272_000 },
.{ .provider = "codex", .name = "gpt-5.6-sol", .context = 272_000 },
.{ .provider = "codex", .name = "gpt-5.6-terra", .context = 272_000 },
@@ -72,9 +72,9 @@ pub const rows = [_]ModelInfo{
.{ .provider = "codex", .name = "gpt-5.4", .context = 272_000 },
.{ .provider = "codex", .name = "gpt-5.4-mini", .context = 272_000 },
.{ .provider = "codex", .name = "gpt-5.3-codex-spark", .context = 128_000 },
- // The ChatGPT plan through the new sign-in (ADR 0221): the same ~272k input
- // cap as Codex. Offline rows only; there is no live catalog for it yet.
- .{ .provider = "chatgpt-new", .name = "gpt-6.1-sol", .context = 272_000 },
+ // The ChatGPT plan through the new sign-in (ADR 0221): subscription
+ // defaults, with GPT-6.1 Sol at 500k (ADR 0292). Offline fallback rows.
+ .{ .provider = "chatgpt-new", .name = "gpt-6.1-sol", .context = 500_000 },
.{ .provider = "chatgpt-new", .name = "gpt-6-astra", .context = 272_000 },
.{ .provider = "chatgpt-new", .name = "gpt-6-sol", .context = 272_000 },
.{ .provider = "chatgpt-new", .name = "gpt-6-luna", .context = 272_000 },
diff --git a/src/pricing_tests.zig b/src/pricing_tests.zig
index a9828b2b..f8f1020e 100644
--- a/src/pricing_tests.zig
+++ b/src/pricing_tests.zig
@@ -97,10 +97,42 @@ test "usdFor: per-million math, cache writes, and negative clamping" {
try std.testing.expectApproxEqAbs(@as(f64, 0.2 + 0.01 + 10.0), pricing.usdForUsage(sol61, "gpt-6.1-sol", 100_000, 100_000, 0, 1_000_000), 1e-9);
try std.testing.expectApproxEqAbs(@as(f64, 0.8 + 0.04 + 1.5), pricing.usdForUsage(sol61, "gpt-6.1-sol", 200_000, 200_000, 0, 100_000), 1e-9); // long-context tier
try std.testing.expectEqual(@as(u64, 1_050_000), pricing.contextFor("openai", "gpt-6.1-sol"));
- try std.testing.expectEqual(pricing.codex_context_window, pricing.contextFor("codex", "gpt-6.1-sol"));
+ try std.testing.expectEqual(@as(u64, 500_000), pricing.contextFor("codex", "gpt-6.1-sol"));
try std.testing.expect(pricing.providerModelInTable("codex", "gpt-6.1-sol"));
}
+test "Sol subscription context honors route caps and smaller catalogs" {
+ const saved_models = pricing.active_model_table;
+ const saved_overlay = pricing.context_overlay;
+ const saved_pct = provider_mod.g_compact_pct_override;
+ defer pricing.active_model_table = saved_models;
+ defer pricing.context_overlay = saved_overlay;
+ defer provider_mod.g_compact_pct_override = saved_pct;
+ provider_mod.g_compact_pct_override = null;
+ const keys: provider_mod.Keys = .{ .values = @splat(null) };
+ for ([_][]const u8{ "codex", "chatgpt-new" }) |route| {
+ pricing.active_model_table = pricing.model_table[0..];
+ const p = keys.build(provider_mod.specFor(route).?, "", "gpt-6.1-sol");
+ try std.testing.expectEqual(@as(u64, 500_000), p.context);
+ try std.testing.expectEqual(@as(u64, 400_000), p.compactAt());
+ try std.testing.expectEqual(pricing.codex_context_window, pricing.contextFor(route, "gpt-6-sol"));
+ try std.testing.expectEqual(@as(u64, 128_000), pricing.contextFor("codex", "gpt-5.3-codex-spark"));
+ for ([_]u64{ 272_000, 500_000, 1_050_000 }) |advertised| {
+ const rows = [_]pricing.ModelInfo{.{ .provider = route, .name = "gpt-6.1-sol", .context = advertised }};
+ pricing.active_model_table = &rows;
+ try std.testing.expectEqual(@min(advertised, @as(u64, 500_000)), pricing.contextFor(route, "gpt-6.1-sol"));
+ }
+ // A name-only API window cannot bypass the subscription clamp.
+ pricing.active_model_table = &.{};
+ pricing.context_overlay = &.{.{ .provider = "", .name = "gpt-6.1-sol", .context = 1_050_000 }};
+ try std.testing.expectEqual(@as(u64, 500_000), pricing.contextFor(route, "gpt-6.1-sol"));
+ pricing.context_overlay = &.{};
+ pricing.active_model_table = &.{.{ .provider = "openai", .name = "gpt-6.1-sol", .context = 1_050_000 }};
+ try std.testing.expectEqual(@as(u64, 500_000), pricing.contextFor(route, "gpt-6.1-sol"));
+ try std.testing.expectEqual(@as(u64, 1_050_000), pricing.contextFor("openai", "gpt-6.1-sol"));
+ }
+}
+
test "grok-4.6 window is 500k and compact-at is 80%" {
const window = pricing.contextFor("xai", "grok-4.6");
try std.testing.expectEqual(@as(u64, 500_000), window);