01huadalang on Discord, after 76e4494db: Codex on several accounts in a
group with mimo2.6pro as the backup, Stays on Auto. Once Codex had quota
again, requests kept going to mimo.
The cause: when Codex couldn't answer, the turn fell over to mimo and the
session was stuck to mimo. On the next turns affine kept it there by
"cache", because only In order had a way back (backToFirst, Why "order").
A Smart group (and the other routings) never gave the conversation back to
the member ahead, however long Codex had been ready.
The fix: at the answer, the gateway records whether the member that
answered stood in for one listed ahead of it in the group: one that was
resting, or known all but used up (Used >= SpentShareOf). planGroup now
gives each candidate its member and its place in the group (placed), and
standsInFor reads the plan made before the tries. The flag is the stick's
stoodIn, inherited while the same who and model keep answering, and saved
in affinity.json (stoodIn). With Stays on Auto, a stick that stood in goes
back to the group's first member once that one is ready and not set aside
(backFromStandIn), with the new Why "back" and its Routing page line in
all five languages. A member put first on its merits (not a stand-in)
keeps its cache as before; Off, Session, Strict, Turn and In order keep
their own rules.
Not changed, by design: Smart and Least used count a key with unknown
usage (mimo) as unused, so with every Codex account at 90% or more of a
window a new session can go to mimo first. In order keeps a backup last;
the routing doc says so.
Tests (internal/gateway/group_stand_in_test.go, new):
- TestGroupBackupGivesTheConversationBack: smart auto with usage known
and unknown go back ("back"); in order auto "order"; in turn and smart
turn "new-turn"; smart off "off"; smart session, smart strict and in
order session stay on mimo.
- TestGroupBackupStandingInWhileTheFirstIsBackAndBehind,
TestGroupMemberPutFirstOnItsMeritsKeepsItsCache,
TestGroupStandInStaysWithinATurn, TestGroupStandInSurvivesARestart.
- affinity_fallback_test's TestGroupMemberKeepsTheConversationOnceAnother
IsBack pinned the old behaviour; it is now
TestGroupMemberGivesTheConversationBackOnceTheOneAheadIsBack.
- routing-affinity-order.test.cjs gains the "back" line.
Run, all on mote:
- With the non-test changes stashed (old code): both smart auto cases,
StandingInWhileTheFirstIsBackAndBehind, SurvivesARestart and
GivesTheConversationBackOnceTheOneAheadIsBack are red. Green with the fix.
- Broken by hand, each red: the "back" case off (smart cases,
StandingInWhileBehind); no inherit (StandingInWhileBehind); rest/spent
check off (usage-known case, StandingInWhileBehind); stoodIn check
dropped from the back case (PutFirstOnItsMerits); StoodIn not loaded
(SurvivesARestart). A check of failed tries stayed green when turned
off, since a failed try rests what failed, so it was removed.
- go test -tags nogui -count=1 -timeout 45m ./... at 80bcef18f + this:
every package ok except internal/gui, whose two reds are red on
origin/main d714c4216 too: TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestColdTurnsTaken (#4510).
- Rebased on 5a56bc7d7: internal/gateway, internal/provider and
internal/catalog ok; internal/gui has only the same two reds (#4514,
#4510). Main then moved three provider-only commits; at the pushed
parent f856d381a, internal/provider ok and internal/gateway -run
'Group|Affinity|Fallback|Ordered|Strict|Rotating|Stick' ok.
- gofmt -l clean; go vet, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gateway ok.
- GUI (Chromium and WebKit): routing-affinity-order, routing-js,
i18n-keys, gui-zh-tw and gui-de pass; gui-ja's one red is #4580
(a7b47d57e's string, not this one).
- Every routing-*.test.cjs file on mote (2050 tests, both engines, five
languages) at load 140 to 200 from other sessions' suites: 35 red in 10
files, all timeouts or moves under load. The same 10 files run alone,
serially, at this head and at origin/main 41b5c0f19 are red in the same
tests (27 and 30, differing only in which language flaked). All filed:
#4585, #3789, #3096, #3094, #3799, #3412, #1804, #4560, #3593, #4082,
#4627, #4628, #3954, #4629.
Not tried: no real Codex or MiMo account; the case was reproduced with a
fake upstream only. A stick saved before this change has no stoodIn, so a
conversation already stuck to the backup stays there until it goes cold
(5 minutes idle) or a new session starts.