Files
yetone 1ee41113f5 grok: with no size typed, Grok Build compacts at its own 85% of the window (@taktoshilite on X)
@taktoshilite: the Grok config magpie writes says auto_compact_threshold_percent
= 25-something and 50-something, so a 1M model compacts at a quarter of
its window; they asked for ~90%.

Cause: 4f94b8a82 wrote each model's whole window as context_window plus
a percent from Long conversations. Its default is settings.WorkingWindow,
272K (Codex's own window), so a 1M model got 27% and a 524288 one 51%.
Grok Build's own default is 85 (resolve/compaction.rs,
DEFAULT_AUTO_COMPACT_THRESHOLD_PERCENT), 80 for xAI's own models in
default_models.json.

Change: settings.ForAgent("grok") reads magpie's default (no global size,
no Grok entry) as Full window, so no percent is written and Grok Build
uses its own 85% (1M compacts near 850K). A size the user picks still
goes in: a global or Grok-only size writes its percent (900K on a 1M
model = 90), and Grok's own {} entry keeps 272K. A percent typed by hand
in ~/.grok/config.toml is kept as before (grokOwnPercent). The stale 27/51
magpie wrote is dropped on the next sync, since the stash marks it as
magpie's. CLI (`magpie model compact`) and the Grok Build sheet say Grok
compacts at its own threshold; sub text translated into zh, zh-TW, ja, de.
docs/subsystems/agent-wiring.md says so.

Tests:
- TestGrokCompactsAtItsOwnPercentByDefault (internal/agent): catalog
  windows 1M and 524288, an old config with magpie's 27/51; default
  writes none, Grok {} gives 27/51, 900K gives 90, a hand-set 90 stays.
- TestGrokFollowsItsOwnThresholdByDefault (internal/settings).
- grok-compact.test.cjs: Grok sheet shows Full pressed, posts own at on a
  click, 900K shows 900k; Claude's row unchanged; en/zh/zh-TW/ja/de,
  Chromium + WebKit, 900px and 420px.

Run (mote, at e702accf9's tree on origin/main 64ae6e206):
- Red on the old code: with settings.go and model_cli.go from 64ae6e206,
  the agent test fails "magpie's default: big 27%, mid 51%" (the
  reporter's numbers) and the settings test fails at "default".
- go test -count=1 -tags nogui ./internal/settings ./internal/agent
  ./internal/cli ./internal/provider: all ok (agent 288s, provider 170s)
- go vet (those packages), GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean
- gofmt -l: clean.
- GUI: grok-compact, agent-compact, i18n-keys, agent-prefs, compact-at
  pass; agent-details-ready 32 of 36 red, the same 32 at 64ae6e206
  alone ("ends ~80px short and jumps", #6373).

Not tried: a real Grok Build conversation compacting at 85% on a 1M
model; the full Go suite (mote and mica were over their cores).
2026-11-20 12:03:55 +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