Files
magpie/internal
ggbdpqandfactory-droid[bot] 44b5b2b96b provider: a Claude usage ask invalidates an older read even in the same clock tick
Refs #1228. The original test fails with "a reading from before the ask
was kept". A temporary diagnostic measured identical UnixNano values for
the read's start and the later ask; that diagnostic is not shipped.

What changed:
- Count both whole-page and manual-card Claude asks with a generation.
  Advance it under subscription then login cache locks, so publication
  cannot check the old generation and then commit after the ask.
- Capture the generation before launching LoginUsage/SubscriptionUsage;
  reject an older account read or leave the cards due for another read.
- Record each Claude /usage run's ask generation. Keep timestamps, the
  zero sentinel, floor, idle behavior, saved-account scope and fallbacks.
- Document ordering and lock ownership in the providers/accounts design.
  No tests, routing.go, account files or dependency versions changed.

Run on upstream 8f2a314cf9:
- Original test unchanged: count=50 passes (12.317s). Product-only stash
  restores real red, count=30 (7.077s); pop then count=5 passes (2.137s).
- Expanded usage/header/saved-card paths race count=5 pass (122.691s),
  Go 1.26.8 and installed MinGW gcc, external sandbox home/temp and
  pinned Go caches.
- Provider nogui vet passes on Windows, Linux, Darwin. Windows default
  build and Linux/Darwin nogui builds pass. gofmt and staged diff clean.
- Provider full package and full ./... were not rerun; real account,
  GUI engines/languages, Darwin GUI build and cross-OS runtime not tried.
  Targeted evidence only, not a claim of complete merge acceptance.

Generated-by: Factory Droid (GPT-6.1 Sol)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-10-13 06:43:00 +08:00
..
settings: keep awake can keep the display on too (#975, Hu9956: magpie's keep-awake held the system up, but the screen still went black and locked, and their agents record the screen to check their work, which a locked screen stops) — Settings › General's "Keep awake while agents work" row now has three segments, Off / On / Screen on too, saved as keepAwake and the new keepAwakeDisplay (default off, so On and every existing settings.json behave as before). awake.Keep takes a Level (Off, System, Display) in place of a bool; a level changed while held releases and takes the hold anew. On a Mac the display level runs caffeinate -i -d -w <pid> (pmset -g assertions on a caffeinate of the same flags shows PreventUserIdleDisplaySleep beside PreventUserIdleSystemSleep); on Windows SetThreadExecutionState gets ES_DISPLAY_REQUIRED too; on Linux logind's idle inhibitor (systemd-inhibit --what=idle:sleep, unchanged) is all there is, and whether the screen stays on is up to the desktop. keepAwakeDisplay is this computer's own (KeepOwn) and goes in prefsKeep, so another setting's save keeps it. The row's line says the display stays on when it's chosen; it keeps its English in data-en, so a language change re-translates it. zh/ja/de strings added. No TUI or CLI has keep-awake, so none changed. TestKeepDisplay (taken once, taken anew with the display, not again at the same level, back to System, released at Off), TestCaffeinateArgs, TestExecutionState (GOOS=windows test build) and TestKeepAwakeKeptAndOwn cover it; go test ./internal/awake ./internal/settings ./internal/gui ./internal/gateway pass, -race -count=5 on awake. keep-awake.test.cjs now runs en/zh/ja/de at 900px and 440px in Chromium and WebKit (display posts keepAwake+keepAwakeDisplay true, the line changes, another setting's save keeps it, segments fit the row, On and Off clear it, no click moves the page): 32/32 twice; gui-ja, gui-de, i18n-keys and click-scroll pass. go vet (darwin, windows, linux), darwin, linux (nogui) and windows builds pass. Not tried with an agent recording the screen; the reporter is asked to confirm.
2026-10-06 15:33:28 +08:00
…
…