mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
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:
@@ -296,12 +296,22 @@ export function generationIsCanceled(eventId, { cwd = process.cwd() } = {}) {
|
||||
}
|
||||
|
||||
export function codexWorkerStateIsOwned(state, cwd) {
|
||||
return state?.owner === CODEX_WORKER_OWNER
|
||||
&& canonicalPath(state?.cwd) === canonicalPath(cwd)
|
||||
return codexWorkerOwnerMatches(state, cwd)
|
||||
&& typeof state?.threadId === 'string'
|
||||
&& state.threadId.length > 0;
|
||||
}
|
||||
|
||||
export function codexWorkerProcessStateIsOwned(state, cwd) {
|
||||
return codexWorkerOwnerMatches(state, cwd)
|
||||
&& Number.isInteger(state?.pid)
|
||||
&& state.pid > 0;
|
||||
}
|
||||
|
||||
function codexWorkerOwnerMatches(state, cwd) {
|
||||
return state?.owner === CODEX_WORKER_OWNER
|
||||
&& canonicalPath(state?.cwd) === canonicalPath(cwd);
|
||||
}
|
||||
|
||||
function canonicalPath(value) {
|
||||
if (!value || typeof value !== 'string') return null;
|
||||
const resolved = path.resolve(value);
|
||||
|
||||
Reference in New Issue
Block a user