From 14f6d10de086a4d0b74d4a82d16fa1fa6a30f543 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 4 Nov 2026 18:13:40 +0800 Subject: [PATCH] routing: a remote's Claude card whose read failed says so on its row, not nothing (yi_time on Discord) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remoteWinsOf (c7bbd3faf) drew a Remote magpie row's windows from the remote's cards. It said "Allowance unavailable" only when the remote's own card failed. When the remote answered but its Claude card there carried an error (the remote's own Claude read failed), the Usage page showed that card and its reason, while Routing's row showed nothing. The row now takes the error of the card of its own family (Claude's on a claude row, Codex's on a gpt/codex row), with the reason on hover. The remote's own card still comes first. The plugin's file only; no core bytes. Run (mote, worktree on origin/main 69eb93e0a plus 607f8b43a): - routing-remote-windows.test.cjs (a new remote "elm", its model named as a remote really names it, claude/claude-opus-5, its Claude card erroring and its Codex card erroring otherwise) and routing-account-windows.test.cjs, 5 languages, 1100 and 420px, chromium and webkit: 44 pass, 0 fail. - Broken by hand: the new fallback removed made routing-remote-windows go 0 pass, 22 fail. - Real two-magpie repro (see 607f8b43a): with A's key held, B's Routing row says "Allowance unavailable — hover for why", the held reason on hover; with Quotas on, 5 hours 40% · 7 days 12%. Not tried: yi_time's own setup, which this may not be. Their Routing report came before v0.1.2908 (c7bbd3faf) was published at 07:08 UTC on 11-04; a Windows magpie older than that draws no remote windows on Routing at all. Not tried in WebView2 or WebKitGTK. --- docs/subsystems/gui-shell.md | 6 ++++-- internal/gui/assets/plugins/routing/client.js | 6 ++++-- .../gui/tests/routing-remote-windows.test.cjs | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md index 02c36cbd1..81907936b 100644 --- a/docs/subsystems/gui-shell.md +++ b/docs/subsystems/gui-shell.md @@ -224,8 +224,10 @@ whose provider id is the remote's, a slash and the card's. The computer that holds the account tells its usage; this one reads nothing new. A Claude model's row is told Claude's cards alone and a ChatGPT model's Codex's; with more than one card the account's user leads each window. A -remote whose read failed shows "Allowance unavailable" with the reason on -hover, never a figure. See `routing-remote-windows.test.cjs`. +remote whose read failed, or whose card of the row's family failed there +(the remote read, its Claude's read didn't), shows "Allowance unavailable" +with the reason on hover, never a figure and never nothing; a remote that +holds this computer's key tells why the same way (`errRemoteHeld`). See `routing-remote-windows.test.cjs`. The refresh beside the Accounts and keys heading (`#rtReadAllowances`, #1834) reads them again by hand: `loadQuotas(true)`, the asked read the diff --git a/internal/gui/assets/plugins/routing/client.js b/internal/gui/assets/plugins/routing/client.js index 96e018cc8..5f88090e6 100644 --- a/internal/gui/assets/plugins/routing/client.js +++ b/internal/gui/assets/plugins/routing/client.js @@ -4201,8 +4201,10 @@ function routingPage(part) { const mine = quotas.filter((q) => q.from && q.kind === "subscription" && (q.provider === w.provider || q.provider.startsWith(w.provider + "/"))); const cards = mine.filter((q) => q.provider !== w.provider && !q.error && q.windows?.length && (!fam || q.provider === w.provider + "/" + fam)); if (!cards.length) { - // the remote's own card, saying why nothing was read from it - const bad = mine.find((q) => q.provider === w.provider && q.error); + // the remote's own card, saying why nothing was read from it, or + // the account's card there saying its read failed (Usage shows it) + const bad = mine.find((q) => q.provider === w.provider && q.error) + || mine.find((q) => q.provider !== w.provider && q.error && (!fam || q.provider === w.provider + "/" + fam)); return bad ? [{ text: t("Allowance unavailable — hover for why"), title: bad.error }] : []; } const out = []; diff --git a/internal/gui/tests/routing-remote-windows.test.cjs b/internal/gui/tests/routing-remote-windows.test.cjs index e890a5fd5..ea58deeb4 100644 --- a/internal/gui/tests/routing-remote-windows.test.cjs +++ b/internal/gui/tests/routing-remote-windows.test.cjs @@ -3,7 +3,8 @@ // windows in Routing's Accounts and keys like a local account does, as the // computer that holds the account read them: the Usage page's cards with // `from`. Claude's row is told Claude's cards, not Codex's; a remote whose -// read failed says the allowance is unavailable, never 0. In every +// read failed, or whose Claude card did, says the allowance is unavailable, +// never 0. In every // language, at a window's width and at 420px, in both engines. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); @@ -15,7 +16,8 @@ const assets = path.resolve(__dirname, "../assets"); const now = Date.now(); const iso = (ms) => new Date(ms).toISOString(); const remote = (id, name, model) => ({ id: id + "-k", provider: id, name, preset: "remote-magpie", icon: "magpie", kind: "provider", model, known: false }); -const accts = [remote("home", "Home", "claude-opus-5"), remote("den", "Den", "claude-opus-5")]; +// elm's model as a remote names it, its provider there first +const accts = [remote("home", "Home", "claude-opus-5"), remote("den", "Den", "claude-opus-5"), remote("elm", "Elm", "claude/claude-opus-5")]; const route = { id: 7, seq: 7, time: iso(now - 2000), agent: "claude", model: "claude-opus-5", provider: "home", done: true, status: 200, ms: 900, tokens: 1500, order: accts, tries: [{ id: "home-k", model: "claude-opus-5", start: iso(now - 2000), done: true, ms: 800, status: 200 }], @@ -27,6 +29,10 @@ const cards = [ ] }, { provider: "home/codex", name: "Codex · Home", kind: "subscription", user: "c@example.com", from: "Home", windows: [{ name: "5 hours", used: 77 }] }, { provider: "den", name: "Den", icon: "magpie", kind: "subscription", from: "Den", windows: [], error: "couldn't reach the remote magpie: connection refused" }, + // the remote read, its Claude card didn't: the Usage page shows why, so does Routing + { provider: "elm", name: "Elm", icon: "magpie", kind: "subscription", from: "Elm", windows: [] }, + { provider: "elm/claude", name: "Claude · Elm", kind: "subscription", user: "e@example.com", from: "Elm", windows: [], error: "Claude's usage read was rate limited" }, + { provider: "elm/codex", name: "Codex · Elm", kind: "subscription", user: "e@example.com", from: "Elm", windows: [], error: "codex is signed out" }, ]; function serve(lang, asks) { @@ -79,12 +85,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.goto("http://magpie.test/?view=routing"); await page.locator(".rt-act .wins span").first().waitFor(); const rows = page.locator(".rt-act"); - const denRow = rows.nth(0), homeRow = rows.nth(1); // listed by name + const denRow = rows.nth(0), elmRow = rows.nth(1), homeRow = rows.nth(2); // listed by name // Claude's windows only: Codex's 77% on the same remote is not on Claude's row assert.deepEqual(await homeRow.locator(".wins span").allTextContents(), words[lang].wins); // a failed read is unknown, with the reason on hover, never a figure assert.deepEqual(await denRow.locator(".wins span").allTextContents(), [words[lang].unknown]); assert.match(await denRow.locator(".wins span").getAttribute("title"), /connection refused/); + // its Claude card's failed read, not its Codex's, on Claude's row + assert.deepEqual(await elmRow.locator(".wins span").allTextContents(), [words[lang].unknown]); + assert.match(await elmRow.locator(".wins span").getAttribute("title"), /rate limited/); const over = await homeRow.evaluate((e) => Math.max(e.scrollWidth - e.clientWidth, document.documentElement.scrollWidth - innerWidth)); assert.ok(over <= 1, `${lang} at ${width}: ${over}px past`); assert.ok(asks.every((s) => !s.includes("asked")), "never an asked read: " + asks.join(", "));