gateway: a spent last member already resting, or turned away for a prompt, keeps its old path (3f91b98ea)
3f91b98ea(dbydd) turned five internal/gateway tests red in the full suite at1534474c8: - TestCodexSpentGrokFailingIsTold (every shape): the Codex account was already resting out of its quota and asked only as the one back soonest. spentAfter had already asked Grok again as the last that may answer; lastSpent then replanned Grok another dozen times, and the Routing page no longer showed Codex's 429 as the earlier one told. lastSpent now holds only for a last member not already resting out of its allowance (!spentAfter([]candidate{c})). - TestAntigravityTurnsCodexsGPT5ThreadAwayOnce, ...TurnedAwayIsForeseen, ...TurnedAwayLastIsNoQuota, ...TurnedAwayInsideTheReplyLast: Antigravity's 429 to Codex's prompt reads as quota by failure() alone, so the widened #1772 block rested that account, which isn't at fault. The account case now needs it not turned away and its try not failPrompt; a key's stays as it was. Run (mote): the six families above plus the dbydd and PaulT tests, then go test -count=1 -timeout 45m ./internal/gateway: ok (686s). Broken by hand: lastSpent forced false -> TestGroupRelayBlipDoesNotEnd OnSpentLast red; the #1772 block back to keys only -> TestGroupSpentLastAccountRests red ("Codex asked 2 times"). The full suite at1534474c8had other reds, none in code touched here: internal/gui's real-window AppKit tests (killed at their deadlines; the same three chosen ones fail on origin/main f2c6831a3; #2645, #4125, #1936, #3178), and TempDir-cleanup reds in TestLibraryMCPHub (#4140), TestRelaunchOpenTriedAgain (#3881) and TestRequestChunksFromDisk (filed #4390); all three pass alone at both heads. Not tried: a full ./... again after this change (gateway alone was run).
This commit is contained in:
@@ -3756,9 +3756,12 @@ func (s *Server) serve(w http.ResponseWriter, r *http.Request, from provider.Pro
|
||||
// rests as they did: the relay's moment of 503 had the agent told
|
||||
// it, or the last one's 429, while the relay would answer a moment
|
||||
// on (dbydd on Discord: an in-order group of sub2api relays, a
|
||||
// Codex account out of its quota last)
|
||||
// Codex account out of its quota last). One already resting out of
|
||||
// its allowance, asked only as the one back soonest, isn't: the
|
||||
// members before it were asked again as the last that may answer
|
||||
// (spentAfter) and the agent is told theirs
|
||||
lastSpent := last && isGroup && len(busyNow) > 0 && !hw.passing && hw.failed() && !busy(hw.code(), hw.errBody()) &&
|
||||
slices.Contains([]string{failQuota, failCredit}, failure(hw.code(), hw.errBody()))
|
||||
slices.Contains([]string{failQuota, failCredit}, failure(hw.code(), hw.errBody())) && !spentAfter([]candidate{c})
|
||||
if _, same := passing(hw.code(), hw.header, hw.errBody(), again); last && patience > 0 && !protected && !hw.turnedAway && !hw.refused && hw.failed() && (busy(hw.code(), hw.errBody()) || lastSpent) &&
|
||||
(isGroup || !codexReset(hw.code(), hw.errBody())) &&
|
||||
(len(busyNow) > 0 || waitsOf(c.patience, patienceFallback) > 0 && !same) {
|
||||
@@ -3886,15 +3889,17 @@ func (s *Server) serve(w http.ResponseWriter, r *http.Request, from provider.Pro
|
||||
continue
|
||||
}
|
||||
}
|
||||
if last && !held && !hw.passing && hw.failed() && quotaStatus(hw.code()) && (try.Fail == failQuota || try.Fail == failCredit || failure(hw.code(), hw.errBody()) == failQuota || failure(hw.code(), hw.errBody()) == failCredit) {
|
||||
if last && !held && !hw.passing && hw.failed() && quotaStatus(hw.code()) && (c.p.Account == nil || !hw.turnedAway && try.Fail != failPrompt) && (try.Fail == failQuota || try.Fail == failCredit || failure(hw.code(), hw.errBody()) == failQuota || failure(hw.code(), hw.errBody()) == failCredit) {
|
||||
// the last key left is out of its allowance: it rests as the
|
||||
// ones before it did, for the next request to be answered
|
||||
// from the rests until the first of them is back (#1772). An
|
||||
// account too: not resting, it stayed the one a relay's moment
|
||||
// of failure went on to, and its 429 the agent's, request
|
||||
// after request, while the relay before it would answer
|
||||
// (dbydd on Discord). quotaHeld still holds keys alone, and
|
||||
// autoReset lifts the rest of an account it spends a reset of
|
||||
// (dbydd on Discord), once its own refusal is read as out of
|
||||
// quota or credit (not Antigravity's 429 to a prompt).
|
||||
// quotaHeld still holds keys alone, and autoReset lifts the
|
||||
// rest of an account it spends a reset of
|
||||
rest := s.restAfterMarked(c, hw.code(), hw.header, hw.errBody(), hw.sharedPool)
|
||||
try.Fail, try.Rest = rest.Why, &rest
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user