isdou spent a reset on the Usage page: Usage showed the windows at 100%
left and 2 resets, while the Providers editor still said the week was
used up with 3 resets, and Routing said the account's allowance was
unknown and sent requests on to the next account.
Two reasons, one per page:
- The Providers editor reads each account's windows itself
(loginUsageOf, /api/login/usage) and keeps the reading a minute in
the page. askReset reloaded Usage's quotas only. It now drops the
editor's Codex reading too, and re-renders an open editor.
- UseCodexReset forgets the account's allowance (renewedNow), so until
the next background reading routing had no windows for it: weighed as
not known, behind the others, and a reading already out, begun before
the reset, is dropped for it too. The codex-reset handler now waits
(up to 10s) for provider.AwaitAllowance, which has the accounts read
again and asks once more when a reading begun before the reset lands,
so by the time the page hears "reset", routing knows the windows
started again, and /api/login/usage has the new reading cached.
Tests:
- provider TestResetAllowanceKnownAtOnce: a fake reader, the reset
spent with no reading out and with one out (held in the fake until
after renewedNow). Red with AwaitAllowance a no-op (not known), and
red with it asking one reading only (the in-flight case).
- reset-providers.test.cjs: Providers editor opened (3 resets), reset
on Usage, editor opened again: says 2. Red on origin/main's app.js
("still says 3 resets", login/usage not asked again) in all four;
passes in Chromium and WebKit, en and zh, 420 and 1000px.
Run: go test -tags nogui ./internal/provider/ ./internal/gui/ (ok),
-race -count=20 on the new provider test, gofmt -l clean.