Merge Codex warm-up fresh-window defaults

Restrict Codex warm-up to fresh quota windows
This commit is contained in:
Eyejoker
2026-04-24 18:56:16 +09:00
committed by GitHub
4 changed files with 10 additions and 8 deletions

View File

@@ -37,9 +37,10 @@ STATUS_CHANNEL_ID= # Discord channel ID for live status updat
# STATUS_SHOW_ROOM_DETAILS=false # Show detailed room info # STATUS_SHOW_ROOM_DETAILS=false # Show detailed room info
# --- Codex warm-up (optional, disabled by default) --- # --- Codex warm-up (optional, disabled by default) ---
# Sends a tiny real Codex prompt to near-zero-usage accounts so their reset # Sends a tiny real Codex prompt only when both 5h and 7d usage are 0%, so
# countdown starts after a fresh quota window. Keep disabled if OpenAI changes # reset countdown starts once after a fresh quota window. Keep disabled if
# policy or starts blocking automated warm-up prompts. # OpenAI changes policy or starts blocking automated warm-up prompts.
# Normally only set this one line; the other knobs have conservative defaults.
# CODEX_WARMUP_ENABLED=false # CODEX_WARMUP_ENABLED=false
# CODEX_WARMUP_PROMPT=Reply exactly OK. Do not run tools. # CODEX_WARMUP_PROMPT=Reply exactly OK. Do not run tools.
# CODEX_WARMUP_MODEL= # Defaults to CODEX_MODEL # CODEX_WARMUP_MODEL= # Defaults to CODEX_MODEL
@@ -47,7 +48,7 @@ STATUS_CHANNEL_ID= # Discord channel ID for live status updat
# CODEX_WARMUP_MIN_INTERVAL_MS=18300000 # Per-account minimum gap: 5h5m # CODEX_WARMUP_MIN_INTERVAL_MS=18300000 # Per-account minimum gap: 5h5m
# CODEX_WARMUP_STAGGER_MS=1800000 # Global gap between accounts: 30min # CODEX_WARMUP_STAGGER_MS=1800000 # Global gap between accounts: 30min
# CODEX_WARMUP_MAX_USAGE_PCT=0 # Only warm accounts at/below this 5h usage # CODEX_WARMUP_MAX_USAGE_PCT=0 # Only warm accounts at/below this 5h usage
# CODEX_WARMUP_MAX_D7_USAGE_PCT=99 # Skip weekly-exhausted accounts # CODEX_WARMUP_MAX_D7_USAGE_PCT=0 # Only warm accounts at/below this 7d usage
# CODEX_WARMUP_MAX_CONSECUTIVE_FAILURES=2 # CODEX_WARMUP_MAX_CONSECUTIVE_FAILURES=2
# CODEX_WARMUP_FAILURE_COOLDOWN_MS=21600000 # Back off 6h after repeated failure # CODEX_WARMUP_FAILURE_COOLDOWN_MS=21600000 # Back off 6h after repeated failure

View File

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

View File

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

View File

@@ -277,7 +277,7 @@ export function loadConfig(): AppConfig {
), ),
staggerMs: Math.max(0, readInteger('CODEX_WARMUP_STAGGER_MS', 1800000)), staggerMs: Math.max(0, readInteger('CODEX_WARMUP_STAGGER_MS', 1800000)),
maxUsagePct: readPercent('CODEX_WARMUP_MAX_USAGE_PCT', 0), 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( commandTimeoutMs: readIntegerAtLeast(
'CODEX_WARMUP_COMMAND_TIMEOUT_MS', 'CODEX_WARMUP_COMMAND_TIMEOUT_MS',
120000, 120000,