Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

usage: opening the page on Requests or Sessions asks no vendor for allowances (#4064)

yetoneff6fdffd6047
diff --git a/internal/gui/assets/plugins/usage/page.js b/internal/gui/assets/plugins/usage/page.js
index bef94de5f..ffe931214 100644
--- a/internal/gui/assets/plugins/usage/page.js
+++ b/internal/gui/assets/plugins/usage/page.js
@@ -125,7 +125,10 @@ let usageRead = 0;
async function loadUsage(asked) {
renderUsageTab();
renderUsageEvery(); // the refresh's tooltip says what it reads on this tab
- if (asked) quotasOpened();
+ // only the Overview shows the allowances: the page opened on another
+ // tab asks no vendor, nor reads their history, beside its own read and
+ // the page's way in (#4064)
+ if (asked && usageTab === "usage") quotasOpened();
if (usageTab === "sessions") return loadSessions();
if (usageTab === "requests") return loadLedger();
if (usageTab === "context") return window.loadContext?.();
diff --git a/internal/gui/tests/allowance-open-read.test.cjs b/internal/gui/tests/allowance-open-read.test.cjs
index ab89bfde6..b69d2c56d 100644
--- a/internal/gui/tests/allowance-open-read.test.cjs
+++ b/internal/gui/tests/allowance-open-read.test.cjs
@@ -32,7 +32,7 @@ function serve(lang, acct) {
return json([{ provider: "codex", name: "Codex", user: "[email protected]", plan: "plus",
windows: [{ name: "5 hours", used: acct.kept, resetsAt: "2030-01-01T00:00:00Z" }] }]);
}
- if (url.pathname === "/api/usage/quotas/history") return json([]);
+ if (url.pathname === "/api/usage/quotas/history") { acct.hist++; return json([]); }
if (url.pathname === "/api/usage") return json({ calls: 1, input: 100, output: 10, cost: 0.01, series: [], agents: [], models: [] });
if (url.pathname === "/api/groups") return json({ groups: [], models: [] });
if (url.pathname === "/api/plugins") return json({ plugins: [] });
@@ -45,7 +45,7 @@ function serve(lang, acct) {
}
async function open(browser, t, surface, lang) {
- const acct = { reads: [], kept: 10, vendor: 40, hold: null };
+ const acct = { reads: [], kept: 10, vendor: 40, hold: null, hist: 0 };
const errors = [];
const context = await browser.newContext({ viewport: surface === "panel" ? { width: 360, height: 640 } : { width: 1000, height: 760 }, reducedMotion: "reduce" });
t.after(() => context.close());
@@ -116,6 +116,23 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await shows(80);
assert.equal(asked(), m + 1, `the Overview picked asks: ${acct.reads}`);
+ // the page opened from the nav on the Requests tab asks nothing, nor
+ // reads the allowances' history (#4064)
+ await page.locator(":is(#usageTab .opt, .nav-s):visible").nth(1).click();
+ await nav("agents");
+ await page.clock.fastForward(31e3);
+ await settle();
+ const r = asked(), hist = acct.hist;
+ await nav("usage");
+ await page.locator("#ledgerPane").waitFor();
+ await settle();
+ assert.equal(asked(), r, `Usage opened on Requests asks nothing: ${acct.reads}`);
+ assert.equal(acct.hist, hist, "nor reads the allowances' history");
+ acct.vendor = 85;
+ await page.locator(":is(#usageTab .opt, .nav-s):visible").first().click();
+ await shows(85);
+ assert.equal(asked(), r + 1, `then the Overview picked asks: ${acct.reads}`);
+
// the timed refresh, left alone for minutes, never asks
const k = asked();
for (let i = 0; i < 4; i++) { await page.clock.fastForward(61e3); await settle(); }