Files
magpie/internal/settings
yetone 4f94b8a829 grok: context_window is the model's window; Long conversations goes in auto_compact_threshold_percent (@xiancrong on X)
magpie wrote Long conversations' compaction threshold into each
[model."magpie/..."] table's context_window. Grok Build reads
context_window as the model's whole window and compacts at a percent of
it: auto_compact_threshold_percent in [model.<id>], else [session]'s,
else 85 (xai-org/grok-build 559751fd:
xai-grok-shell/src/util/config/resolve/compaction.rs,
DEFAULT_AUTO_COMPACT_THRESHOLD_PERCENT and
resolve_auto_compact_threshold_percent; GROK_AUTO_COMPACT_THRESHOLD_PERCENT
above all). So a 1M model held to 300K compacted at 255K and never had
its real window.

Now context_window is the catalog's whole window, and where magpie has
it compact (grokCompactAt, the old grokWindow rule: the model's or
provider's threshold, else settings.Working, none under Full window)
goes in as auto_compact_threshold_percent of the window written,
rounded down, at least 1 (grokPercent). None leaves Grok's own 85.
- A table an older magpie wrote with the threshold as its window, on
  record in grok:<path>:windows, gets the whole window back.
- A percent the user set in one of magpie's tables stays: what magpie
  gave is stashed in grok:<path>:percents, and one it has no record of
  giving is the user's (grokOwnPercent). A context_window set by hand
  still stays (grokOwnWindow).
- A [session] auto_compact_threshold_percent is the user's for every
  model, so magpie writes no per-model one over it.

Siblings: Codex (codexcat) already writes context_window and
auto_compact_token_limit apart, and Claude Code has
CLAUDE_CODE_MAX_CONTEXT_TOKENS beside CLAUDE_CODE_AUTO_COMPACT_WINDOW.
Grok App (grokapp.go) writes the model's own window. Only Grok Build
had the threshold in its window key.

Run:
- At cfca72eaf (this change on f9492fd8e), on mica (mote was over its
  cores): gofmt -l clean; go vet ./internal/agent ./internal/settings,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok;
  go test -count=1 -timeout 45m ./... ok, go-exit=0.
- At this head, rebased on f1a4de736 (internal/agent changed in
  6abea5f8e): gofmt, vet and go test ./internal/agent
  ./internal/settings ./internal/gui on mica: gofmt clean, vet ok, all three ok (agent 195s, settings 16s, gui 137s).
- Broken by hand: the new tests run against origin/main's grok.go (with
  a shim for grokHadIn) are red: TestGrokWindowIsTheModelsAndCompactsAtThePercent
  (pro 300000, want 1M), TestGrokKeepsTheUsersCompactPercent,
  TestGrokWindowFollowsLongConversations, TestGrokKeepsAWindowSetBeforeTheRecord.
- Real grok 1.0.67 in a sandbox HOME/GROK_HOME: `grok models` and
  `grok inspect` take a table with context_window = 1000000 and
  auto_compact_threshold_percent = 30 with no config warning (a
  misspelt key is reported as "unknown field", so the check sees it).

Not tried: a real Grok conversation running up to the threshold to
watch it compact at 300K.
2026-11-17 20:34:19 +08:00
..
tray: the menu bar shows several subscriptions' usage side by side (KevinXC on Discord) — Settings → Usage in the menu bar picked one card; its menu now ticks any number (kept open while ticking, saved once when it closes, Off unticks all, a ticked card that has gone stays listed to untick) and the pill says "3 subscriptions". settings.TrayUsages keeps them in order; a file with only the older trayUsage shows that one, and trayUsage is still written as the first for an older magpie. On the Mac the bird and a cell per card are drawn as one image by AppKit on the status item's button: the card's logo (a black glyph tinted in the menu bar's text colour, a coloured one as it is, the name's letter in a ring when there is none) and its two windows stacked, "42%" over "18%", in the bar's colour light or dark and sharp at any scale; the bird's flap goes through it. Arc flags run into numbers (Codex's logo) are spaced out for AppKit's SVG reader. A row longer than 10 characters (a plan's balance read from its page) is cut with an ellipsis in the bar and whole in the tooltip. Windows and Linux show the cards as text, " | " between them. TestTrayUsageCells, TestSVGArcFlags, TestTrayImage (darwin, renders 0-3 cards light and dark at 2x), TestTrayUsagesMigrate and tray-usages.test.cjs (Chromium, WebKit, en/zh) are new. go vet, go build (darwin GUI), go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./..., go test ./internal/gui pass; tray-usages, settings-groups, panel-*, click-scroll, old-webkit pass. Not seen in a live menu bar.
2026-09-30 19:45:44 +08:00