Files
magpie/internal/gui
yetone 992f88d634 usage: a stand-in reading says why the read behind it failed
@tmr11235 on X (tweet 2123334817991520577, magpie v0.1.4520): agy-cli's
card showed "截至 2026/11/15 14:19:19,暂时无法获取最新额度" days later,
with nothing to say why. keepLast stands the last good reading in for a
read that fails with a passing error (timeout, 429, 5xx, network) and
dropped that error, so a stand-in that lasted four days read the same as
one a minute old. The reading now carries the error as readError
(SubscriptionQuota, and Quota for `magpie quota --json` and the gateway
report), and asOfText puts it after the date: "… 暂时无法获取最新额度 ·
agy usage query timed out." A deferred read (not asked) has none, and
the short "As of" line on cards stays short. Every provider's stand-in
gets it, not only agy-cli's.

Run (mote, at origin/main 9bf5848c1 + this commit; again after rebasing
onto c01988e43: vet, the provider/gui quota and budget tests, usage-card-refresh
and i18n-keys, 50 pass):
- gofmt -l clean. go test -count=1 -timeout 45m on internal/provider,
  gui, cli, tui, usage, agent: ok. internal/gateway: one red,
  TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, filed as #7117 on
  origin/main before this (an OpenCode env-block test, not quotas); the
  doneHold fake's "close of closed channel" log is #6690/#6505.
- GUI: usage-card-refresh, account-every-reset, balance-parts,
  claude-usage-asked, panel-quota-refresh, i18n-keys: 94 pass, 0 fail
  (chromium + webkit, every language).
- GOOS=linux/windows go vet ./internal/provider/ (after rebase).
- Broken by hand: without the keepLast line, TestQuotaDeferredReadIsNotFailure
  fails (readError = "", want "connection refused"); without the
  asOfText change, usage-card-refresh fails ("a failed read hid why").

Not tried: the reporter's own failing read (which error it is); a real
GUI with a stand-in card (the fixture page only).
2026-11-19 17:38:05 +08:00
..
…
…
…