From 6f782c35ef97c0bb30b638796cc5df8be7b7bfcf Mon Sep 17 00:00:00 2001 From: Danny Kim Date: Mon, 14 Sep 2026 17:05:09 +0900 Subject: [PATCH] Wait for login instructions --- run.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 {