gui: Make first under Smart says the order only settles ties, and Smart says what it does (CryptoSarom on X)

CryptoSarom on X: in a Codex account group, making a new account first
(首选) never sent it a request under Smart or Weekly pace. That is how
those routings work (docs/reference.md, "What the order decides"): Smart
spends the account whose quota renews soonest, and a window not started
yet renews last, so a new account waits until the others reach 90%.
Weekly pace and Least used first also go by quota. The GUI said
otherwise. Smart's description read "The first takes requests while it
has quota to spare", which was the rule before #576. Make first said
"The gateway uses this account first" and confirmed with "The gateway now
uses {user} first".

Smart's description now gives its real rule: the one renewing soonest
first, one not started yet waits, keys in their order, 90% waits. For a
subscription's accounts under Smart, Least used first or Weekly pace,
Make first's title and its confirmation now say the account is first in
the order, that the routing still goes by quota so the order only
settles ties, and that In order spends the first first. A Codex or Claude
Code sign-in switch still says who it signed in as. Keys under Smart keep
their order, so a relay's Make first is unchanged. zh, zh-TW, ja and de
strings.

Run on mote (Playwright 1.62.0):
- account-arrange.test.cjs, which now checks the title in every routing
  for a subscription and a relay: chromium and webkit pass. It was red
  before the keys fix: relay under Smart had the note.
- i18n-en-no-cjk, gui-ja, gui-de, keep-login, routing-save and
  account-return pass.
- i18n-keys "a plugin's words are its own" fails the same way on
  origin/main b684308c6 (plugins' own words found in Go files), filed as
  #5332, #5482 and #5426. The other i18n-keys tests pass.

Not changed: the routing itself. Not tried: the real app with a real
Codex account group.
This commit is contained in:
yetone
2026-11-09 03:37:31 +08:00
parent b684308c61
commit 4436b7d98f
3 changed files with 28 additions and 10 deletions
+12 -5
View File
@@ -12045,7 +12045,7 @@ function mediaChips(cls, ids, key, p, names) {
// renderRouting: spread over keys or accounts and stickiness, staged in
// the draft and made with Save (01huadalang on Discord)
const ROUTINGS = [
["", "Smart", "The first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again."],
["", "Smart", "Of the accounts with quota to spare, the one whose quota renews soonest goes first, since what it has left is lost then; one not started yet renews last, so it waits, and keys go in their order. One at 90% waits until the others can't answer. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again."],
["order", "In order", "Requests go to the first; the next takes over when the one before runs out of quota, hits a rate limit or fails."],
// dzxx0496 on Discord: free accounts one after another, the first not
// taking the requests back once it renews (routes.Drain)
@@ -13245,10 +13245,17 @@ function renderAccounts(a, p) {
// kept signed in to one (#524): the first is the order's
const kept = keptLogin(p);
const firstUser = kept ? ls.find((l) => (l.active || l.on) && !l.paused && !l.lapsed)?.user : ls.find((l) => l.active)?.user;
// Smart, Least used first and Weekly pace go by each account's quota and
// use the order only between those alike (docs/reference.md), so Make
// first says so there rather than that the gateway uses it first
// (CryptoSarom on X: a new account made first never got a request).
// Keys have no quota that renews, so Smart keeps them in their order.
const byQuota = p?.account && ["", "usage", "pace"].includes(p?.routing || "") ? ROUTINGS.find(([id]) => id === (p?.routing || ""))?.[1] : "";
const firstNote = (user) => t("{user} is first in the order; {routing} still goes by each account's quota, so the order only settles ties. In order uses the first first.", { user, routing: t(byQuota) });
const makeFirst = (l) => {
const b = el("button", "text", t("Make first"));
b.title = t("The gateway uses this account first; {agent} stays signed in to {user}", { agent: a.agentName, user: kept });
b.onclick = () => { b.classList.add("busy"); accountAction("provider/arrange", { id: p.id, accountOrder: [l.user, ...ls.filter((x) => x !== l).map((x) => x.user)] }, t("The gateway now uses {user} first", { user: l.user })); };
b.title = byQuota ? firstNote(l.user) : t("The gateway uses this account first; {agent} stays signed in to {user}", { agent: a.agentName, user: kept });
b.onclick = () => { b.classList.add("busy"); accountAction("provider/arrange", { id: p.id, accountOrder: [l.user, ...ls.filter((x) => x !== l).map((x) => x.user)] }, byQuota ? firstNote(l.user) : t("The gateway now uses {user} first", { user: l.user })); };
return b;
};
// pausable while another is on (#263)
@@ -13369,8 +13376,8 @@ function renderAccounts(a, p) {
line.append(forget, only);
} else {
const use = el("button", "text", on ? t("Make first") : t("Use"));
use.title = sub?.own ? t("The gateway uses this account first") : t("Sign {agent} in to this account", { agent: a.agentName });
use.onclick = () => { use.classList.add("busy"); accountAction("login/switch", { agent: a.agent, user: l.user }, sub?.own ? t("The gateway now uses {user} first", { user: l.user }) : t("{agent} is now signed in as {user}", { agent: a.agentName, user: l.user })); };
use.title = on && byQuota ? firstNote(l.user) : sub?.own ? t("The gateway uses this account first") : t("Sign {agent} in to this account", { agent: a.agentName });
use.onclick = () => { use.classList.add("busy"); accountAction("login/switch", { agent: a.agent, user: l.user }, on && byQuota ? (sub?.own ? "" : t("{agent} is now signed in as {user}", { agent: a.agentName, user: l.user }) + " ") + firstNote(l.user) : sub?.own ? t("The gateway now uses {user} first", { user: l.user }) : t("{agent} is now signed in as {user}", { agent: a.agentName, user: l.user })); };
line.append(forget, use);
}
}
+8 -4
View File
@@ -1969,7 +1969,8 @@ const I18N = {
"{agent} stays signed in to the first account": "{agent} 将始终登录首选账号",
"magpie moves {agent} to an account with room again": "首选账号额度不足时,会再把 {agent} 切到有余量的账号",
"Smart": "智能",
"The first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "额度充足时请求都给第一个;快用完时由剩余最多的接手。欠费的暂停半小时,额度用完的暂停到重置,被限流的按厂商要求暂停,出错的暂停一分钟,再出错则逐次延长。",
"Of the accounts with quota to spare, the one whose quota renews soonest goes first, since what it has left is lost then; one not started yet renews last, so it waits, and keys go in their order. One at 90% waits until the others can't answer. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "额度充足的账号中,额度最先重置的先用,因为它剩下的额度到时就作废;还没开始计时的最后才重置,所以排在后面;密钥按顺序。用到 90% 的,等其他都无法响应时才用。欠费的暂停半小时,额度用完的暂停到重置,被限流的按厂商要求暂停,出错的暂停一分钟,再出错则逐次延长。",
"{user} is first in the order; {routing} still goes by each account's quota, so the order only settles ties. In order uses the first first.": "{user} 已排在首位;{routing} 仍按各账号的额度挑选,顺序只在条件相同时起作用。想先用完首选账号,请选「按顺序」。",
"In order": "按顺序",
"Until used up": "用完再换",
"Requests stay on one until it is used up, then go to the next in the list and stay there: one before it that renews meanwhile doesn't take them back. One rate limited or failing is passed over while it rests, and requests come back to it after.": "请求一直发给同一个,直到它的额度用完,再换列表里的下一个并留在那里:前面的额度恢复了也不会切回去。被限流或出错的那个只在休息期间跳过,之后请求仍回到它。",
@@ -6706,7 +6707,8 @@ const I18N = {
"{agent} stays signed in to the first account": "{agent} 將始終登入首選帳號",
"magpie moves {agent} to an account with room again": "首選帳號額度不足時,會再把 {agent} 切到有餘量的帳號",
"Smart": "智慧",
"The first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "額度充足時請求都給第一個;快用完時由剩餘最多的接手。欠費的暫停半小時,額度用完的暫停到重置,被限流的按廠商要求暫停,出錯的暫停一分鐘,再出錯則逐次延長。",
"Of the accounts with quota to spare, the one whose quota renews soonest goes first, since what it has left is lost then; one not started yet renews last, so it waits, and keys go in their order. One at 90% waits until the others can't answer. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "額度充足的帳號中,額度最先重置的先用,因為它剩下的額度到時就作廢;還沒開始計時的最後才重置,所以排在後面;金鑰按順序。用到 90% 的,等其他都無法回應時才用。欠費的暫停半小時,額度用完的暫停到重置,被限流的按廠商要求暫停,出錯的暫停一分鐘,再出錯則逐次延長。",
"{user} is first in the order; {routing} still goes by each account's quota, so the order only settles ties. In order uses the first first.": "{user} 已排在首位;{routing} 仍按各帳號的額度挑選,順序只在條件相同時起作用。想先用完首選帳號,請選「按順序」。",
"In order": "按順序",
"Until used up": "用完再換",
"Requests stay on one until it is used up, then go to the next in the list and stay there: one before it that renews meanwhile doesn't take them back. One rate limited or failing is passed over while it rests, and requests come back to it after.": "請求一直發給同一個,直到它的額度用完,再換列表裡的下一個並留在那裡:前面的額度恢復了也不會切回去。被限流或出錯的那個只在休息期間跳過,之後請求仍回到它。",
@@ -11419,7 +11421,8 @@ const I18N = {
"{agent} stays signed in to the first account": "{agent} は最初のアカウントにサインインしたままになります",
"magpie moves {agent} to an account with room again": "magpie は {agent} を再び残量のあるアカウントに切り替えます",
"Smart": "スマート",
"The first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "クォータに余裕がある間は最初のアカウントがリクエストを受け、残量が少なくなると残りが最も多いアカウントが引き継ぎます。クレジット切れは30分、クォータ切れはリセットまで、レート制限はベンダーの指定する時間、エラーは1分(失敗が続くたびに長く)休止します。",
"Of the accounts with quota to spare, the one whose quota renews soonest goes first, since what it has left is lost then; one not started yet renews last, so it waits, and keys go in their order. One at 90% waits until the others can't answer. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "枠に余裕のあるアカウントのうち、枠が最も早くリセットされるものから使います(残りはその時点で失われるため)。まだ始まっていないものは最後にリセットされるので後回しになり、キーは順番どおりです。90% に達したものは、ほかが応答できないときまで待ちます。残高切れは 30 分、枠切れはリセットまで、レート制限はベンダーの指定どおり休み、失敗したものは 1 分、失敗が続くたびに長く休みます。",
"{user} is first in the order; {routing} still goes by each account's quota, so the order only settles ties. In order uses the first first.": "{user} が順番の先頭になりました。{routing} は引き続き各アカウントの枠で選ぶため、順番は条件が同じときだけ効きます。先頭から使い切るには「順番」を選んでください。",
"In order": "順番",
"Until used up": "使い切ってから次へ",
"Requests stay on one until it is used up, then go to the next in the list and stay there: one before it that renews meanwhile doesn't take them back. One rate limited or failing is passed over while it rests, and requests come back to it after.": "リクエストは 1 つを使い切るまでそこに送り、使い切ったらリストの次へ移ってそこに留まります。その間に前のものが回復しても戻りません。レート制限やエラーで休んでいるものは休止中だけ飛ばし、その後はまたそこへ送ります。",
@@ -16163,7 +16166,8 @@ const I18N = {
"{agent} stays signed in to the first account": "{agent} bleibt beim ersten Konto angemeldet",
"magpie moves {agent} to an account with room again": "magpie wechselt {agent} wieder zu einem Konto mit freiem Kontingent",
"Smart": "Intelligent",
"The first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "Das erste erhält Anfragen, solange es Kontingent übrig hat; wird es knapp, übernimmt das mit dem meisten Rest. Eines ohne Guthaben pausiert eine halbe Stunde, eines ohne Kontingent bis zum Reset, ein gedrosseltes so lange, wie der Anbieter verlangt, und ein fehlschlagendes eine Minute, bei jedem weiteren Fehler länger.",
"Of the accounts with quota to spare, the one whose quota renews soonest goes first, since what it has left is lost then; one not started yet renews last, so it waits, and keys go in their order. One at 90% waits until the others can't answer. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "Von den Konten mit Kontingent übrig geht das zuerst, dessen Kontingent am frühesten zurückgesetzt wird, denn was es übrig hat, verfällt dann; eines, das noch nicht begonnen hat, wird zuletzt zurückgesetzt und wartet daher, und Schlüssel gehen der Reihe nach. Eines bei 90 % wartet, bis die anderen nicht antworten können. Eines ohne Guthaben pausiert eine halbe Stunde, eines ohne Kontingent bis zum Zurücksetzen, eines mit Ratenlimit so lange, wie der Anbieter verlangt, und eines, das fehlschlägt, eine Minute, bei jedem weiteren Fehlschlag länger.",
"{user} is first in the order; {routing} still goes by each account's quota, so the order only settles ties. In order uses the first first.": "{user} steht jetzt an erster Stelle; {routing} geht weiter nach dem Kontingent jedes Kontos, die Reihenfolge entscheidet nur bei Gleichstand. Der Reihe nach verbraucht zuerst das erste.",
"In order": "Der Reihe nach",
"Until used up": "Bis aufgebraucht",
"Requests stay on one until it is used up, then go to the next in the list and stay there: one before it that renews meanwhile doesn't take them back. One rate limited or failing is passed over while it rests, and requests come back to it after.": "Anfragen bleiben bei einem, bis es aufgebraucht ist, gehen dann zum nächsten in der Liste und bleiben dort: Ein früheres, das sich inzwischen erneuert, holt sie nicht zurück. Eines, das rate-limitiert ist oder fehlschlägt, wird übergangen, solange es ruht, und bekommt die Anfragen danach wieder.",
+8 -1
View File
@@ -140,7 +140,14 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.reload(); await drawn(page);
await checkFirst(page, f, id);
const wanted = (await ids(page))[1];
await rows(page).nth(1).getByRole("button", { name: "Make first", exact: true }).click();
// Smart and Least used first go by a subscription's quota, so Make
// first says the order only settles ties there; a relay's keys keep
// their order under Smart, never that the gateway uses it
// first (CryptoSarom on X)
const make = rows(page).nth(1).getByRole("button", { name: "Make first", exact: true });
const title = await make.getAttribute("title") || "";
assert.equal(/still goes by each account's quota/.test(title), id !== "relay" && (mode === "" || mode === "usage"), `${id} ${mode || "smart"}: ${title}`);
await make.click();
await page.waitForFunction(ref => document.querySelector(".accts [data-account-id]").dataset.accountId === ref, wanted);
await checkFirst(page, f, id);
}