diff --git a/run.ts b/run.ts index e313484..cc60a93 100644 --- a/run.ts +++ b/run.ts @@ -238,9 +238,17 @@ async function codexDeviceLogin(): Promise { new WritableStream({ write: (chunk) => void (shown += chunk) }), ); const drained = Promise.all([collect(login.stdout), collect(login.stderr)]); + const status = login.status; await new Promise((resolve) => setTimeout(resolve, 3000)); + while (shown.trim() === "") { + const exited = await Promise.race([ + status.then(() => true), + new Promise((resolve) => setTimeout(() => resolve(false), 100)), + ]); + if (exited) throw new Error("AI bot login produced no instructions"); + } await postComment(shown); - await Promise.all([login.status, drained]); + await Promise.all([status, drained]); } async function runCodex(prompt: string): Promise {