diff --git a/pm-stack/aggregator/scripts/collect-fleet-feed.ts b/pm-stack/aggregator/scripts/collect-fleet-feed.ts index cd12c291db..a09314e4c3 100644 --- a/pm-stack/aggregator/scripts/collect-fleet-feed.ts +++ b/pm-stack/aggregator/scripts/collect-fleet-feed.ts @@ -318,12 +318,15 @@ function poolFor(provider: string, model: string): string | null { case "_claude": return "anthropic:claude-pro"; case "openai": - case "openai-codex": - case "chatgpt": + case "_openai": + case "_openai.main": + case "codex": // Keep aligned with the pool IDs in ../src/quota-extract.ts; matching below is exact. - return "openai.main"; - case "openai.alternate": - return "openai.alternate"; + // ("codex" is the pre-rename fork quota id, fork PR #2261; a row + // still stamped with it files under the renamed pool.) + return "_openai.main"; + case "_openai.alt": + return "_openai.alt"; case "cline-pass": return "cline-pass"; case "opendesign": diff --git a/pm-stack/aggregator/scripts/gather-quota.ts b/pm-stack/aggregator/scripts/gather-quota.ts index adf7347b7c..13158ad127 100755 --- a/pm-stack/aggregator/scripts/gather-quota.ts +++ b/pm-stack/aggregator/scripts/gather-quota.ts @@ -388,10 +388,10 @@ function finalizeRun(id: string, entries: QuotaCurrentEntry[], t0: number): Prov ms: Date.now() - t0, entries, // A partially-failed run still surfaces its first failure: a - // folded provider (codex answers one row per OpenAI credential) + // folded provider (_openai answers one row per OpenAI credential) // must not let one credential's ok row hide a sibling credential's - // error from the heartbeat — 2026-11-10 the codex run read "ok" - // with no error while the openai.main and _openai credentials were + // error from the heartbeat — 2026-11-10 the _openai run read "ok" + // with no error while the main and self-contained credentials were // both failing token_expired at the provider. ...(firstFailure?.error ? { error: firstFailure.error } : {}), }; diff --git a/pm-stack/aggregator/src/aa.ts b/pm-stack/aggregator/src/aa.ts index 1fddb2d443..c7a5655c8f 100644 --- a/pm-stack/aggregator/src/aa.ts +++ b/pm-stack/aggregator/src/aa.ts @@ -644,10 +644,15 @@ export const AA_PLAN_FACTS: Record = { multiplier: null, note: "OpenAI plan quota — the fleet's final reserve, spent last by design.", }, - "openai.alternate": { + "_openai.alt": { plan: "ChatGPT plan (student)", multiplier: null, - note: "Second ChatGPT account door; resolves through the fork's built-in catalog.", + note: "Second ChatGPT account door (popesdrew, self-contained _openai instance; renamed from openai.alternate 2026-11-10, code#8163).", + }, + "_openai.main": { + plan: "ChatGPT plan", + multiplier: null, + note: "Main ChatGPT account door (drewrypope, self-contained _openai instance; renamed from openai.main 2026-11-10, code#8163).", }, "_claude": { plan: "Claude plan", diff --git a/pm-stack/aggregator/src/quota-extract.ts b/pm-stack/aggregator/src/quota-extract.ts index e664d2c5df..dbb7adb2a6 100644 --- a/pm-stack/aggregator/src/quota-extract.ts +++ b/pm-stack/aggregator/src/quota-extract.ts @@ -12,10 +12,10 @@ // assistant's Power subscription is never a pool, so no extractor here // emits either. // exactly TWO ChatGPT pools — the main account (drewrypope) reached -// through the `codex` gatherer door (pool openai.main) and the -// alternate account (popesdrew) through the `openai.alternate` door -// (pool openai.alternate). Separate accounts, separate allowances: -// never collapse them into one pool. +// through the `_openai.main` door and the alternate account +// (popesdrew) through the `_openai.alt` door. Separate accounts, +// separate allowances: never collapse them into one pool. (Pool ids +// renamed to the door ids 2026-11-10, code#8163 — see POOL NAMING.) import { poolState } from "./derive.ts"; import type { QuotaPool, QuotaWindow } from "./model.ts"; import { parseIsoDate } from "./validate.ts"; @@ -247,7 +247,7 @@ const extractCodex: Extractor = (s, now) => { /** * The alternate ChatGPT account (popesdrew). It has no dated-read * section in the stewardship view yet — its live windows arrive - * through the quota gatherer (the openai.alternate credential) and + * through the quota gatherer (the _openai.alt credential) and * are overlaid onto this pool by overlayQuotaCurrent. The extractor * exists so a future "### ChatGPT (Alternate)" section is picked up * like every other pool's dated read; until then it fail-softs to @@ -504,8 +504,8 @@ interface PoolSpec { } // POOL NAMING (2026-11-03, Drew): a pool's id is its OpenCode config -// provider id whenever the config defines one — meta, openai.main, -// openai.alternate, opencode-go.drewrypope, opencode-go.popesdrew, +// provider id whenever the config defines one — meta, _openai.main, +// _openai.alt, opencode-go.drewrypope, opencode-go.popesdrew, // opencode-go.developing-today-0, cline-pass, // opendesign, deepseek, commandcode. The colon-suffixed spellings these // replaced (meta:high-usage, openai:codex, opencode-go:drewrypope, ...) @@ -523,7 +523,11 @@ interface PoolSpec { // the Antigravity pools ride under _antigravity.gemini / // _antigravity.claude-gpt. Per the rule above, each starts a NEW // snapshot series; the pre-rename series stay in the store under -// their old ids, unrewritten. +// their old ids, unrewritten. (2026-11-10, code#8163, Drew: "update +// all old names to use equivalent new names": the two ChatGPT pools +// follow the same rule — openai.main -> _openai.main and +// openai.alternate -> _openai.alt, the self-contained door ids; the +// pre-rename series stay in the store under the old ids.) // choice: the deployed config defines antigravity-agy, // antigravity-direct and antigravity-ls (ls/agy are the disabled // legacy doors; no antigravity-local provider exists), and @@ -551,7 +555,7 @@ export const POOL_SPECS: PoolSpec[] = [ shellNote: "No current read (console-only usage).", }, { - id: "openai.main", + id: "_openai.main", provider: "OpenAI", plan: "ChatGPT (Main — drewrypope)", heading: /^### ChatGPT(?! \(Alternate\))/, @@ -559,13 +563,13 @@ export const POOL_SPECS: PoolSpec[] = [ shellNote: "No current read. OpenAI is the fleet's final reserve pool.", }, { - id: "openai.alternate", + id: "_openai.alt", provider: "OpenAI", plan: "ChatGPT (Alternate — popesdrew)", heading: /^### ChatGPT \(Alternate\)/, extract: extractChatGptAlternate, shellNote: - "No dated read. The fleet's second ChatGPT account (popesdrew), measured live by the quota gatherer through the openai.alternate credential — a separate pool from the main account (openai.main); the two are never combined.", + "No dated read. The fleet's second ChatGPT account (popesdrew), measured live by the quota gatherer through the _openai.alt credential — a separate pool from the main account (_openai.main); the two are never combined.", }, { id: "opencode-go.drewrypope", diff --git a/pm-stack/aggregator/src/quota-gather-map.ts b/pm-stack/aggregator/src/quota-gather-map.ts index ce5fc1db79..a3a2e05690 100644 --- a/pm-stack/aggregator/src/quota-gather-map.ts +++ b/pm-stack/aggregator/src/quota-gather-map.ts @@ -91,8 +91,8 @@ export function serviceIdFor(providerId: string): string { case "claude": case "_claude": return "anthropic:claude-pro"; - case "codex": - return "openai.main"; + case "_openai": + return "_openai.main"; case "cline-pass": return "cline-pass"; case "command-code": @@ -121,13 +121,16 @@ export function serviceIdFor(providerId: string): string { * (#1823, 2026-11-07): antigravity -> _antigravity, the claude-code door * (module: "claude") -> _claude, commandcode (module: "command-code") * -> _commandcode, and the muse-direct door (module: "meta", the Muse - * Code High Usage reading) -> _muse. Normalize here, at the one mapping + * Code High Usage reading) -> _muse. The OpenAI quota door (module: + * "codex" before fork PR #2261) -> _openai by the same rule (2026-11-10, + * code#8163). Normalize here, at the one mapping * point every gathered result passes through. Pool/service ids are a * separate contract and stay put: serviceIdFor carries the dual-spelling * cases (both "claude" and "_claude" land on anthropic:claude-pro, and * "_muse" keeps the "meta" pool). */ const CANONICAL_PROVIDER_IDS: Readonly> = { + codex: "_openai", antigravity: "_antigravity", claude: "_claude", "command-code": "_commandcode", @@ -162,35 +165,41 @@ export const ANTIGRAVITY_CLAUDE_GPT_SERVICE_ID = "_antigravity.claude-gpt"; export const ANTIGRAVITY_LEGACY_GEMINI_SERVICE_ID = "antigravity-direct.gemini"; export const ANTIGRAVITY_LEGACY_CLAUDE_GPT_SERVICE_ID = "antigravity-direct.claude-gpt"; -export const OPENAI_MAIN_SERVICE_ID = "openai.main"; -export const OPENAI_ALTERNATE_SERVICE_ID = "openai.alternate"; -export const OPENAI_SELF_SERVICE_ID = "_openai"; +export const OPENAI_MAIN_SERVICE_ID = "_openai.main"; +export const OPENAI_ALTERNATE_SERVICE_ID = "_openai.alt"; +export const OPENAI_SELF_SERVICE_ID = "_openai.main"; /** - * Which OpenAI pool a folded `codex` entry belongs to, from the + * Which OpenAI pool a folded `_openai` entry belongs to, from the * credential's human label / the instance name the fork stamps on the - * folded result. The fork's codex provider folds every OpenAI instance - * credential (openai.main, openai.alternate, _openai) into its - * per-credential answer under the bare provider id "codex" - * (foldInstanceCredentials), and serviceIdFor historically filed ALL - * of those rows under "openai.main" — so the alternate account's 5h - * window landed in the snapshot store as openai.main|5h (its values - * mirror openai.alternate|5h tick-for-tick in usage-2026-11.jsonl) - * and its weekly competed under main's key in the #1624 max-collapse + * folded result. The fork's _openai provider folds every OpenAI instance + * credential into its per-credential answer under the bare provider id + * "_openai" (foldInstanceCredentials), and serviceIdFor historically + * filed ALL of those rows under the main pool — so the alternate + * account's 5h window landed in the snapshot store under main's key + * (its values mirror the alternate series tick-for-tick) and its + * weekly competed under main's key in the #1624 max-collapse * (2026-11-04: main|weekly published 100 with the ALTERNATE window's * reset label while main's own read was ~17). Like goPoolServiceId, * the label is the only stable gatherer-side signal: instance ids are * config names, credential ids are opaque row ids the mapping would - * have to hardcode. Unmatched entries yield null and keep the - * historical fallback (serviceIdFor: openai.main, the base provider's - * own pool) — never a fabricated pool row. + * have to hardcode. Unmatched entries yield null and keep the fallback + * (serviceIdFor: _openai.main, the base provider's own pool) — never a + * fabricated pool row. + * + * Service ids are the door ids (Drew, 2026-11-10, code#8163): + * _openai.main (drewrypope) and _openai.alt (popesdrew). The + * pre-rename ids (openai.main / openai.alternate) survive only in the + * historical snapshot series, unrewritten; the dedicated _openai door + * and the openai.main instance are the same account, so their rows + * file together under _openai.main. */ -export function codexPoolServiceId(entry: { +export function openaiPoolServiceId(entry: { credentialLabel?: string | null; providerName?: string | null; }): string | null { const text = `${entry.credentialLabel ?? ""} ${entry.providerName ?? ""}`.toLowerCase(); - if (text.includes("alternate")) return OPENAI_ALTERNATE_SERVICE_ID; + if (text.includes("alternate") || text.includes("_openai.alt")) return OPENAI_ALTERNATE_SERVICE_ID; if (text.includes("_openai") || text.includes("self-contained") || text.includes("self contained")) return OPENAI_SELF_SERVICE_ID; if (text.includes("main")) return OPENAI_MAIN_SERVICE_ID; @@ -462,13 +471,13 @@ export function entryFromResult(result: QuotaProviderResult, tickIso: string): Q ? "error" : "unconfigured"; const providerId = canonicalProviderId(result.providerId); - // Folded codex rows carry one credential per OpenAI instance; file - // each under its own pool (codexPoolServiceId) instead of the base + // Folded _openai rows carry one credential per OpenAI instance; file + // each under its own pool (openaiPoolServiceId) instead of the base // provider's pool, or a sibling account's windows contaminate - // openai.main's rows and snapshot series. + // _openai.main's rows and snapshot series. const serviceId = - providerId === "codex" - ? (codexPoolServiceId({ credentialLabel: result.credentialLabel, providerName: result.providerName }) ?? + providerId === "_openai" + ? (openaiPoolServiceId({ credentialLabel: result.credentialLabel, providerName: result.providerName }) ?? serviceIdFor(providerId)) : serviceIdFor(providerId); const entry: QuotaCurrentEntry = { diff --git a/pm-stack/aggregator/src/snapshot-records.ts b/pm-stack/aggregator/src/snapshot-records.ts index a13c75de98..d32b653fdb 100644 --- a/pm-stack/aggregator/src/snapshot-records.ts +++ b/pm-stack/aggregator/src/snapshot-records.ts @@ -307,7 +307,7 @@ export function recordsFromProviderUsage(snap: unknown, observedBy: string): Sna if (!metricId) return; out.push({ ts, - serviceId: "openai.main", + serviceId: "_openai.main", metricId, value: usedPercent, unit: "pct", diff --git a/pm-stack/aggregator/test/provider-display.test.ts b/pm-stack/aggregator/test/provider-display.test.ts index d96be4ac9a..3a4d258a53 100644 --- a/pm-stack/aggregator/test/provider-display.test.ts +++ b/pm-stack/aggregator/test/provider-display.test.ts @@ -36,16 +36,16 @@ describe("providerDisplayNames (#6125)", () => { }); test("non-direct names are untouched", () => { - const names = providerDisplayNames(["mistral", "openai.main", "cline-pass", "direct"]); + const names = providerDisplayNames(["mistral", "_openai.main", "cline-pass", "direct"]); expect(names.get("mistral")).toBe("mistral"); - expect(names.get("openai.main")).toBe("openai.main"); + expect(names.get("_openai.main")).toBe("openai.main"); // Rule 0 (#1823): display strips the leading underscore expect(names.get("cline-pass")).toBe("cline-pass"); expect(names.get("direct")).toBe("direct"); }); test("a base provider present only as a dotted sibling still blocks stripping", () => { - // "openai.main" is a non-direct openai provider in the set. - const names = providerDisplayNames(["openai.main", "openai-direct"]); + // "_openai.main" is a non-direct openai provider in the set. + const names = providerDisplayNames(["_openai.main", "openai-direct"]); expect(names.get("openai-direct")).toBe("openai-direct"); }); diff --git a/pm-stack/aggregator/test/quota-current.test.ts b/pm-stack/aggregator/test/quota-current.test.ts index 38b6f4c60d..9f09e84a09 100644 --- a/pm-stack/aggregator/test/quota-current.test.ts +++ b/pm-stack/aggregator/test/quota-current.test.ts @@ -748,23 +748,23 @@ describe("stale-path newest pick is finite-gated (#2253)", () => { }); }); -describe("overlay: alternate ChatGPT pool (openai.alternate)", () => { +describe("overlay: alternate ChatGPT pool (_openai.alt)", () => { test("gatherer windows land on the alternate pool, never on the main pool", () => { const view = baseView(); - view.pools.push(pool("openai.alternate", [])); + view.pools.push(pool("_openai.alt", [])); const out = overlayQuotaCurrent( view, file([ entry({ - providerId: "openai.alternate", - serviceId: "openai.alternate", + providerId: "_openai.alt", + serviceId: "_openai.alt", credentialLabel: "OpenAI Alternate (Student - popesdrew)", windows: [win("5h", 100, iso(5 * 60_000)), win("weekly", 42, iso(5 * 60_000))], }), ]), NOW, ); - const alt = out.pools.find((p) => p.id === "openai.alternate")!; + const alt = out.pools.find((p) => p.id === "_openai.alt")!; expect(alt.windows.map((w) => [w.name, w.percent])).toEqual([ ["5-hour", 100], ["weekly", 42], diff --git a/pm-stack/aggregator/test/quota-gather-map.test.ts b/pm-stack/aggregator/test/quota-gather-map.test.ts index a407147ac6..d3b6b83989 100644 --- a/pm-stack/aggregator/test/quota-gather-map.test.ts +++ b/pm-stack/aggregator/test/quota-gather-map.test.ts @@ -12,7 +12,7 @@ import { entryFromFileExport, entryFromTurso, entryFromResult, - codexPoolServiceId, + openaiPoolServiceId, goPoolServiceId, lastKnownEntries, mapWithConcurrency, @@ -600,7 +600,7 @@ describe("entryFromFileExport (Meta #1301 convention)", () => { describe("serviceIdFor", () => { test("known pools map to hub ids; others pass through", () => { - expect(serviceIdFor("codex")).toBe("openai.main"); + expect(serviceIdFor("_openai")).toBe("_openai.main"); expect(serviceIdFor("deepseek")).toBe("deepseek"); expect(serviceIdFor("meta")).toBe("meta"); expect(serviceIdFor("_muse")).toBe("meta"); @@ -610,7 +610,7 @@ describe("serviceIdFor", () => { // the read filed under a key no pool carries and never landed // (the silent-mismatch family Drew ruled out, 2026-11-03). expect(serviceIdFor("command-code")).toBe("commandcode"); - expect(serviceIdFor("openai.alternate")).toBe("openai.alternate"); + expect(serviceIdFor("_openai.alt")).toBe("_openai.alt"); }); }); @@ -1176,7 +1176,7 @@ describe("canonicalProviderId (config-id alignment, #1823)", () => { expect(canonicalProviderId("meta")).toBe("_muse"); expect(canonicalProviderId("_antigravity")).toBe("_antigravity"); expect(canonicalProviderId("opendesign")).toBe("opendesign"); - expect(canonicalProviderId("codex")).toBe("codex"); + expect(canonicalProviderId("codex")).toBe("_openai"); }); test("entryFromResult emits the canonical id and keeps the pool service id", () => { @@ -1233,7 +1233,7 @@ describe("canonicalProviderId (config-id alignment, #1823)", () => { }); }); -describe("codexPoolServiceId — folded codex rows file under their own OpenAI pool", () => { +describe("openaiPoolServiceId — folded _openai rows file under their own OpenAI pool", () => { const TICK = "2026-11-10T21:30:00.000Z"; const win = (usedPercent: number, windowSeconds: number) => ({ usedPercent, @@ -1241,12 +1241,12 @@ describe("codexPoolServiceId — folded codex rows file under their own OpenAI p windowSeconds, resetAt: 1794364348000, }); - const codexResult = ( + const foldedResult = ( // the fork's folded OpenAI quota answer (providerId "_openai" since fork PR #2261; "codex" before) credentialLabel: string | undefined, providerName: string, windows: Record>, ): QuotaProviderResult => ({ - providerId: "codex", + providerId: "_openai", providerName, ok: true, configured: true, @@ -1258,7 +1258,7 @@ describe("codexPoolServiceId — folded codex rows file under their own OpenAI p test("each instance credential lands on its own serviceId", () => { const alt = entryFromResult( - codexResult("OpenAI Alternate (Student - popesdrew)", "OpenAI Alternate (Student - popesdrew)", { + foldedResult("OpenAI Alternate (Student - popesdrew)", "OpenAI Alternate (Student - popesdrew)", { "5h": win(42, 18_000), weekly: win(65, 604_800), }), @@ -1266,12 +1266,12 @@ describe("codexPoolServiceId — folded codex rows file under their own OpenAI p ); expect(alt.serviceId).toBe(OPENAI_ALTERNATE_SERVICE_ID); const main = entryFromResult( - codexResult("OpenAI Main (drewrypope)", "OpenAI Main (drewrypope)", { weekly: win(100, 604_800) }), + foldedResult("OpenAI Main (drewrypope)", "OpenAI Main (drewrypope)", { weekly: win(100, 604_800) }), TICK, ); expect(main.serviceId).toBe(OPENAI_MAIN_SERVICE_ID); const self = entryFromResult( - codexResult("OpenAI (_openai, drewrypope) — self-contained", "OpenAI Self-Contained (drewrypope, no Codex)", { + foldedResult("OpenAI (_openai, drewrypope) — self-contained", "OpenAI Self-Contained (drewrypope, no Codex)", { weekly: win(100, 604_800), }), TICK, @@ -1279,16 +1279,30 @@ describe("codexPoolServiceId — folded codex rows file under their own OpenAI p expect(self.serviceId).toBe(OPENAI_SELF_SERVICE_ID); }); - test("unmatched folded rows keep the historical openai.main fallback; codexPoolServiceId is null", () => { - expect(codexPoolServiceId({ credentialLabel: undefined, providerName: "Codex" })).toBeNull(); - expect(codexPoolServiceId({ credentialLabel: "some future account", providerName: "Codex" })).toBeNull(); - const bare = entryFromResult(codexResult(undefined, "Codex", { weekly: win(10, 604_800) }), TICK); - expect(bare.serviceId).toBe("openai.main"); + test("unmatched folded rows keep the _openai.main fallback; openaiPoolServiceId is null", () => { + expect(openaiPoolServiceId({ credentialLabel: undefined, providerName: "OpenAI" })).toBeNull(); + expect(openaiPoolServiceId({ credentialLabel: "some future account", providerName: "OpenAI" })).toBeNull(); + const bare = entryFromResult(foldedResult(undefined, "OpenAI", { weekly: win(10, 604_800) }), TICK); + expect(bare.serviceId).toBe("_openai.main"); }); - test("recordsFromEntries: the alternate account's 5h never enters openai.main's series", () => { + test("a pre-rename fork answer (providerId codex) still files under the new ids", () => { + const legacy = entryFromResult( + { ...foldedResult("OpenAI Alternate (Student - popesdrew)", "OpenAI Alternate (Student - popesdrew)", { weekly: win(65, 604_800) }) }, + TICK, + ); + expect(legacy.serviceId).toBe("_openai.alt"); + const legacyRaw = entryFromResult( + { ...foldedResult("OpenAI Alternate (Student - popesdrew)", "OpenAI Alternate (Student - popesdrew)", { weekly: win(65, 604_800) }), providerId: "codex" }, + TICK, + ); + expect(legacyRaw.providerId).toBe("_openai"); + expect(legacyRaw.serviceId).toBe("_openai.alt"); + }); + + test("recordsFromEntries: the alternate account's 5h never enters _openai.main's series", () => { const alt = entryFromResult( - codexResult("OpenAI Alternate (Student - popesdrew)", "OpenAI Alternate (Student - popesdrew)", { + foldedResult("OpenAI Alternate (Student - popesdrew)", "OpenAI Alternate (Student - popesdrew)", { "5h": win(42, 18_000), weekly: win(65, 604_800), }), @@ -1296,7 +1310,7 @@ describe("codexPoolServiceId — folded codex rows file under their own OpenAI p ); const mainDedicated = entryFromResult( { - providerId: "openai.main", + providerId: "_openai.main", providerName: "OpenAI Main (drewrypope)", ok: true, configured: true, @@ -1309,9 +1323,9 @@ describe("codexPoolServiceId — folded codex rows file under their own OpenAI p ); const { records } = recordsFromEntries([alt, mainDedicated], new Map(), "quota-gatherer"); const byKey = new Map(records.map((r) => [`${r.serviceId}|${r.metricId}`, r.value])); - expect(byKey.get("openai.alternate|5h")).toBe(42); - expect(byKey.has("openai.main|5h")).toBe(false); - expect(byKey.get("openai.main|weekly")).toBe(100); - expect(byKey.get("openai.alternate|weekly")).toBe(65); + expect(byKey.get("_openai.alt|5h")).toBe(42); + expect(byKey.has("_openai.main|5h")).toBe(false); + expect(byKey.get("_openai.main|weekly")).toBe(100); + expect(byKey.get("_openai.alt|weekly")).toBe(65); }); }); diff --git a/pm-stack/aggregator/test/quota.test.ts b/pm-stack/aggregator/test/quota.test.ts index b3760accaf..323cebf400 100644 --- a/pm-stack/aggregator/test/quota.test.ts +++ b/pm-stack/aggregator/test/quota.test.ts @@ -73,7 +73,7 @@ describe("quota extractors", () => { }); test("codex 7-day read", () => { - const p = byId.get("openai.main")!; + const p = byId.get("_openai.main")!; expect(p.windows[0].percent).toBe(11); expect(p.windows[0].resetsAt).toBe("2026-10-30T18:01:00.000Z"); }); @@ -81,7 +81,7 @@ describe("quota extractors", () => { test("month-based resets normalize month case and preserve reads for invalid dates across extractors", () => { const consumers = [ { - id: "openai.main", + id: "_openai.main", view: (reset: string) => `\n### ChatGPT — main account plans\n7-day 42% used; resets ${reset}, 18:01 UTC.\n`, window: { name: "7-day", percent: 42 }, extraWindows: 0, @@ -126,7 +126,7 @@ describe("quota extractors", () => { const pastDate = "Sep 24"; const cases = [ { - id: "openai.main", + id: "_openai.main", view: `\n### ChatGPT — main account plans\n7-day 42% used; resets ${pastDate}, 18:01 UTC.\n`, }, { @@ -145,7 +145,7 @@ describe("quota extractors", () => { }); test("alternate ChatGPT account is its own pool — never merged into the main pool", () => { - const p = byId.get("openai.alternate")!; + const p = byId.get("_openai.alt")!; expect(p).toBeDefined(); expect(p.provider).toBe("OpenAI"); // This view has no "### ChatGPT (Alternate)" dated-read section, so @@ -159,8 +159,8 @@ describe("quota extractors", () => { const altSection = "### ChatGPT (Alternate)\n- 7-day 42% used.\n"; for (const view of ["\n" + altSection + "\n" + mainSection, "\n" + mainSection + "\n" + altSection]) { const m = new Map(extractQuotaPools(view, NOW).map((p) => [p.id, p])); - expect(m.get("openai.main")!.windows[0].percent).toBe(11); - expect(m.get("openai.alternate")!.windows[0].percent).toBe(42); + expect(m.get("_openai.main")!.windows[0].percent).toBe(11); + expect(m.get("_openai.alt")!.windows[0].percent).toBe(42); } }); @@ -359,7 +359,7 @@ describe("windowPercent + guidance", () => { const pools = extractQuotaPools(VIEW, NOW); const choices = computeChoices(pools, NOW.getTime()); expect(choices.doNotStart).toContain("meta"); - expect(choices.hasHeadroom).toContain("openai.main"); + expect(choices.hasHeadroom).toContain("_openai.main"); expect(choices.hasHeadroom).not.toContain("meta"); // Claude resets in >24h; nothing in this fixture resets within a day // with headroom, so burn-before-reset is empty. @@ -392,13 +392,13 @@ describe("pass-through pool assembly (Drew, 2026-11-03)", () => { // #1114 the board lost anthropic:claude-pro, commandcode, deepseek // and BOTH Antigravity pools, and meta survived only through an // exemption hack — while the OpenCode quota read reported all of - // them. All twelve pools now render unconditionally; the dated + // them. All thirteen pools now render unconditionally; the dated // reads are the live read's fail-soft fallback, nothing more. expect(extractQuotaPools(VIEW, NOW).map((p) => p.id)).toEqual([ "meta", "anthropic:claude-pro", - "openai.main", - "openai.alternate", + "_openai.main", + "_openai.alt", "opencode-go.drewrypope", "opencode-go.popesdrew", "cline-pass", diff --git a/pm-stack/aggregator/test/snapshot-writers.test.ts b/pm-stack/aggregator/test/snapshot-writers.test.ts index 8d5e62805f..da0d365cc8 100644 --- a/pm-stack/aggregator/test/snapshot-writers.test.ts +++ b/pm-stack/aggregator/test/snapshot-writers.test.ts @@ -206,8 +206,8 @@ describe("recordsFromProviderUsage", () => { const recs = recordsFromProviderUsage(answered, "check-usage"); expect(recs.map((r) => `${r.serviceId}/${r.metricId}=${r.value}`)).toEqual([ "opencode-server/sessions-listed=0", - "openai.main/7-day=12", - "openai.main/5-hour=3", + "_openai.main/7-day=12", + "_openai.main/5-hour=3", ]); expect(recordsFromProviderUsage(null, "check-usage")).toEqual([]); expect(recordsFromProviderUsage({ sessions: [] }, "check-usage")).toEqual([]); @@ -241,7 +241,7 @@ describe("recordsFromProviderUsage", () => { expect( recordsFromProviderUsage(snapshot, "check-usage").map((r) => `${r.serviceId}/${r.metricId}=${r.value}`), - ).toEqual(["opencode-server/sessions-listed=1", "openai.main/5-hour=100"]); + ).toEqual(["opencode-server/sessions-listed=1", "_openai.main/5-hour=100"]); }); test("skips percentages above 100 and non-finite values", () => { @@ -278,7 +278,7 @@ describe("recordsFromProviderUsage", () => { expect( recordsFromProviderUsage(snapshot, "check-usage").map((r) => `${r.serviceId}/${r.metricId}=${r.value}`), - ).toEqual(["openai.main/7-day=0", "openai.main/5-hour=100"]); + ).toEqual(["_openai.main/7-day=0", "_openai.main/5-hour=100"]); }); });