Files
magpie/internal/tune
yetone 035c259a6d tune: Codex's compaction windows run to the model's own window or 1M, not the largest prompt seen (zhemu on Discord)
zhemu: Codex Desktop on a CLIProxyAPI provider's 1M GPT model, Settings ›
Long conversations at 750K; Usage › Context › "Other window…" stopped at
~412K. tuneOf took Codex's window as max(272K, the largest prompt seen),
so tune.Compact capped both the offered windows and the user's own value
at the largest prompt (~412K), whatever the model's window or the
user's setting.

Now codexWindow reads the window from magpie's catalog: a model with a
known window (typed or catalog) is offered up to it, and "now" is the
window magpie tells Codex (Settings' long-conversation value or the
model's own compaction, as codexcat writes it), 750K for zhemu. A model
whose window magpie doesn't know caps nothing short of 1M, and a mix
with one unknown is unknown. Codex's own models keep 272K or the
largest prompt. Claude Code is unchanged: only Claude models get the
advice, and other vendors' models use magpie's own window.

Run:
- TestTuneWindowsAreTheUsers (internal/gui), a custom provider with an
  unknown window, 1M and 400K, on Codex and Claude Code. Old code:
  "Codex on cpa/gpt-cpa-open: windows offered up to 410000; want
  1000000" (and for 1m). Broken by hand: told dropped → "now 0, want
  750000"; window=0 for unknown dropped → the mixed case fails.
- TestCompactUnknownWindowCapsNothing (internal/tune): old code "no advice".
- gofmt -l clean; go vet ./... and -tags nogui for GOOS=darwin, linux,
  windows clean.
- context-tune.test.cjs (Chromium + WebKit): 70/70 pass.
- go test ./internal/tune ./internal/gui ./internal/settings ./internal/davsync
  green at this head, rebased on origin/main 95e7c6bcc.

Full suite: SUITE_LINE
2026-10-15 23:08:00 +08:00
..