refactor: remove the disabled periodic Codex warm-up loop

CODEX_WARMUP_ENABLED defaulted to false and was never set, so the
warm-up loop in unified-dashboard never ran. Remove the loop, the
`enabled` / `intervalMs` config keys, the `disabled` result and the
`shouldSkip` hook it alone used. The fixed-slot usage primer keeps
calling runCodexWarmupCycle with forceAttempt exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-10-01 19:08:55 +09:00
parent 12b262eaa9
commit fe7c5a7b23
10 changed files with 11 additions and 85 deletions

View File

@@ -14,7 +14,6 @@ import {
STATUS_SHOW_ROOM_DETAILS,
STATUS_SHOW_ROOMS,
USAGE_DASHBOARD_ENABLED,
CODEX_WARMUP_CONFIG,
} from './config.js';
import { getGlobalFailoverInfo } from './service-routing.js';
import {
@@ -27,7 +26,6 @@ import {
refreshActiveCodexUsage,
refreshAllCodexAccountUsage,
} from './codex-usage-collector.js';
import { runCodexWarmupCycle } from './codex-warmup.js';
import {
composeDashboardContent,
formatElapsed,
@@ -1060,35 +1058,10 @@ export async function startUnifiedDashboard(
cachedCodexUsageRows = result.rows;
if (result.fetchedAt) codexUsageFetchedAt = result.fetchedAt;
};
const isWarmupRuntimeBusy = () => {
const groups = opts.roomBindings();
return opts.queue
.getStatuses(Object.keys(groups))
.some((status) => status.status === 'processing');
};
let codexWarmupInFlight = false;
const runCodexWarmup = async () => {
if (!CODEX_WARMUP_CONFIG.enabled || codexWarmupInFlight) return;
codexWarmupInFlight = true;
try {
const result = await runCodexWarmupCycle(CODEX_WARMUP_CONFIG, {
shouldSkip: isWarmupRuntimeBusy,
});
if (result.status === 'warmed') {
applyCodexRefresh(await refreshAllCodexAccountUsage());
}
} catch (err) {
logger.warn({ err }, 'Codex warm-up cycle failed unexpectedly');
} finally {
codexWarmupInFlight = false;
}
};
void refreshAllCodexAccountUsage()
.then((r) => {
applyCodexRefresh(r);
return refreshActiveCodexUsage().then(applyCodexRefresh);
})
.then(() => runCodexWarmup());
void refreshAllCodexAccountUsage().then((r) => {
applyCodexRefresh(r);
return refreshActiveCodexUsage().then(applyCodexRefresh);
});
// Each poll spawns a Codex app-server; every 5 minutes is plenty for the
// dashboard (it used to run every minute, ~1,440 spawns a day).
setInterval(
@@ -1096,15 +1069,9 @@ export async function startUnifiedDashboard(
Math.max(opts.usageUpdateInterval, CODEX_ACTIVE_USAGE_POLL_MS),
);
setInterval(
() =>
void refreshAllCodexAccountUsage()
.then(applyCodexRefresh)
.then(() => runCodexWarmup()),
() => void refreshAllCodexAccountUsage().then(applyCodexRefresh),
CODEX_FULL_SCAN_INTERVAL,
);
if (CODEX_WARMUP_CONFIG.enabled) {
setInterval(() => void runCodexWarmup(), CODEX_WARMUP_CONFIG.intervalMs);
}
logger.info(
{