From c7e720bdc9d0c499d1348688837e31b3b514f939 Mon Sep 17 00:00:00 2001 From: mawkone Date: Fri, 15 May 2026 16:59:10 -0700 Subject: [PATCH] fix(agent): increase dev server readiness probe timeout to 300s to accommodate slow Next.js cold boots and prevent premature AI loop restarts --- vibn-frontend/lib/dev-container.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vibn-frontend/lib/dev-container.ts b/vibn-frontend/lib/dev-container.ts index 82ca6294..e689e7fc 100644 --- a/vibn-frontend/lib/dev-container.ts +++ b/vibn-frontend/lib/dev-container.ts @@ -722,13 +722,13 @@ export async function probeDevServerReadiness( port: number, ): Promise { await ensureDevServersTable(); - // Up to ~120s: Next/Vite cold compile often exceeds 60s on small hosts. + // Up to ~300s: Next/Vite cold compile + potential npm installs can take a while. // We accept any HTTP response (including 404/500) as "listening" — only // connection failures stay 000 — because `curl -sf` falsely failed when `/` // returned a dev error page before the app was fully ready. const probeCmd = `last_code=000; ` + - `for i in $(seq 1 120); do ` + + `for i in $(seq 1 300); do ` + `for path in / ''; do ` + `code=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 2 --connect-timeout 2 ` + `"http://127.0.0.1:${port}$path" 2>/dev/null || printf '000'); ` + @@ -737,15 +737,15 @@ export async function probeDevServerReadiness( `done; ` + `sleep 1; done; ` + `echo "PROBE_FAIL last_code=$last_code port=${port}"; ` + - `echo "PROBE_FAIL ps=$(ps aux | grep -E 'node|npm|next|vite' | grep -v grep | head -3 | tr '\n' '|')"; ` + - `echo "PROBE_FAIL log_tail=$(tail -20 /var/log/vibn-dev/${serverId}.log 2>/dev/null | tr '\n' '|' | head -c 2000)"; ` + + `echo "PROBE_FAIL ps=$(ps aux | grep -E 'node|npm|next|vite' | grep -v grep | head -3 | tr '\\n' '|')"; ` + + `echo "PROBE_FAIL log_tail=$(tail -20 /var/log/vibn-dev/${serverId}.log 2>/dev/null | tr '\\n' '|' | head -c 2000)"; ` + `exit 1`; try { const r = await execInDevContainer({ projectId, command: probeCmd, - timeoutMs: 130_000, + timeoutMs: 310_000, }); if (r.exitCode === 0) { await query(