Files
magpie/docs
yetone 48194bbee0 routing: an In order group's later members aren't said to go after a known allowance (bitssly on X)
bitssly on X (10-24) asked why, with a group set 按顺序 (In order), an
account whose quota isn't known "can't be used", quoting the Routing
page: "opencode:剩余额度未知,排在已知的之后。" and "腾讯-国际:剩余额度未知,
排在已知的之后。"

Cause: the gateway does what the mode says. planGroup/planLevel try an
In order group's members in the order given and never by what each has
left; each member's own accounts go as that member's provider routes
them (Smart by default, where an unknown allowance still comes before
any account at 90% or more and is tried when the known ones fail). The
explanation was wrong. weighed() gives an ordered group's rows their
member's routing (""), so the page's smart() judged each row against
every known row of the whole request: an In order group's later
members read as ranked behind a known allowance, and the first got a
Smart reason ("its allowance renews soonest ...") instead of In order.
A By weight group's first had the same fault.

Change:
- client.js: placeRouting/wholeMembers/weighedWith scope what a row is
  weighed against to its own member when the level that placed it takes
  members whole (order, weight). firstWhy says "In order: {who} is
  first ..." for such a group, and "By weight: it's {who}'s share ..."
  for a weighted one; the unknown, learns, spent and low asides are said
  only of an account weighed against another of its own member. Rebased
  onto 6d707af08 (Creat.wu, memberSplit): its member line now asks the
  scoped someKnown(x), so an unknown account alone in its member gets no
  line at all, and one beside a known account of its own member gets
  6d707af08's one line for the member.
- i18n.js: the By weight line in zh, zh-TW, ja, de.
- routing-order-unknown.test.cjs: In order, Smart and By weight groups
  over Codex (known), OpenCode Zen Free "opencode" (unknown) and two
  WorkBuddy AI accounts (one known, "腾讯-国际" unknown); chromium and
  webkit, en/zh/zh-TW/ja/de, 1100 and 420 wide.
- docs/reference.md: Smart's unknown account is still tried when the
  known ones fail; an In order group keeps its order whatever is known.

Why the quotas are unknown: OpenCode Zen Free is a free tier with no
allowance to report. Tencent Cloud Token Plan and Volcengine access-key
plans are read for the Usage page but not for routing; that class is
#3251. No plugin change.

Run:
- old client.js with the new test: red on the why line (chromium en/zh
  1100: "c@x.test goes first: of those with quota to spare, its allowance
  renews soonest ..." where "In order: c@x.test is first ..." was due).
- at the rebased head (origin/main 1f8f80e4a plus this):
  routing-order-unknown, routing-weight-member-low and i18n-* 64/64.
- go test -timeout 45m ./internal/gui/... at the rebased head: ok but
  TestMainWindowCorners (killed measuring windows at load ~80; red alone
  too; #1936, #2645, AppKit, not this change). Before the rebase: ok
  (112s).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: clean. No Go file changed, so gofmt has nothing to check.
- whole GUI suite at ab287a839 (before the rebase), concurrency 4, load
  50 to 80: files a* to roughly o* ran; reds, all outside routing and
  filed: api-key-theme chromium system (#3307, also 1 of 3 alone),
  fonts webkit narrow (#3227), library-mcp-health-wsl ja (#3350),
  menu-input-scroll chromium en/zh (#3402). The rest of that run is void:
  my own rebase put conflict markers in client.js mid-run. The files from
  n* on are run again at the pushed head after this push.

Broken by hand: someKnown made global again (the old aside scoping):
red, the opencode aside is back under the In order group.

Not tried: the reporter's own trace and accounts (not shared); a Go
test for the gateway's order (unchanged here, covered by the existing
fallback tests); routing reading the access-key plans (#3251).
2026-10-24 19:09:41 +08:00
..