Compare commits

..
Author SHA1 Message Date
copilot-swe-agent[bot]andGitHub 1098879103 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.
2026-07-18 21:50:14 +00:00
copilot-swe-agent[bot]andGitHub a3d7009e33 Initial plan 2026-07-18 21:19:43 +00:00
Paul Bakaus e0afd4fcea Drop the progressive benchmark, remove dead wrap scaffolding
Review fallout from removing progressive publication.

The Live benchmark existed to compare atomic against progressive delivery:
compareModelBackedReports measures goToFirstVariantMs improvement of one
over the other. With progressive gone it measures nothing against nothing.
Worse, benchmark-live.mjs still passed `progressive` to bootFixtureSession,
which no longer accepts it, so `--delivery progressive` was silently
ignored and would have emitted reports labeled progressive that actually
ran atomic. Silent wrong data is worse than a crash. It was built for
progressive, so it goes with progressive: benchmark-live.mjs, its lib, its
test, and the bench:live script. If an atomic latency baseline is wanted
later, that is a smaller thing built on purpose.

live-wrap.mjs: sourceOriginalLines was assigned and never read.

Both found by review bots on #381 (Copilot).

Assisted-by: Claude Code
2026-07-18 14:11:07 -07:00
Paul Bakaus 3600edc5e9 Live: polling rework, source locks, preflight scaffolding, Vue previews
Carved out of #371, minus progressive publication. Everything here works
against real project source the way main's Live already does: the agent
writes variants into the file the browser loaded, HMR fires, Accept
promotes and carbonizes. Nothing is staged anywhere.

Poll lanes. Events now carry an explicit priority: accept/discard/exit
ahead of manual_edit_apply/steer/carbonize_cleanup ahead of generate. A
long generate can no longer sit in front of the Accept the user just
clicked. leaseEvent claims its lease before awaiting, so a slow prepare
cannot hand the same event to two pollers.

Source locks. A per-file mutex around every accept and discard path, keyed
on a digest of the absolute path. Staleness is decided by owner-pid
liveness rather than mtime, so a wedged lock clears when its owner dies
instead of after an arbitrary timeout, and a slow-but-live accept is never
stolen from. Only the owning process can release a lock.

Preflight scaffolding. The server runs live-wrap (or live-insert) before
the poll returns and hands the result back as event.scaffold. That walk is
measured at ~7.6s on a large repo; moving it off the agent's critical path
removes a deterministic tool round trip without touching the generated
design. Falls back cleanly to the agent running the helper itself.

Vue previews. previewMode: "vue-component" for Nuxt/Vue targets, matching
the existing Svelte component path: variants compile as real SFCs from a
dev-only directory so the route is never rewritten during generation, and
Vite mounts them without invalidating page state. Accept is the only route
write. Includes a Vue attr tokenizer that normalizes shorthand bindings
(@x, :x, #x) to their canonical forms.

Accept hardening. Every thrown failure now returns mode: 'error' rather
than an ambiguous unhandled result, so a real failure is never classified
as a deliberate manual handoff and silently dropped. The marker search
skips node_modules/.git/dist/build/.impeccable.

Shared CLI arg parsing extracted to scripts/lib/cli-args.mjs.

Assisted-by: Claude Code
2026-07-18 14:11:07 -07:00
+7
View File
@@ -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;
}