tongzhenbao on X: a Codex Pro account with "when its week runs out" on,
its week at 0% left, one reset held until 11-06 (after the week's own
reset on 11-03) and Use credits on. Overnight ~10k credits went and the
reset stayed; the card said "not auto-used" beside the switch on.
Cause: the week's auto-use ran only on a vendor refusal. autoReset in
routing needs a 429 usage_limit_reached on the last candidate, and the
relay's autoResetSignedIn the same on its 429. An account let spend its
credits is never refused for its week: ChatGPT answers on the credits,
and routing never benches it (full() and onCredits). So the week's reset
could only ever be spent with credits off.
Decision (product call delegated): a reset is free, credits cost money,
so a reset the user set to go when the week runs out goes before any
credits. resetBeforeCredits runs before a try is sent to a Codex account
on its credits whose last reading has its week used up, with the week's
switch on; AutoUseCodexReset reads the week again and keeps one a week
at most, so a second time in the same week goes on the credits. Hooked
in the routing loop and in codexUpstreamOn (the relay, signed-in or an
account). With no reset held, or the week's switch off, nothing changes.
The card's summary: with only the week's switch on it now says "auto-used
when the week runs out" (zh 周额度用完时自动使用), not "not auto-used",
with its title in all five languages. CLI help and auto-reset messages
say "or before its credits are spent". gateway-routing.md names it.
Siblings: the expiring switch already spends regardless of credits
(usedUp ignores them); the credits-off path (planned.held) is unchanged.
Run (mote, through mote-run, at this tree):
- go test ./internal/gateway -run 'TestCodexResetBeforeCredits|TestCodexAutoReset|TestCodexCredits|TestCodexNoCredits': ok
- broken by hand: gateway.go and codex_backend.go at origin/main:
TestCodexResetBeforeCredits/relayed and /routed red (200, spent ""),
the two negative cases green
- node --test codex-auto-reset, i18n-keys, codex-auto-reset-settings,
codex-resets-used, panel-options-fold, quota-curve: 96/96 (chromium +
webkit, en/zh/zh-TW/ja/de); codex-auto-reset red with origin/main's
app.js ("· not auto-used")
- full suite, before the rebase onto 300b7eee0: wsl-run go test -timeout
45m ./... ok for internal/gateway, provider, settings, tui and the rest;
root, cli and gui don't build in WSL (no gtk4/webkitgtk-6.0), and
internal/agent's fake-binary tests (TestInstalledVersion and four more)
fail there with "Invalid argument"; on mote those packages are ok
(., cli 49s, agent 179s)
- at the pushed head 7b6a0675f (on 300b7eee0), on mote: internal/gui,
provider and cli; provider and cli ok, gui ok except TestMainWindowCorners,
red the same on a clean 300b7eee0 copy on mote (macOS 27), #3949;
TestCoreScriptBudget ok with no raise (app.js 1,311,588 of 1,311,735,
after shortening resetsWords' change); the focused gateway tests and the
six GUI files above again, ok and 96/96
Not tried: a real account with credits and a held reset at 0% week; the
owner's accounts have no reset at 0% to spend.