H20 and others saw free models (hy3, Cline's free ones) at a 512-token context window, and Claude Code and Codex then treated them as unusable: they compact at once. Every agent and the gateway read a model's window from its catalog entry (Entry.Context, from WindowOf and ListedWindow), which took any positive window the vendor's or plugin's list gave as said. Where the 512 itself comes from isn't seen here: models.dev's cache (2026-10-12), Cline's live /ai/cline/models and recommended feed, the WorkBuddy and Cline plugins' static lists and magpie's own code give no window under 4095 for any of these models. It is in a vendor's live list read at run time (WorkBuddy's /v3/config maxInputTokens or a plugin's list); so the floor is where every listed window is read: - catalog.LeastWindow (2048) and catalog.Window: a window under it is not known. The smallest real chat windows are about 4096 (gpt-3.5-turbo-instruct's 4095, mythomax's 4096) and stand. - mdModel.window: a models.dev limit under it doesn't vote, so the other limit, or nothing, answers. - ListedWindow: a vendor's window under it falls back to models.dev's for the model, else 0 (the agent's default). - pluginCatalog: a plugin's input or context under it is none, so a 512 prompt cap under a 192K window leaves 192K. - planModels (Cline): a free model's 512 takes models.dev's too. - A window the user sets (Contexts) is theirs, however small. Tests, with the literal 512: TestTinyListedWindowIsUnknown (a Cline plugin listing cline-free/mimo-v2.6-flash and cline-free/hy3 at 512 is served at models.dev's 1048576 and 192000; one nothing knows at 0; a real 4096 stands; ListedWindow on a built-in's hy3 at 512 gives 192000; a user-set 1024 stands) and four new cases in TestWindowClampsInputAboveContext. Both fail on the code before (512, want 1048576 / 192000 / 0) and pass with it. Not verified: the reporter's own list, so which vendor sent 512 is inferred, not seen; not tried in a real Claude Code or Codex. Run for both commits, on origin/main94aa15397, sandbox HOME, private GOCACHE (the shared one was being emptied under the build), load average 70-86: gofmt -l clean; go vet ./... (darwin) and go vet -tags nogui ./... with GOOS=linux and GOOS=windows pass; go build -tags nogui ./... passes. go test -tags nogui: catalog, agent, plugin, library pass; provider -run 'Window|Listed|Plugin|Cline|Free|Catalog|Models' passes, and the whole of provider passed before the rebase (794s) but for TestCopilotSecretToolUsername, which fails only inside the command sandbox (its secret-tool script can't run there) and passes outside it; gateway -run 'TestVertex|Credit|Rest|Quota|Rate|Free|Plugin' passes. The whole gateway and provider packages hit their 25m and 9m timeouts on this machine's load, with stacks in tests still running (vertex, signin_proxy), not stuck; those two packages weren't run whole at this head. Rebased again onto24350a372(the doc's Verification list took both lines): go vet -tags nogui ./internal/... and go test -tags nogui -run 'Credit|Rest|Quota|Rate|Free|Group|Window|Listed|AutoMode|Codex' on gateway, catalog and provider pass.
32 lines
1.0 KiB
Go
32 lines
1.0 KiB
Go
package catalog
|
|
|
|
import "testing"
|
|
|
|
// window holds a models.dev row whose input limit sits above its window
|
|
// (Cloudflare AI Gateway's gpt-5 at 272K over 128K) to the window, and
|
|
// keeps the input limit everywhere else (gpt-5's 272K of its 400K).
|
|
func TestWindowClampsInputAboveContext(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
name string
|
|
context, in int
|
|
want int
|
|
}{
|
|
{"input below context", 400_000, 272_000, 272_000},
|
|
{"input above context", 128_000, 272_000, 128_000},
|
|
{"input only", 0, 200_000, 200_000},
|
|
{"context only", 1_000_000, 0, 1_000_000},
|
|
// a limit of 512 is none (H20 on Discord): the other answers, or
|
|
// nothing does; gpt-3.5-turbo-instruct's real 4095 stands
|
|
{"context 512", 512, 0, 0},
|
|
{"input 512 under context", 192_000, 512, 192_000},
|
|
{"context 512 over input", 512, 192_000, 192_000},
|
|
{"small but real", 4095, 0, 4095},
|
|
} {
|
|
m := mdModel{}
|
|
m.Limit.Context, m.Limit.Input = tc.context, tc.in
|
|
if got := m.window(); got != tc.want {
|
|
t.Errorf("%s: %d, want %d", tc.name, got, tc.want)
|
|
}
|
|
}
|
|
}
|