fix: dashboard usage no longer shows a rolled-over window's old value
At 23:00 on 2026-10-19 the Claude 5h window reset, but the dashboard kept showing "99% reset" until 23:04:34 (real value 3%): the 5-minute fetch throttle replayed the 22:59:04 snapshot. Codex rows were also formatted once per 5-min poll, so their % and countdown froze between polls. - A window whose resets_at has passed renders as 0% with no countdown. - Claude usage fetch skips the throttle once when a cached window reset fell after the last attempt (429 cooldown still honoured). - Codex rows are rebuilt from cached state at every render. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,10 @@ import {
|
||||
fetchClaudeUsage,
|
||||
type ClaudeUsageSnapshot,
|
||||
} from './claude-usage.js';
|
||||
import { refreshCodexUsage } from './codex-usage-collector.js';
|
||||
import {
|
||||
buildCodexUsageRowsFromState,
|
||||
refreshCodexUsage,
|
||||
} from './codex-usage-collector.js';
|
||||
import {
|
||||
composeDashboardContent,
|
||||
formatElapsed,
|
||||
@@ -629,7 +632,9 @@ async function buildUsageContent(): Promise<string> {
|
||||
// or fall back to snapshot from separate Codex service.
|
||||
const codexBotRows: UsageRow[] = [];
|
||||
if (cachedCodexUsageRows.length > 0) {
|
||||
codexBotRows.push(...cachedCodexUsageRows);
|
||||
// Rebuild from the cached state at render time so the reset countdown
|
||||
// and a rolled-over window stay current between the 5-min polls.
|
||||
codexBotRows.push(...buildCodexUsageRowsFromState());
|
||||
} else {
|
||||
const codexSnapshot = readStatusSnapshots(STATUS_SNAPSHOT_MAX_AGE_MS).find(
|
||||
(s) => s.serviceId === 'codex-main' || s.serviceId === 'codex',
|
||||
|
||||
Reference in New Issue
Block a user