restAfterMarked sank a rate-limited candidate by its rest key, so one
of a remote magpie's models answering 429 with quota left sent the
remote's other models, never limited, to the back of every Sink order
too, while the rest itself was the model's alone (remoteModelRest).
The sink now keeps the rest's scope: such a model sinks by restID, and
sunkAt reads a candidate's restID before its restKey.
Patch by ggbdpq (#2167): the routing.go change and
TestRemoteMagpieRateLimitSinksTheModel are theirs. Changed from it:
- their sunkAt read restID only for the Remote Magpie preset, while
remoteModelRest also holds for a magpie added by hand as a plain
endpoint (its reply names the provider, answeredThereHeader,
4e5b2ad81). Such a model sank under restID and was then never found,
so it sank nowhere. sunkAt now reads restID for every candidate.
- UnrestAll lifts a key's rest and each of its models' but unsank only
the key, so a model sunk alone stayed at the back after Try now.
It calls unsinkAll (the key and key/…).
Doc: the Sink row in gateway-routing.md.
Run (rebased on origin/main):
- TestRemoteMagpieRateLimitSinksTheModel: red on origin/main's
routing.go and sink.go ("the remote was asked [], other [ko]"),
green now.
- TestMagpieAddedByHandRateLimitSinksTheModel (new): red on main (kimi
sank with glm), red with the patch's preset-only sunkAt put back by
hand ("glm didn't sink ... the remote was asked [glm/glm-5]"), green
now.
- TestUnrestAllUnsinksTheModels (new): red with UnrestAll calling
unsink(key) ("office/glm/glm-5 still sunk"), green now.
- Sink|Sunk|Unrest|TryNow|RemoteMagpie|AnotherMagpie ok; the whole
internal/gateway package (-tags nogui -count=1 -timeout 45m) ok in 502s
at 56ea00d9c.
- gofmt -l clean; go vet ./internal/gateway for darwin, GOOS=windows,
GOOS=linux -tags nogui clean.
Not tried: two real magpies with Sink on and a real vendor 429.