Files
magpie/internal/settings
yetoneandggbdpq bd18b7e280 gateway: Settings' Longest wait an agent is told bounds every Retry-After it hears (#5371)
tlerbao (#5371): an Antigravity quota ran out, magpie rested the account
until the plan's reset hours away, and that horizon went to OpenCode as
Retry-After. OpenCode clamps one wait at 900s and asks the same model a
few times, so it sat ~45 minutes before its own fallback chain moved on.

RetryAfterCap (seconds, unset by default) bounds the Retry-After an
agent is told. Accounts rest exactly as long either way: restAfter and
the held try read the header before it leaves.

Changed from ggbdpq's patch:
- The cap is one wrapper in Server.Handler (retryCapped), on every
  answer of 400 and up, not capAfter at four call sites. The patch
  missed the vendor's own Retry-After passed on by keepRetry (19821s and
  an HTTP date went out uncapped) and any other site that writes one.
  The wrapper has Flush and Unwrap, so ResponseController and the
  websocket's Hijack still reach the connection.
- settings.Shared() per answer, not settings.Load() from disk.
- The setting is reachable: settingsapi Keys and Merge (kept when not
  sent), a Settings › Models › Replies row (1/5/15 min, No limit) with
  zh, zh-TW, ja and de text, and prefsKeep. The patch failed
  TestKeysAreWhatTheSaveWrites ("only saved: [retryAfterCap]").
- Stays opt-in: a default cap makes a backing-off client ask again
  sooner, and each ask can spend a confirm probe on an exhausted account.
- Core script budget not raised; three app.js comments were shortened.

Run on mote at this head (rebased on 1493acb46):
- go test -tags nogui ./internal/gateway -run 'TestRetryAfter|
  TestQuotaRestsUntilTheTimeOfDaySet|TestAllRestingAnswersFromRest': ok
  (GoesOutWholeByDefault, CapBoundsTheAgentWait, CapLeavesTheRestWhole,
  CapBoundsTheVendorsOwn, ALimitIsAsked, Rests).
- settingsapi/cli TestKeysAreWhatTheSaveWrites,
  TestSettingsCLISetsWhatTheWindowSaves, TestBodySetsOneKeyOnly: ok.
- internal/gui Budget|I18n: ok.
- GUI, chromium + webkit: retry-after-cap-setting (new, 5 languages,
  1100 and 420), refusal-retries-setting, settings-hints, i18n-keys,
  i18n-en-no-cjk, reply-model-setting: 91 of 92. The one red is
  i18n-keys "a plugin's words are its own", already filed as #5332 and
  #5426 (strings outside this change).
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on
  gateway, settings, settingsapi: clean.

Broken by hand: with retryCapped taken out of Handler,
CapBoundsTheAgentWait fails (Retry-After "19252", want at most 60s) and
CapBoundsTheVendorsOwn fails (Retry-After "19821", want "60", and the
HTTP-date case). With the patch's own code, CapBoundsTheVendorsOwn fails
the same way.

Not tried: a real Antigravity account running out with a real OpenCode
fallback chain; the full suite.

Rebased onto 766d2a9f5's descendants: TestCoreScriptBudget was 1 byte
over (1533803 > 1533802) after ce2a59daa's app.js change; the new
row's comment lost a word. At the pushed head on mote:
TestCoreScriptBudget ok, -run RetryAfter ./internal/gateway ok.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-06 10:08:35 +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