fix: wait for frontend auth runtime status

This commit is contained in:
Codex
2026-07-09 15:59:32 +02:00
parent ed2c6298fd
commit 3a316ea56b
+11 -1
View File
@@ -107,7 +107,7 @@ async function apply(config: UniDeskConfig, options: AuthOptions): Promise<Recor
}
const remote = await capture(config, auth.target.route, ["sh"], applyScript(auth, material));
const parsed = parseJsonOutput(remote.stdout);
const runtime = await status(config, { ...options, raw: false });
const runtime = await waitForRuntimeStatus(config, options);
return {
ok: remote.exitCode === 0 && parsed?.ok === true && runtime.ok === true,
...base,
@@ -119,6 +119,16 @@ async function apply(config: UniDeskConfig, options: AuthOptions): Promise<Recor
};
}
async function waitForRuntimeStatus(config: UniDeskConfig, options: AuthOptions): Promise<Record<string, unknown>> {
let latest: Record<string, unknown> | null = null;
for (let attempt = 1; attempt <= 12; attempt += 1) {
latest = await status(config, { ...options, raw: false });
if (latest.ok === true) return latest;
await new Promise((resolve) => setTimeout(resolve, 5_000));
}
return latest ?? { ok: false, summary: { ok: false, error: "runtime-status-not-run", valuesPrinted: false } };
}
async function status(config: UniDeskConfig, options: AuthOptions): Promise<Record<string, unknown>> {
const auth = readRuntimeAuthConfig();
const material = readAuthMaterial(auth);