zygs1083-dotcom on plugins#243: Factory answered 403 to a Claude Code
2.1.292 request (a changed instructions wrapper factory 0.1.33 didn't
adapt), and the accounts went into cooldown.
On ab7ec8c65 two things made that worse than one failed request:
- restAfterMarked's default branch rested any failure of an account
whose cached reading was full (c.full: 98% under Smart) until the
window reset, held to 8 days, by "window". A plain 403 says nothing
of the window, so an account read at 98% sat out its week over it.
A 401 or 403 no longer infers a window rest: one that names a quota
is failQuota already (usedUpWords), and one that doesn't goes on the
backoff ladder. Every other failure at 98% still rests by window.
- The candidate loop rested each account in turn for the same request's
403, so one request walked the whole provider into backoff. Now a
plain 403 (plainForbidden: failOther, not a model not served) from a
second key or account of the same provider, model and reasoning in
one request is the request refused: that one doesn't rest, the
earlier mate's rest and counted failures are taken back (unforbid,
only when the rest is still the one it took), its trace try loses
its Rest, and the remaining mates are asked last (matesLast). The
Routing page already words a failed try with no rest as "doesn't
rest for it", so no new strings. One account's plain 403 alone still
rests it as before.
docs/subsystems/gateway-routing.md says both, with the tests.
Tests (internal/gateway/plain403_rest_test.go):
- TestPlain403DoesNotRestUntilTheWindow: an account at 98% gets a plain
403 and a plain 401: rests by backoff; a 403 saying used up still
rests 39h by window; a 502 at 98% still by window. On ab7ec8c65's
routing.go (the file swapped back) it fails: "a plain 403 at 98%
rests 39h0m0s by window (other)".
- TestPlain403OnTwoMatesRestsNeither: three Codex accounts through the
gateway against a fake ChatGPT backend: one 403 alone rests that
account; two alike with a third answering, and two alike with nobody
left, rest nobody and leave no failure counted. Broken by hand twice:
the mate branch disabled (both alike cases red, "codex@me@example.com
resting true, want false"), and unforbid leaving the counts (both red,
"still counts 1 failures").
Run at ab7ec8c65 (macOS, go1.26.8, sandbox HOME), both commits in the
tree: gofmt, three vets clean; set -o pipefail; go test -timeout 45m
./...: exit 0, 64 packages ok, no FAIL (load ~200).
Rebased onto b641868eb (origin/main, which moved gateway.go and
routing.go: b749cffbb's reply-room retry on a 400, b641868eb's
heldClockIn; neither touches the 403 path) and run again at a33699df6
(this pair's tree), macOS, go1.26.8, sandbox HOME: gofmt -l none; go
vet ./... (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows
go vet ./...: all clean. go test -count=1 -timeout 45m
./internal/provider: ok (809s). go test -run
'TestPlain403|TestOrderedKeepsAnAccountAt98|TestPromptRefusalRestsNobody|ReplyFitsTheWindowLeft|TestHeldClock|Rest|Forbid|403'
./internal/gateway: ok (110s). go test -count=1 -timeout 45m
./internal/gateway: ok (1762s, load ~300). A full ./... at a33699df6 was started
and stopped after 46 minutes with one package done (load 320-420 from
other sessions, disk at 8.7G free); the earlier full run of the same
two commits on ab7ec8c65 was exit 0, 64 packages ok.
Not tried: no real Factory account or request; the 403 is a fake
backend's.