danzi002 on Discord (v0.1.3005): a Codex request's row read "529 · 额度用尽" (quota used up) while its detail said ChatGPT's 529 service_unavailable_error server_is_overloaded, on an account with its allowance left. The account was not rested as spent: an overload is failOther, rested a moment at most (vendorOverloaded). The words came from the row. When the last account left is out of its allowance after an earlier one failed otherwise, Codex is told the earlier failure (Try.Earlier), and the route takes that one's status, but the row paired that status with the last try's own fail, quota. The route now records the kind of the failure the agent was told (Route.Fail, from toldFail: overloaded for a 529 or a 5xx that says overloaded, the prompt turned away, else failure's reading), at both places serve tells an earlier try's failure: Try.Earlier, and every account after it passed over by a middleware. The Routing page and the panel's request rows (endWord) say that kind when it is there. "servers overloaded" is a new word for the row only (en, zh, zh-TW, ja, de), never a rest's Why. Run (mote, through mote-run; rebased on origin/main234903cb2, the first three lines and the i18n/GUI line below run again there): - go test -tags nogui -count=1 -run 'TestToldOverloadIsNotQuota|TestToldFailKinds|TestCodexCapacityNotLabelledUsageLimit' ./internal/gateway: ok - go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok (764s, before the rebase on234903cb2) - gofmt -l internal/gateway: clean; go vet -tags nogui ./internal/gateway, GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok - node --test routing-told-overload (new; Chromium and WebKit, en zh zh-TW ja de, 1100 and 420px) and routing-went-on: 40 of 40 - node --test i18n-keys i18n-en-no-cjk routing-told-overload routing-went-on: 48 of 48 - node --test routing-*.test.cjs panel-routing*.test.cjs i18n-*.test.cjs: 2673 of 2704. One red was mine: i18n-keys, the plugin word "overloaded" is also a Go string (affinity.go), so the word is now "servers overloaded". The other reds are in routing-levels, -many-keys, -order-unknown, -row-swap, -rule-drag, -rule-remove, -rules-line, -steady, -steps-cap and -story-shrinks: rerun alone, 26 of 124 red here, and 24 of 96 red on origin/main0e55a7593(mote at load ~25), already filed (#5088, #4932 and others) Broken by hand: - the two t.Fail = toldFail(other) updates removed: TestToldOverloadIsNotQuota red ("the route says the agent was told a "" failure, want "overloaded": its row reads 529 · quota") - endWord back to last.fail: routing-told-overload red in every engine and language Not tried: a real ChatGPT 529 overload (can't be caused on demand), so the reporter's own path is inferred: several ChatGPT accounts, the last out of its allowance. The middleware passed-over site has no test of its own; it uses the same toldFail. The whole GUI suite and the full go test ./... were not run before the push; the full suite runs after.
102 lines
5.9 KiB
JavaScript
102 lines
5.9 KiB
JavaScript
// Run with Node's test runner and Playwright on the module path; see README.md.
|
|
// danzi002 on Discord: a Codex turn over ChatGPT accounts, the first
|
|
// with its allowance left answering 529 server_is_overloaded, the last
|
|
// out of its allowance. Codex was told the overload, and the request's
|
|
// row read "529 · 额度用尽" (quota used up): the status the overload's,
|
|
// the kind the last try's. The route says the kind of the failure the
|
|
// agent was told (fail), and the row says it: the servers overloaded,
|
|
// not a quota used up.
|
|
const assert = require("node:assert/strict");
|
|
const fs = require("node:fs/promises");
|
|
const path = require("node:path");
|
|
const { test } = require("node:test");
|
|
const { chromium, webkit } = require("playwright");
|
|
|
|
const assets = path.resolve(__dirname, "../assets");
|
|
const now = new Date();
|
|
const day = [now.getFullYear(), now.getMonth() + 1, now.getDate()].map((n) => String(n).padStart(2, "0")).join("-");
|
|
const at = (i) => new Date(now.getTime() - (i + 1) * 60e3).toISOString();
|
|
const said = `Codex: {"message":"Our servers are currently overloaded. Please try again later.","type":"service_unavailable_error","param":null,"code":"server_is_overloaded"}`;
|
|
const a = { id: "codex@a@example.com", provider: "codex", name: "Codex", kind: "account", who: "a@example.com", model: "gpt-5.5" };
|
|
const b = { id: "codex@b@example.com", provider: "codex", name: "Codex", kind: "account", who: "b@example.com", model: "gpt-5.5" };
|
|
const routes = [{
|
|
id: 201, seq: 201, time: at(0), agent: "codex", model: "gpt-5.5", provider: "codex", order: [a, b],
|
|
tries: [
|
|
{ id: a.id, model: a.model, start: at(0), done: true, status: 529, ms: 900, fail: "other", error: said,
|
|
rest: { status: 529, why: "other", by: "cooldown", model: a.model, until: new Date(Date.parse(at(0)) + 30e3).toISOString() } },
|
|
{ id: b.id, model: b.model, start: at(0), done: true, status: 429, ms: 200, fail: "quota", earlier: true,
|
|
error: "Codex: The usage limit has been reached" },
|
|
],
|
|
done: true, status: 529, error: said, fail: "overloaded", ms: 1200,
|
|
}];
|
|
|
|
function serve(lang) {
|
|
const state = { agents: [{ id: "codex", name: "Codex", path: "/test/config.toml", fields: [] }], profiles: [], settings: { lang, theme: "light" } };
|
|
return async (route) => {
|
|
const url = new URL(route.request().url());
|
|
const json = (data) => route.fulfill({ json: data });
|
|
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` });
|
|
if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
|
|
if (url.pathname === "/api/state") return json(state);
|
|
if (url.pathname === "/api/plugins") return json({ plugins: [] });
|
|
if (url.pathname === "/api/gateway/trace") {
|
|
if (url.searchParams.get("wait")) await new Promise((r) => setTimeout(r, 20e3));
|
|
return json({ mine: true, now: now.toISOString(), seq: 1, totals: { requests: 0, rerouted: 0, errors: 0 }, routes: [] });
|
|
}
|
|
if (url.pathname === "/api/gateway/history") {
|
|
const d = url.searchParams.get("day");
|
|
return json({ cut: false, days: [{ day, requests: routes.length }], routes: d ? routes : [] });
|
|
}
|
|
if (url.pathname === "/api/groups") return json({ groups: [] });
|
|
if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true } });
|
|
if (url.pathname.startsWith("/api/")) return json({});
|
|
const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
|
|
const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
|
|
await route.fulfill({ body: await fs.readFile(file), contentType });
|
|
};
|
|
}
|
|
|
|
// busy: the overload's word; quota: the used-up allowance's, which the
|
|
// row must not say
|
|
const want = {
|
|
en: { busy: "servers overloaded", quota: "quota used up" },
|
|
zh: { busy: "服务器过载", quota: "额度用尽" },
|
|
"zh-TW": { busy: "伺服器過載", quota: "額度用盡" },
|
|
ja: { busy: "サーバー過負荷", quota: "クォータ切れ" },
|
|
de: { busy: "Server überlastet", quota: "Kontingent aufgebraucht" },
|
|
};
|
|
|
|
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
|
|
for (const lang of Object.keys(want)) {
|
|
for (const width of [1100, 420]) {
|
|
test(`${engine} ${lang} ${width}: a request told an earlier try's overload reads overloaded, not quota used up`, async (t) => {
|
|
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
|
|
const context = await browser.newContext({ viewport: { width, height: 760 }, reducedMotion: "reduce" });
|
|
const page = await context.newPage();
|
|
page.setDefaultTimeout(5000);
|
|
page.setDefaultNavigationTimeout(60000);
|
|
const errors = [];
|
|
page.on("pageerror", (e) => errors.push(e.message));
|
|
await page.route("**/*", serve(lang));
|
|
t.after(async () => {
|
|
if (process.env.ARTIFACT_DIR) {
|
|
await fs.mkdir(process.env.ARTIFACT_DIR, { recursive: true });
|
|
await page.screenshot({ path: path.join(process.env.ARTIFACT_DIR, `${engine}-${lang}-${width}-told-overload.png`), fullPage: true });
|
|
}
|
|
await browser.close();
|
|
});
|
|
await page.goto("http://magpie.test/?view=routing");
|
|
await page.locator(".rt-days .rt-day").nth(1).click();
|
|
const row = page.locator(".rt-req").first();
|
|
await row.waitFor();
|
|
const w = want[lang];
|
|
const text = await row.textContent();
|
|
assert(text.includes("529") && text.includes(w.busy), text);
|
|
assert(!text.includes(w.quota), text);
|
|
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true, "the page scrolls sideways");
|
|
assert.deepEqual(errors, []);
|
|
});
|
|
}
|
|
}
|
|
}
|