From 96ca9c065503c5b6e559a64237fc0d762ac59927 Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Mon, 30 Mar 2026 02:58:28 +0900 Subject: [PATCH] fix: use in-process Codex usage cache for unified service dashboard --- src/unified-dashboard.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/unified-dashboard.ts b/src/unified-dashboard.ts index b5bb137..706a78f 100644 --- a/src/unified-dashboard.ts +++ b/src/unified-dashboard.ts @@ -480,14 +480,19 @@ async function buildUsageContent(): Promise { claudeBotRows.push(...buildClaudeUsageRows(cachedClaudeAccounts)); } - // Group 2: Codex bot (separate service) + // Group 2: Codex bot — use in-process cache (unified service) + // or fall back to snapshot from separate Codex service. const codexBotRows: UsageRow[] = []; - const codexSnapshot = readStatusSnapshots(STATUS_SNAPSHOT_MAX_AGE_MS).find( - (s) => s.serviceId === 'codex-main' || s.serviceId === 'codex', - ); - codexBotRows.push( - ...extractCodexUsageRows(codexSnapshot, USAGE_SNAPSHOT_MAX_AGE_MS), - ); + if (cachedCodexUsageRows.length > 0) { + codexBotRows.push(...cachedCodexUsageRows); + } else { + const codexSnapshot = readStatusSnapshots(STATUS_SNAPSHOT_MAX_AGE_MS).find( + (s) => s.serviceId === 'codex-main' || s.serviceId === 'codex', + ); + codexBotRows.push( + ...extractCodexUsageRows(codexSnapshot, USAGE_SNAPSHOT_MAX_AGE_MS), + ); + } lines.push(...renderUsageTable(claudeBotRows, codexBotRows));