From 505d8dfc3c1d76660853e084cedb65ed0e5cbd72 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 22:44:57 +0000 Subject: [PATCH] fix(deploy): update netlify config and smoke test - Update `netlify.toml` to explicitly include redirect and header rules, ensuring they are picked up even if file copying fails or is inconsistent. - Fix `scripts/agent/smoke-test.mjs` to ensure process cleanup on failure (avoiding zombie processes) and use polling for server startup (improving reliability). - Verified smoke test passes locally. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- netlify.toml | 11 +++++++++++ scripts/agent/smoke-test.mjs | 38 ++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/netlify.toml b/netlify.toml index a1680b2f..fc176b6f 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,3 +1,14 @@ [build] command = "npm run build" publish = "dist" + +[[redirects]] + from = "/*" + to = "/index.html" + status = 200 + force = true + +[[headers]] + for = "/*" + [headers.values] + Content-Security-Policy = "frame-ancestors *" diff --git a/scripts/agent/smoke-test.mjs b/scripts/agent/smoke-test.mjs index 51628835..3356f454 100644 --- a/scripts/agent/smoke-test.mjs +++ b/scripts/agent/smoke-test.mjs @@ -39,24 +39,23 @@ const EPHEMERAL_PK = getPublicKey(EPHEMERAL_SK_BYTES); async function startHttpServer() { log('Starting HTTP Server...'); - // Prefer `serve` if available, else python - return new Promise((resolve, reject) => { - const serve = spawn('npx', ['serve', '.', '-p', String(HTTP_PORT)], { - stdio: 'ignore', // Suppress output for cleaner logs, or pipe if needed - shell: true - }); - - // Give it a moment to boot - setTimeout(() => { - log('HTTP Server started (assumed ready).'); - resolve(serve); - }, 2000); - - serve.on('error', (err) => { - log(`HTTP Server failed to start: ${err.message}`); - reject(err); - }); + const serve = spawn('npx', ['serve', '.', '-p', String(HTTP_PORT)], { + stdio: 'ignore', + shell: true }); + + const maxRetries = 20; + for (let i = 0; i < maxRetries; i++) { + try { + await fetch(HTTP_URL); + log('HTTP Server is ready.'); + return serve; + } catch (e) { + await new Promise(r => setTimeout(r, 250)); + } + } + serve.kill(); + throw new Error('HTTP Server failed to start within timeout.'); } async function runSmokeTest() { @@ -70,6 +69,7 @@ async function runSmokeTest() { let httpServer; let browser; let nodeClient; + let exitCode = 0; try { log('--- Smoke Test Started ---'); @@ -236,7 +236,7 @@ async function runSmokeTest() { } catch (err) { log(`--- Smoke Test FAILED: ${err.message} ---`); if (err.stack) log(err.stack); - process.exit(1); + exitCode = 1; } finally { // Cleanup log('Cleaning up...'); @@ -250,7 +250,7 @@ async function runSmokeTest() { if (httpServer) httpServer.kill(); if (relayServer) await relayServer.close(); - process.exit(0); + process.exit(exitCode); } }