Prevent duplicate long-running Live turns

Keep short crash-recovery leases without allowing a healthy worker to queue its own generation twice, and surface non-monotonic benchmark journals as errors.\n\nAI-assisted: OpenAI Codex.
This commit is contained in:
Paul Bakaus
2026-07-12 21:18:20 -07:00
parent 960f4b725b
commit 1e4927d86a
4 changed files with 52 additions and 6 deletions
@@ -69,6 +69,7 @@ export class CodexLiveWorkerSupervisor {
this.queue = Promise.resolve();
this.active = null;
this.canceled = new Set();
this.queuedGenerationIds = new Set();
this.thread = null;
this.model = null;
this.liveSpec = '';
@@ -143,9 +144,12 @@ export class CodexLiveWorkerSupervisor {
continue;
}
if (event.type === 'generate') {
if (this.queuedGenerationIds.has(event.id)) continue;
this.queuedGenerationIds.add(event.id);
this.queue = this.queue
.then(() => this.processGeneration(event))
.catch((error) => this.handleGenerationFailure(event, error));
.catch((error) => this.handleGenerationFailure(event, error))
.finally(() => this.queuedGenerationIds.delete(event.id));
continue;
}
if (event.type === 'prefetch') continue;