A routing group on another computer's magpie had one member, Open
Design, out of its Coding Plan quota and wallet. This magpie rested
that remote model (remoteModelRest) and, through quotaHeld, gave the
402 again on every request until the time it named, never asking the
remote. The user moved the group to another vendor there, and Codex
here still got "Remote magpie: Open Design: [code=insufficient_balance]
... (out of its allowance: not asked again before 06:19)".
The remote magpie routes its own groups and holds its own rests, and
what it serves under a name can change there at any moment. A rest
from remoteModelRest is now marked (Rest.there), and quotaHeld passes
it by: the remote is asked, and answers from its own hold at once, or
from what it serves now. The rest still puts the model behind the
others in a local group. verifyHeld is unchanged: its hold is a
minute, and TestRemoteMagpieVerifyHeldOnTheModel asks for it.
Run (on mote, at cc81ad4ea plus this change):
- TestRemoteMagpieQuotaIsAskedNotReplayed and
TestHandAddedMagpieQuotaIsAskedNotReplayed: red on cc81ad4ea (402
replayed, remote asked 0 times), green with the change.
- go test ./internal/gateway -run 'QuotaIsAskedNotReplayed|RemoteMagpie
|AddedByHand|QuotaHeld|1772': ok. A wider run (Held|Quota|Verify|
Spent|Credit) is ok except TestAntigravityTurnedAwayLastIsNoQuota and
TestCodexSpentGrokFailingIsTold, red alone on untouched cc81ad4ea
too (#4362).
- go vet ./internal/gateway, GOOS=linux (nogui) and GOOS=windows: ok.
- Two sandbox magpies (own HOMEs, free ports) and a fake vendor: R with
group never-stuck = opendesign/od-model (402 insufficient_balance),
L with R as a remote-magpie provider. Old code: after
`group set never-stuck models=newvendor/new-model` on R, L kept
answering the reporter's exact 402 and the vendor never saw
new-model. With the change: 200 from new-model at once. With both
members in the group (order), R falls through: od-model asked once,
then new-model answers every request.
Broken by hand: the change taken out, both new tests go red as above.
Not tried: a real Open Design account, the reporter's phone setup, and
the full Go suite (to run on mote when it is free).