Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pm-stack/aggregator/src/quota-extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// 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) and the
// 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.
Expand Down Expand Up @@ -462,7 +462,7 @@ 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,
// provider id whenever the config defines one — meta, openai.main,
// openai.alternate, opencode-go.drewrypope, opencode-go.popesdrew, cline-pass,
// opendesign, deepseek, commandcode. The colon-suffixed spellings these
// replaced (meta:high-usage, openai:codex, opencode-go:drewrypope, ...)
Expand Down Expand Up @@ -502,9 +502,9 @@ export const POOL_SPECS: PoolSpec[] = [
shellNote: "No current read (console-only usage).",
},
{
id: "openai",
id: "openai.main",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update burn attribution to use the renamed pool ID

When the scraped OpenCode server has active sessions using openai, openai-codex, or chatgpt, this rename silently removes them from the main ChatGPT quota card. In pm-stack/aggregator/scripts/collect-fleet-feed.ts, poolFor still returns "openai" for these providers (lines 189–192), while the collector attaches activeSessions only when that result exactly matches pool.id (line 639). Update the burn mapper alongside this rename so previously attributed sessions continue to appear under openai.main.

Useful? React with 👍 / 👎.

provider: "OpenAI",
plan: "ChatGPT (Codex pool)",
plan: "ChatGPT (Main — drewrypope)",
heading: /^### ChatGPT/,
extract: extractCodex,
shellNote: "No current read. OpenAI is the fleet's final reserve pool.",
Expand All @@ -516,7 +516,7 @@ export const POOL_SPECS: PoolSpec[] = [
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); the two are never combined.",
"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.",
},
{
id: "opencode-go.drewrypope",
Expand Down
2 changes: 1 addition & 1 deletion pm-stack/aggregator/src/quota-gather-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function serviceIdFor(providerId: string): string {
case "claude":
return "anthropic:claude-pro";
case "codex":
return "openai";
return "openai.main";
case "cline-pass":
return "cline-pass";
case "command-code":
Expand Down
2 changes: 1 addition & 1 deletion pm-stack/aggregator/src/snapshot-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export function recordsFromProviderUsage(snap: unknown, observedBy: string): Sna
if (!metricId) return;
out.push({
ts,
serviceId: "openai",
serviceId: "openai.main",
metricId,
value: win.used_percent,
unit: "pct",
Expand Down
2 changes: 1 addition & 1 deletion pm-stack/aggregator/test/quota-gather-map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ describe("entryFromFileExport (Meta #1301 convention)", () => {

describe("serviceIdFor", () => {
test("known pools map to hub ids; others pass through", () => {
expect(serviceIdFor("codex")).toBe("openai");
expect(serviceIdFor("codex")).toBe("openai.main");
expect(serviceIdFor("deepseek")).toBe("deepseek");
expect(serviceIdFor("meta")).toBe("meta");
expect(serviceIdFor("opendesign")).toBe("opendesign");
Expand Down
10 changes: 5 additions & 5 deletions pm-stack/aggregator/test/quota.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ describe("quota extractors", () => {
});

test("codex 7-day read", () => {
const p = byId.get("openai")!;
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");
});

test("month-based resets normalize month case and preserve reads for invalid dates across extractors", () => {
const consumers = [
{
id: "openai",
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,
Expand Down Expand Up @@ -126,7 +126,7 @@ describe("quota extractors", () => {
const pastDate = "Sep 24";
const cases = [
{
id: "openai",
id: "openai.main",
view: `\n### ChatGPT — main account plans\n7-day 42% used; resets ${pastDate}, 18:01 UTC.\n`,
},
{
Expand Down Expand Up @@ -349,7 +349,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");
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.
Expand Down Expand Up @@ -387,7 +387,7 @@ describe("pass-through pool assembly (Drew, 2026-11-03)", () => {
expect(extractQuotaPools(VIEW, NOW).map((p) => p.id)).toEqual([
"meta",
"anthropic:claude-pro",
"openai",
"openai.main",
"openai.alternate",
"opencode-go.drewrypope",
"opencode-go.popesdrew",
Expand Down
8 changes: 4 additions & 4 deletions pm-stack/aggregator/test/snapshot-writers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/7-day=12",
"openai/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([]);
Expand All @@ -229,7 +229,7 @@ describe("recordsFromProviderUsage", () => {

expect(
recordsFromProviderUsage(snapshot, "check-usage").map((r) => `${r.serviceId}/${r.metricId}=${r.value}`),
).toEqual(["opencode-server/sessions-listed=1", "openai/5-hour=100"]);
).toEqual(["opencode-server/sessions-listed=1", "openai.main/5-hour=100"]);
});

test("skips percentages above 100 and non-finite values", () => {
Expand Down Expand Up @@ -266,7 +266,7 @@ describe("recordsFromProviderUsage", () => {

expect(
recordsFromProviderUsage(snapshot, "check-usage").map((r) => `${r.serviceId}/${r.metricId}=${r.value}`),
).toEqual(["openai/7-day=0", "openai/5-hour=100"]);
).toEqual(["openai.main/7-day=0", "openai.main/5-hour=100"]);
});
});

Expand Down