caps: a lone capped Codex account says its turns go to the fallbacks (not_4O4 on X)
not_4O4 asked for a way to switch to non-official models once a set share of the ChatGPT quota is used. magpie already does this: a usage cap on the Codex account (or a cap on the 5-hour / weekly window alone) plus the provider's Fallback. When Codex is connected to magpie beside its ChatGPT sign-in, or fails over through it, codexAccounts sends a capped lone account's own-model turn through serve, so the fallbacks answer it. The GUI said otherwise. The account row of a lone Codex account said "Codex still uses it" past the cap even when Codex was connected, and the cap note said requests are refused when the provider has fallbacks. Now: - the direct-use note shows for Codex only when it isn't connected or failing over (an agent row with wired or failover); - the held note says the requests go to this provider's fallbacks when it has some and Stop at the caps is off, in en, zh, zh-TW, ja, de. - TestCoreScriptBudget: +236 bytes for this, packed to its shortest form with no page to move it to (the account rows are core). The 11-04 grey Send default and the takeover are untouched: a cap never takes Codex off ChatGPT. New tests: - internal/gateway TestCappedLoneCodexAccountGoesToItsFallback: a lone account capped at 80% with usage at 85 is not tried and the fallback answers (stream and not); at 50 the account is tried. - account-cap.test.cjs: Codex connected, the lone capped row's note ends with the fallback line and has no direct note; not connected, the direct note stays. Chromium and WebKit, every language. Run (mica, mote was over its load), at the rebased head (origin/mainc2a1d80fc): - GUI before the rebase: account-cap, i18n-keys, i18n-en-no-cjk, window-cap, window-cap-pool, key-usage-cap, account-row-line, codex-app-menu-cap, routing-steps-cap: 235 of 236 ok. At the rebased head: account-cap, i18n-keys, i18n-en-no-cjk, window-cap, account-row-line again: 165 of 166 ok, the same #6422 red; go test -run Budget ./internal/gui ok. The red is i18n-keys "a plugin's words are its own" ("No folder" in memory_mcp.go, from72facf72e), filed as #6422; this change touches neither file. - go test -run 'Cap|Codex.*Fallback|Fallback' ./internal/gateway: ok. - gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows for internal/gateway and internal/gui: clean. Broken by hand: - `if false &&` before the HoldCaps check in codexAccounts: the Go test went red (acct-1 tried, fallback 0). - the old `direct` and the fallback flag forced false: the 10 connected GUI cases went red in both engines; the not-connected ones stayed green. Not tried: a real ChatGPT account reaching its cap with the real Codex CLI or app; the full suite runs after the tag.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,56 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/yetone/magpie/internal/provider"
|
||||
)
|
||||
|
||||
// not_4O4 on X: the Codex app, signed in to its one ChatGPT account,
|
||||
// should stop spending the subscription at a share of its windows and go
|
||||
// to another vendor's model. That is the account's usage cap with a
|
||||
// fallback set on the Codex subscription: past the cap, Codex's own model
|
||||
// (asked bare, on Codex's sign-in) is served by the fallback, and nothing
|
||||
// reaches ChatGPT; under it, the account answers as ever.
|
||||
func TestCappedLoneCodexAccountGoesToItsFallback(t *testing.T) {
|
||||
for _, stream := range []bool{true, false} {
|
||||
t.Run(fmt.Sprint(stream), func(t *testing.T) {
|
||||
codexSignedIn(t)
|
||||
b := newResetBackend(t)
|
||||
if err := provider.SetAccountCap("codex", "me@example.com", 80); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
a := &scripted{replies: []reply{{200, "", chatSSEReply("OK")}, {200, "", chatSSEReply("OK")}}}
|
||||
scriptedOn(t, "a", provider.Chat, a)
|
||||
p, _ := provider.Find("codex")
|
||||
p.Fallback = []string{"a/m"}
|
||||
if err := provider.Save(*p); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
post := func() *httptest.ResponseRecorder {
|
||||
rec := httptest.NewRecorder()
|
||||
req := httptest.NewRequest("POST", CodexPath+"/responses", strings.NewReader(fmt.Sprintf(`{"model":"gpt-5.5","stream":%v,"input":"hi"}`, stream)))
|
||||
req.Header.Set("Authorization", "Bearer chatgpt-token")
|
||||
req.Header.Set("chatgpt-account-id", "acct-1")
|
||||
New().Handler().ServeHTTP(rec, req)
|
||||
return rec
|
||||
}
|
||||
capUsage(t, map[string]float64{"me@example.com": 85})
|
||||
rec := post()
|
||||
if tried, _ := b.seen(); rec.Code != 200 || tried != "" || a.n != 1 {
|
||||
t.Fatalf("past the cap: %d %s (codex %q, fallback %d)", rec.Code, rec.Body.String(), tried, a.n)
|
||||
}
|
||||
capUsage(t, map[string]float64{"me@example.com": 50})
|
||||
sticks.Lock()
|
||||
sticks.m = map[string]stick{}
|
||||
sticks.Unlock()
|
||||
rec = post()
|
||||
if tried, _ := b.seen(); rec.Code != 200 || tried != "acct-1" || a.n != 1 {
|
||||
t.Fatalf("under the cap: %d %s (codex %q, fallback %d)", rec.Code, rec.Body.String(), tried, a.n)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -13472,8 +13472,11 @@ function renderAccounts(a, p) {
|
||||
if (amPill) pill(amPill);
|
||||
// its usage cap: the share of each window it is used to at most
|
||||
const cap = accountCapOf(p, l.user);
|
||||
// alone, the cap holds back only magpie's (𝕏 on Discord)
|
||||
const direct = l.active && !several && (a.agent === "claude" || a.agent === "codex") ? a.agentName : "";
|
||||
// alone, the cap holds back only magpie's (𝕏 on Discord); Codex
|
||||
// connected, or failing over through magpie, sends its own turns to
|
||||
// the gateway, which holds a lone capped account there and goes on to
|
||||
// the fallbacks (not_4O4 on X)
|
||||
const direct = l.active && !several && (a.agent === "claude" || a.agent === "codex" && !state.agents?.some((x) => x.id == "codex" && (x.wired || x.failover))) ? a.agentName : "";
|
||||
if (p) pill(accountCapPill(p, l.user, cap, direct));
|
||||
// and each window's own, set on its meter (willz on Discord)
|
||||
const capFor = (w) => windowCapOf(p, l.user, w);
|
||||
@@ -13492,7 +13495,7 @@ function renderAccounts(a, p) {
|
||||
(l.accessOnly ? line : tools).append(ao);
|
||||
}
|
||||
const held = capHeldOf(quota?.[l.user], capFor);
|
||||
if (held) line.append(capHeldNote(held, held.cap, several, direct));
|
||||
if (held) line.append(capHeldNote(held, held.cap, several, direct, !p?.capStop && p?.fallback?.length));
|
||||
line.append(el("span", "grow"));
|
||||
if (unusable(l)) {
|
||||
row.classList.add("signed-out");
|
||||
@@ -14298,7 +14301,9 @@ function capHeldOf(q, capFor) {
|
||||
function directNote(agent) {
|
||||
return t("{agent} is signed in to this account and asks its vendor itself, not through magpie, so with no other account on to move it to, {agent} goes on using it past the cap. Add another account, or pick {agent}'s models via magpie, for the cap to hold it", { agent });
|
||||
}
|
||||
function capHeldNote(held, cap, several, direct) {
|
||||
// fallsBack: past every account's cap, requests go on to the provider's
|
||||
// fallbacks (Stop at the caps off)
|
||||
function capHeldNote(held, cap, several, direct, fallsBack) {
|
||||
const back = held.back ? " · " + resetText(new Date(held.back), new Date(held.back).toLocaleString(intlLang())) : "";
|
||||
if (direct) {
|
||||
const n = el("span", "using acap-held acap-direct", t("At its cap · {agent} still uses it", { agent: direct }));
|
||||
@@ -14312,13 +14317,13 @@ function capHeldNote(held, cap, several, direct) {
|
||||
const n = el("span", "using acap-held", held.back ? t("{names} at its cap · back {in}", { names, in: untilText(held.back) }) : t("{names} at its cap", { names }));
|
||||
n.title = t("{names} is at {n}%, past this account's {cap}% cap, so magpie sends the requests it counts to the other accounts until it renews; other models still use this account", { names, n: Math.round(held.used), cap })
|
||||
+ back
|
||||
+ (several ? "" : "\n" + t("With no other account on, those requests are refused with a usage-cap error until then"));
|
||||
+ (several ? "" : "\n" + (fallsBack ? t("With no other account on, those requests go to this provider's fallbacks until then") : t("With no other account on, those requests are refused with a usage-cap error until then")));
|
||||
return n;
|
||||
}
|
||||
const n = el("span", "using acap-held", held.back ? t("At its cap · back {in}", { in: untilText(held.back) }) : t("At its cap"));
|
||||
n.title = t("A usage window is at {n}%, past this account's {cap}% cap, so magpie counts it as used up and sends requests to the other accounts until that window renews", { n: Math.round(held.used), cap })
|
||||
+ back
|
||||
+ (several ? "" : "\n" + t("With no other account on, requests are refused with a usage-cap error until then"));
|
||||
+ (several ? "" : "\n" + (fallsBack ? t("With no other account on, requests go to this provider's fallbacks until then") : t("With no other account on, requests are refused with a usage-cap error until then")));
|
||||
return n;
|
||||
}
|
||||
function capMark(track, w, cap) {
|
||||
|
||||
@@ -4368,6 +4368,8 @@ const I18N = {
|
||||
"{names} at its cap · back {in}": "{names}已达上限 · {in}恢复",
|
||||
"{names} is at {n}%, past this account's {cap}% cap, so magpie sends the requests it counts to the other accounts until it renews; other models still use this account": "{names}已用 {n}%,超过该账号的 {cap}% 上限,重置前计入它的请求发给其他账号;其他模型仍用此账号",
|
||||
"With no other account on, those requests are refused with a usage-cap error until then": "没有其他启用的账号时,在此之前这些请求会返回“已达用量上限”的错误",
|
||||
"With no other account on, requests go to this provider's fallbacks until then": "没有其他启用的账号时,在此之前请求会改由本提供商的备用模型接手",
|
||||
"With no other account on, those requests go to this provider's fallbacks until then": "没有其他启用的账号时,在此之前这些请求会改由本提供商的备用模型接手",
|
||||
"Stops at {n}% of each usage window: once magpie reads a window at {n}% or past it, it counts this account as used up and sends it nothing more until the window renews. A turn already under way can still take it past {n}%, so the cap doesn't promise the rest is left. Click to change": "每个用量窗口用到 {n}% 即停:magpie 读到某个窗口达到 {n}% 或更高后,就把该账号视为已用完,在窗口重置前不再给它发请求。已在进行中的请求仍可能让它超过 {n}%,所以上限不保证剩下的额度不被用掉。点击修改",
|
||||
"Used to 100% of its usage windows. Click to cap it at a share of each, so magpie goes on to the other accounts past it": "用量窗口会用到 100%。点击设置比例上限,超过后改用其他账号",
|
||||
"{who} stops at {n}% of each window": "{who} 每个窗口用到 {n}% 即停",
|
||||
@@ -7308,7 +7310,7 @@ const I18N = {
|
||||
"{agent} is now signed in as {user}. New {agent} sessions use this account; one already open keeps its account until it is started again.": "{agent} 已切換到 {user}。新開的 {agent} 工作階段使用這個帳號;已經開啟的工作階段仍用原帳號,重新啟動後才換過來。",
|
||||
"Not connected · switching accounts only": "未接入 · 僅切換帳號",
|
||||
"Don't go to fallbacks when every account is at its cap": "所有帳號都到上限時,不轉備援",
|
||||
"Off: once every account in use is at its cap, requests go on to this provider's fallbacks (other providers or keys). On: they get 429 and nothing else is tried.": "關閉:使用中的帳號全部到達上限後,請求會轉到此提供者的備援(其他提供者或金鑰)。開啟:直接回傳 429,不再嘗試別的。",
|
||||
"Off: once every account in use is at its cap, requests go on to this provider's fallbacks (other providers or keys). On: they get 429 and nothing else is tried.": "關閉:使用中的帳號全部到達上限後,請求會轉到此提供者的備用(其他提供者或金鑰)。開啟:直接回傳 429,不再嘗試別的。",
|
||||
"Check usage again near a cap": "接近上限時重新讀取用量",
|
||||
"On: an account near its cap has its usage read again before a request. One whose usage can't be read is held.": "開啟:帳號接近上限時,請求前重新讀取用量。讀不到用量的帳號暫停使用。",
|
||||
"No cap on {users}: used to 100% of each window": "{users} 沒有上限:每個視窗都會用到 100%",
|
||||
@@ -9498,6 +9500,8 @@ const I18N = {
|
||||
"{names} at its cap · back {in}": "{names}已達上限 · {in}恢復",
|
||||
"{names} is at {n}%, past this account's {cap}% cap, so magpie sends the requests it counts to the other accounts until it renews; other models still use this account": "{names}已用 {n}%,超過該帳號的 {cap}% 上限,重置前計入它的請求發給其他帳號;其他模型仍用此帳號",
|
||||
"With no other account on, those requests are refused with a usage-cap error until then": "沒有其他啟用的帳號時,在此之前這些請求會返回「已達用量上限」的錯誤",
|
||||
"With no other account on, requests go to this provider's fallbacks until then": "沒有其他啟用的帳號時,在此之前請求會改由此提供者的備用模型接手",
|
||||
"With no other account on, those requests go to this provider's fallbacks until then": "沒有其他啟用的帳號時,在此之前這些請求會改由此提供者的備用模型接手",
|
||||
"Stops at {n}% of each usage window: once magpie reads a window at {n}% or past it, it counts this account as used up and sends it nothing more until the window renews. A turn already under way can still take it past {n}%, so the cap doesn't promise the rest is left. Click to change": "每個用量時段用到 {n}% 即停:magpie 讀到某個時段達到 {n}% 或更高後,就把該帳號視為已用完,在時段重置前不再傳送請求給它。已在進行中的請求仍可能讓它超過 {n}%,所以上限不保證剩下的額度不被用掉。點選修改",
|
||||
"Used to 100% of its usage windows. Click to cap it at a share of each, so magpie goes on to the other accounts past it": "用量時段會用到 100%。點選設定比例上限,超過後改用其他帳號",
|
||||
"{who} stops at {n}% of each window": "{who} 每個時段用到 {n}% 即停",
|
||||
@@ -14646,6 +14650,8 @@ const I18N = {
|
||||
"{names} at its cap · back {in}": "{names}が上限に到達 · {in}に復帰",
|
||||
"{names} is at {n}%, past this account's {cap}% cap, so magpie sends the requests it counts to the other accounts until it renews; other models still use this account": "{names}が {n}% で、このアカウントの上限 {cap}% を超えているため、magpie は更新されるまでそれに数えられるリクエストを他のアカウントに送ります。他のモデルは引き続きこのアカウントを使います",
|
||||
"With no other account on, those requests are refused with a usage-cap error until then": "他に有効なアカウントがない場合、それまでそれらのリクエストは使用量上限エラーで拒否されます",
|
||||
"With no other account on, requests go to this provider's fallbacks until then": "他に有効なアカウントがない場合、それまでリクエストはこのプロバイダーのフォールバックに回ります",
|
||||
"With no other account on, those requests go to this provider's fallbacks until then": "他に有効なアカウントがない場合、それまでそれらのリクエストはこのプロバイダーのフォールバックに回ります",
|
||||
"Stops at {n}% of each usage window: once magpie reads a window at {n}% or past it, it counts this account as used up and sends it nothing more until the window renews. A turn already under way can still take it past {n}%, so the cap doesn't promise the rest is left. Click to change": "各使用量ウィンドウの {n}% で止めます。magpie がウィンドウを {n}% 以上と読み取ると、ウィンドウが更新されるまでこのアカウントを使い切ったものとみなし、何も送りません。すでに進行中のリクエストで {n}% を超えることはあるため、残りが必ず残るわけではありません。クリックで変更",
|
||||
"Used to 100% of its usage windows. Click to cap it at a share of each, so magpie goes on to the other accounts past it": "使用量ウィンドウを 100% まで使用します。クリックすると各ウィンドウの割合で上限を設定し、超えたら magpie が他のアカウントに切り替えます",
|
||||
"{who} stops at {n}% of each window": "{who} は各ウィンドウの {n}% で停止",
|
||||
@@ -19807,6 +19813,8 @@ const I18N = {
|
||||
"{names} at its cap · back {in}": "{names} am Limit · wieder {in}",
|
||||
"{names} is at {n}%, past this account's {cap}% cap, so magpie sends the requests it counts to the other accounts until it renews; other models still use this account": "{names} steht bei {n} %, über dem Limit von {cap} % für dieses Konto, daher sendet magpie die darauf angerechneten Anfragen bis zur Erneuerung an die anderen Konten; andere Modelle nutzen dieses Konto weiterhin",
|
||||
"With no other account on, those requests are refused with a usage-cap error until then": "Ohne weiteres aktives Konto werden diese Anfragen bis dahin mit einem Nutzungslimit-Fehler abgelehnt",
|
||||
"With no other account on, requests go to this provider's fallbacks until then": "Ohne weiteres aktives Konto gehen Anfragen bis dahin an die Fallbacks dieses Anbieters",
|
||||
"With no other account on, those requests go to this provider's fallbacks until then": "Ohne weiteres aktives Konto gehen diese Anfragen bis dahin an die Fallbacks dieses Anbieters",
|
||||
"Stops at {n}% of each usage window: once magpie reads a window at {n}% or past it, it counts this account as used up and sends it nothing more until the window renews. A turn already under way can still take it past {n}%, so the cap doesn't promise the rest is left. Click to change": "Stoppt bei {n} % jedes Zeitfensters: Sobald magpie ein Zeitfenster bei {n} % oder darüber liest, gilt dieses Konto bis zur Erneuerung als aufgebraucht und erhält nichts mehr. Eine schon laufende Anfrage kann es noch über {n} % bringen, die Grenze verspricht also nicht, dass der Rest übrig bleibt. Zum Ändern klicken",
|
||||
"Used to 100% of its usage windows. Click to cap it at a share of each, so magpie goes on to the other accounts past it": "Nutzt seine Zeitfenster zu 100 %. Klicken, um es auf einen Anteil zu begrenzen, sodass magpie danach zu den anderen Konten wechselt",
|
||||
"{who} stops at {n}% of each window": "{who} stoppt bei {n} % jedes Zeitfensters",
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
// `git log -L` of this file.
|
||||
const (
|
||||
appScriptBudget = 1_086_267 // app.js: 1,080,614 at 8016205e3, with the 5,653 of room it had
|
||||
coreScriptBudget = 1_266_341 // every core script at 8016205e3, the old measure 682 over its cap there (#5918); +367 for the model test on a chosen account (tmr11235), no page left to move it to; +151 for the provider menu's "Only on this device" item and its four translations; +458 for Settings › About's Report a problem row and its translations; +113 for withScheme, the one rule every typed address goes through (eachg0 on X), cut to the shortest form that keeps it whole; +10 for the kept whole's tooltip (Musikrv77852 on X), the past-cycle line reused for it, no page left to move it to; +1,112 for Codex's Open button and its Open Codex with menu (Yink88564391 on X), packed to the shortest form, no page left to move them to; +168 for Discover's long lists drawn in part (the owner, 11-13), after the rest of its hook moved into plugingrid.js, imported when Plugins first draws; +296 for the cap toggle and Smart sentences that say what they do and the Sign in on another computer row (Wing8Aqua on X), packed to the shortest form, no page left to move them to; +333 for In turn's figure in a provider's editor and its words naming the message that goes round (Wing8Aqua on X), the figure itself in rotfig.js, imported when In turn is first shown, the hook packed to the shortest form
|
||||
coreScriptBudget = 1_266_577 // every core script at 8016205e3, the old measure 682 over its cap there (#5918); +367 for the model test on a chosen account (tmr11235), no page left to move it to; +151 for the provider menu's "Only on this device" item and its four translations; +458 for Settings › About's Report a problem row and its translations; +113 for withScheme, the one rule every typed address goes through (eachg0 on X), cut to the shortest form that keeps it whole; +10 for the kept whole's tooltip (Musikrv77852 on X), the past-cycle line reused for it, no page left to move it to; +1,112 for Codex's Open button and its Open Codex with menu (Yink88564391 on X), packed to the shortest form, no page left to move them to; +168 for Discover's long lists drawn in part (the owner, 11-13), after the rest of its hook moved into plugingrid.js, imported when Plugins first draws; +296 for the cap toggle and Smart sentences that say what they do and the Sign in on another computer row (Wing8Aqua on X), packed to the shortest form, no page left to move them to; +333 for In turn's figure in a provider's editor and its words naming the message that goes round (Wing8Aqua on X), the figure itself in rotfig.js, imported when In turn is first shown, the hook packed to the shortest form; +236 for a lone capped Codex account's row saying its turns go to the fallbacks when Codex is connected (not_4O4 on X), the two helpers inlined, no page left to move it to
|
||||
)
|
||||
|
||||
// codeBytes is how many bytes of b are code: its blank lines, its lines
|
||||
|
||||
@@ -55,12 +55,13 @@ const opusUsage = () => ({
|
||||
"Spare@Example.com": usage()["Spare@Example.com"],
|
||||
});
|
||||
|
||||
function serve(lang, posts, use = usage, alone = false) {
|
||||
function serve(lang, posts, use = usage, alone = false, opts = {}) {
|
||||
const ps = fresh();
|
||||
// the spare off: Codex signed in to me has nowhere to be moved to
|
||||
if (alone) ps.codex.account.logins[1].on = false;
|
||||
if (opts.fallback) ps.codex.fallback = opts.fallback;
|
||||
const providers = { providers: [ps.codex], presets: [], excluded: [], gateway: { running: true, window: true } };
|
||||
const state = { agents: [], profiles: [], settings: { lang, theme: "light" } };
|
||||
const state = { agents: opts.agents || [], profiles: [], settings: { lang, theme: "light" } };
|
||||
return async (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
const json = (data) => route.fulfill({ json: data });
|
||||
@@ -245,3 +246,48 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// not_4O4 on X: the Codex subscription's one ChatGPT account capped, with
|
||||
// a fallback set, and Codex connected to magpie. Codex's own turns come to
|
||||
// the gateway, which holds the account at its cap and sends them to the
|
||||
// fallback (TestCappedLoneCodexAccountGoesToItsFallback), so the row
|
||||
// doesn't say Codex goes on using it, and the held note says where the
|
||||
// requests go. Not connected, it still warns. Every language.
|
||||
const fellBack = {
|
||||
en: "With no other account on, requests go to this provider's fallbacks until then",
|
||||
zh: "没有其他启用的账号时,在此之前请求会改由本提供商的备用模型接手",
|
||||
"zh-TW": "沒有其他啟用的帳號時,在此之前請求會改由此提供者的備用模型接手",
|
||||
ja: "他に有効なアカウントがない場合、それまでリクエストはこのプロバイダーのフォールバックに回ります",
|
||||
de: "Ohne weiteres aktives Konto gehen Anfragen bis dahin an die Fallbacks dieses Anbieters",
|
||||
};
|
||||
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
|
||||
for (const lang of Object.keys(fellBack)) {
|
||||
const open = async (t, agents) => {
|
||||
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
|
||||
t.after(() => browser.close());
|
||||
const page = await (await browser.newContext({ viewport: { width: 900, height: 760 }, reducedMotion: "reduce" })).newPage();
|
||||
page.setDefaultTimeout(5000);
|
||||
page.setDefaultNavigationTimeout(60000);
|
||||
const errors = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
await page.route("**/*", serve(lang, [], usage, true, { fallback: ["deepseek/deepseek-chat"], agents }));
|
||||
await page.goto("http://magpie.test/?view=providers");
|
||||
await page.locator(".row.provider", { hasText: "Codex" }).first().click();
|
||||
await page.locator(".editor .accts .acc .aq-w").first().waitFor();
|
||||
return { page, errors, note: page.locator('.editor .accts .acc[data-account-id="me@example.com"] .acap-held') };
|
||||
};
|
||||
test(`${engine} ${lang}: Codex connected, its lone capped account's requests go to the fallbacks, and the row says so`, async (t) => {
|
||||
const { page, errors, note } = await open(t, [{ id: "codex", name: "Codex", wired: true, joined: true }]);
|
||||
assert.equal(await note.count(), 1);
|
||||
assert.equal(await page.locator(".editor .acap-direct").count(), 0);
|
||||
const title = await note.getAttribute("title");
|
||||
assert.ok(title.endsWith("\n" + fellBack[lang]), title);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
test(`${engine} ${lang}: Codex not connected, the lone capped account still says Codex uses it`, async (t) => {
|
||||
const { page, errors } = await open(t, [{ id: "codex", name: "Codex" }]);
|
||||
assert.equal(await page.locator(".editor .acap-direct").count(), 1);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user