From 10988791037c2def4405eb356fc5812269846c40 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 18 Jul 2026 21:50:14 +0000 Subject: [PATCH] Fix: skip recoverEmptyCycling in injectVariantsFromSource when GENERATING Server-side preflight writes the scaffold to source before variants are ready, triggering a full Astro page reload via HMR. After reload the browser calls injectVariantsFromSource, finds the empty scaffold wrapper (no variants yet), and calls recoverEmptyCycling which destroys the session. When the agent then writes real variants and posts done, there is no active session to receive it, so the browser never enters CYCLING. Fix: in GENERATING state, an empty wrapper is expected (the agent is still writing variants). Return early without touching the session so the next HMR or done SSE can deliver the full variant set. Fixes the intermittent astro-vite7 CYCLING timeout in live-e2e smoke. --- skill/scripts/live-browser.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/skill/scripts/live-browser.js b/skill/scripts/live-browser.js index f3016ef48..0acfff920 100644 --- a/skill/scripts/live-browser.js +++ b/skill/scripts/live-browser.js @@ -5687,6 +5687,13 @@ arrivedVariants = variants.length; expectedVariants = parseInt(wrapper.dataset.impeccableVariantCount || arrivedVariants); if (arrivedVariants <= 0) { + // Scaffold wrapper exists but variants haven't been written yet. + // This happens when server-side preflight triggers a full page reload + // (e.g. Astro's HMR) before the agent finishes writing variants. In + // GENERATING state the agent will write the variants shortly — don't + // destroy the session. The next HMR or done SSE will call this again + // with the full variant set. + if (state === 'GENERATING') return; recoverEmptyCycling('source-fallback-empty'); return; }