fix: restrict Codex warm-up to fresh quota windows

This commit is contained in:
ejclaw
2026-04-24 18:53:04 +09:00
parent cfcac88ddb
commit 884aef5c99
4 changed files with 10 additions and 8 deletions

View File

@@ -130,7 +130,7 @@ describe('Codex warm-up scheduler', () => {
minIntervalMs: 18_300_000,
staggerMs: 1_800_000,
maxUsagePct: 0,
maxD7UsagePct: 99,
maxD7UsagePct: 0,
commandTimeoutMs: 120_000,
failureCooldownMs: 21_600_000,
maxConsecutiveFailures: 2,
@@ -195,7 +195,7 @@ describe('Codex warm-up scheduler', () => {
minIntervalMs: 18_300_000,
staggerMs: 0,
maxUsagePct: 0,
maxD7UsagePct: 99,
maxD7UsagePct: 0,
commandTimeoutMs: 120_000,
failureCooldownMs: 21_600_000,
maxConsecutiveFailures: 1,
@@ -254,7 +254,7 @@ describe('Codex warm-up scheduler', () => {
minIntervalMs: 18_300_000,
staggerMs: 1_800_000,
maxUsagePct: 0,
maxD7UsagePct: 99,
maxD7UsagePct: 0,
commandTimeoutMs: 120_000,
failureCooldownMs: 21_600_000,
maxConsecutiveFailures: 2,

View File

@@ -139,6 +139,7 @@ describe('config/env loading', () => {
let config = await import('./config.js');
expect(config.CODEX_WARMUP_CONFIG.enabled).toBe(false);
expect(config.CODEX_WARMUP_CONFIG.maxUsagePct).toBe(0);
expect(config.CODEX_WARMUP_CONFIG.maxD7UsagePct).toBe(0);
expect(
config.CODEX_WARMUP_CONFIG.maxConsecutiveFailures,
).toBeGreaterThanOrEqual(1);

View File

@@ -277,7 +277,7 @@ export function loadConfig(): AppConfig {
),
staggerMs: Math.max(0, readInteger('CODEX_WARMUP_STAGGER_MS', 1800000)),
maxUsagePct: readPercent('CODEX_WARMUP_MAX_USAGE_PCT', 0),
maxD7UsagePct: readPercent('CODEX_WARMUP_MAX_D7_USAGE_PCT', 99),
maxD7UsagePct: readPercent('CODEX_WARMUP_MAX_D7_USAGE_PCT', 0),
commandTimeoutMs: readIntegerAtLeast(
'CODEX_WARMUP_COMMAND_TIMEOUT_MS',
120000,