lcyksp on Discord: the 「重置前用完」 strategy (pace) ranked a WorkBuddy
account by its monthly 500 credits ("积分 0 / 500 · 已用 0% · 28 天后重置").
WorkBuddy spends check-in credits first because they expire sooner
("70.85 积分 将于 2026/11/3 09:28:52 过期"), and the account was ranked as
if nothing would be lost for 28 days.
What changed:
- provider.Allowance.Pace takes a budget window's soonest expiry into
account (Limit.RunsOut, from QuotaWindow.RunsOutAt, which the
WorkBuddy plugin and others set on the credits window). When that
expiry comes before the window's reset, the window's pace is the
higher of:
- what is left per hour until the reset;
- the share that expires (QuotaWindow.RunsOut, now carried as
Limit.RunsOutLeft) per hour until it expires. When the amount isn't
told, all that is left counts. A share is capped at 100%, and the
hours at no less than one.
The account whose credits are lost soonest per hour goes first.
Expiry at or after the reset, or already past, changes nothing.
Zero-config: nothing new to set.
- The trace says DueBy "expiry" when the expiry set the deadline. The
Routing page's reason then reads "Use before expiry: {who} has the most
credits expiring per hour until they expire — {n} of its allowance
expires in {d}."
- Label: "Weekly pace" / 重置前用完 / 週ペース / Wochentempo becomes
"Use before expiry" / 到期前用完 (zh, zh-TW) / 期限前に使い切る /
Vor Ablauf aufbrauchen. Product call: the strategy's goal was always
"lose nothing at the deadline". A reset and an expiry are both such a
deadline, and "到期" covers both, where 「重置」 names only one. The id
stays pace, so saved groups are unchanged.
- The descriptions (Routing, Settings, group editor), docs/reference.md,
docs/subsystems/gateway-routing.md and the site's start page (en, zh,
ja) say the same.
Go, run on mote at base f95bacdfb:
- gofmt -l internal plugins: clean.
- go test -count=1 -timeout 45m on ./internal/provider,
./internal/gateway/..., ./internal/routes, ./plugins/..., ./internal/gui,
./internal/tui and ./internal/cli: all ok except three reds that are
filed and don't touch routing or pace:
- TestCodexPoolSaysTheClientsVersion (#4807)
- TestMainWindowCorners (#3949)
- TestEveryRouteHasACommandOrIsNamed (#4826)
- GOOS=linux and GOOS=windows go vet on the same packages: ok.
- GUI: the touched files (routing-pace-expiry, routing-save,
routing-group-strategy, routing-reset-deadline,
routing-wallet-balance, builtins), chromium and webkit: 90 pass, 0
fail.
- GUI on WSL magpie-desktop (Linux), after the rebase onto 9c58c87e8:
the 387 files that name routing, i18n, strategy or reason text,
chromium and webkit: 6211 tests, 6012 pass, 199 fail in 54 files.
Another session's full suite was running beside it.
- Those 54 files again on mote, with this change and at 9c58c87e8
without it: 100 and 99 reds. They are the same tests, differing only in
which language went red. Filed as #4932. routing-group-strategy, whose
one WSL red was a 9px webkit position, passed both times.
- After the last rebase, onto d29f02d65 (it changed gateway/routing.go,
i18n.js and app.js), on mote: gofmt clean.
- go test ./internal/provider ./internal/routes ./plugins/rotation/...:
ok.
- go test -run "Pace|Reset|Deadline|Expir|Routing|Weekly|Strategy|Order|Allowance"
./internal/gateway: ok.
- linux and windows vet: ok.
- GUI routing-pace-expiry, routing-save, routing-group-strategy,
routing-reset-deadline, routing-wallet-balance, builtins and
i18n-keys: 94 pass, 0 fail.
- c47fc516a (Tencent Cloud's Token Plan) landed after that run and was
not run again with this change.
Broken by hand, each red:
- The expiry branch in Pace taken out: TestPaceCreditsExpiring and
TestPaceGoesByCreditsExpiring.
- dueExpiry left unset: TestPaceGoesByCreditsExpiring's trace check.
- RunsOutLeft not carried: TestAllowanceCarriesRunsOutLeft.
- client.js's expiry reason line taken out: routing-pace-expiry, 0 of 10
pass in chromium.
Not tried:
- A live WorkBuddy account with check-in credits about to expire. The
fixtures use lcyksp's numbers (500 monthly, 70.85 expiring).
- The site pages are not deployed by this commit.