Prewarm Codex Live with safe fallback

Return after a durable starting record, overlap app-server initialization with page startup, dynamically reclaim generation after worker failure, and cap hard-crash leases at 15 seconds.\n\nAI-assisted: OpenAI Codex.
This commit is contained in:
Paul Bakaus
2026-07-12 21:11:50 -07:00
parent 6f3076051f
commit 6ed43ca682
9 changed files with 170 additions and 24 deletions
@@ -6,6 +6,7 @@ import { describe, it } from 'node:test';
import { CODEX_WORKER_OWNER } from '../skill/scripts/live/codex-worker.mjs';
import {
CODEX_WORKER_EVENT_LEASE_MS,
CODEX_WORKER_EVENT_TYPES,
CodexLiveWorkerSupervisor,
buildDeterministicScaffoldCommand,
@@ -145,6 +146,7 @@ describe('Codex Live worker supervisor ownership and lifecycle', () => {
supervisor.thread = { id: 'live-worker-thread' };
supervisor.fetchEvent = async (_base, _token, options) => {
assert.deepEqual(options.types, CODEX_WORKER_EVENT_TYPES);
assert.equal(options.leaseMs, CODEX_WORKER_EVENT_LEASE_MS);
return cleanups.length === 0
? { type: 'accept', id: 'abc12345', variantId: '1' }
: { type: 'exit' };