20 Commits

Author SHA1 Message Date
e58972d594 Enable Gemini thinking stream 2026-06-15 11:37:29 -07:00
0f212c750b fix(preview): stop refresh-flicker false-restarts + harden dev container & agent
- isDevServerListening: key off curl EXIT CODE not response time. The 2s
  max-time treated a busy/compiling-but-listening dev server as DEAD, so ensure
  restarted a healthy server on every refresh -> cold compile -> the
  502/no-CSS/broken-images/perfect flicker. Now dead only when BOTH localhost
  and 0.0.0.0 refuse the connection (curl exit 7).
- ensure route: liveness probe is fail-safe (try/catch) -> never 500s or
  needlessly restarts on a probe error; trusts the DB flag instead.
- dev container: reconcile dead orphan containers before resume/start so a
  leftover name no longer triggers 'container name already in use' -> Traefik
  gateway timeout.
- dev container: inject AUTH_SECRET / NEXTAUTH_SECRET / AUTH_TRUST_HOST so
  scaffolded NextAuth apps stop throwing [auth][error] MissingSecret in preview.
- chat prompt: don't bounce a healthy dev server; only claim actions a tool
  actually performed (no hallucinated DB deletes); NextAuth previews pre-wired.
- intent budgets: route 'not appearing/showing/missing' to diagnose; bump
  status_check 12->16, diagnose 15->22 so investigations don't hit the cap.
2026-06-12 18:05:16 -07:00
514f11e80d fix(preview): self-healing dev server so the preview always loads cleanly
The dominant production failure was a dead dev-server process behind a
'running' DB flag (idle-stop / OOM / crash / host restart), which the UI
trusted and embedded -> permanent 502 until a manual restart.

- dev-container.ts: add isDevServerListening() fast liveness probe; stop the
  container entrypoint from auto-running 'npx next dev --webpack' (it competed
  with the managed server, forced the wrong bundler/cwd, and doubled memory);
  drop the fake state='running' seed row; bump dev container memory 1g -> 2g.
- ensure route: verify a 'running' row is ACTUALLY listening and resurrect it
  if dead, instead of trusting the flag; never bounce a healthy server.
- preview page: call ensure on every mount and on refresh (verify + heal),
  force an immediate anatomy refetch on (re)start so a dead frame swaps to
  'warming up' without the 5s lag.

Backstopped by the partial unique index + startDevServer idempotency, so heals
can never duplicate or thrash a server.
2026-06-12 17:30:27 -07:00
0f90ef6f5c Fix preview pipeline: dedup duplicate previews, race-safe dev server start, honest readiness
- Add partial unique index on (project_id, port) for active dev servers so the
  SELECT-then-INSERT race can no longer create duplicate 'Port 3000' rows.
- Make startDevServer race-safe: on unique violation, adopt the winning row
  instead of duplicating.
- ensure route no longer marks a server 'running' before it binds the port;
  the readiness probe flips starting->running only after the port answers.
  Kills the '502 -> broken CSS -> works' refresh loop.
- Deduplicate previews per-port in sortDevPreviewsFrontendFirst as a defensive
  backstop for the dropdown.
- Revert iframe _refresh query-param hack (was forcing cold recompiles).
2026-06-12 16:57:06 -07:00
95253c7707 fix(preview): resolve ReferenceError on isForceStarting initialization order 2026-06-12 16:46:35 -07:00
de950b1fb0 Make dev_server_start idempotent to prevent HMR breakage and 502s 2026-06-12 16:42:26 -07:00
c3fdc170d1 fix(preview): sync fs_dev_servers state with container suspension to properly handle idle wakeup 2026-06-12 16:08:03 -07:00
9b56cf362b fix(preview): remove brittle dev server readiness probes; trust that the server will eventually boot 2026-06-12 15:36:35 -07:00
960232e525 design(preview): match toggle button sizes to device toggles 2026-06-12 15:00:40 -07:00
4550df6c1a perf(telemetry): stop migration hook from endlessly rsyncing large node_modules by guarding with marker file 2026-06-10 11:46:50 -07:00
d4c10db58e chore(telemetry): use safer rsync for container path migration hook 2026-06-09 16:28:51 -07:00
137d5975e1 chore(telemetry): implement universal path normalizer and omni-reaper to prevent preview sprawl 2026-06-09 16:11:31 -07:00
a036f2f28f chore(telemetry): align shell_exec and dev_server_start cwd to flattened workspace root 2026-06-09 14:59:42 -07:00
b43dddac4e chore(telemetry): add container-level self-healing repository folder migration hook 2026-06-09 13:52:14 -07:00
492404cd14 chore(telemetry): fix agent loops, name mangling, dev server leaks, CWD alignment, and add daily session auditor 2026-06-08 16:09:58 -07:00
b3dd3714c3 feat(refactor): live zed-style codebase files autocomplete and context attachment 2026-05-21 17:20:31 -07:00
9b5702a81c fix(ai): actually throw probe error out of probeDevServerReadiness so AI captures the failure synchronously 2026-05-16 13:16:17 -07:00
c7e720bdc9 fix(agent): increase dev server readiness probe timeout to 300s to accommodate slow Next.js cold boots and prevent premature AI loop restarts 2026-05-15 16:59:10 -07:00
c3b06b61fc fix(mcp): resolve external preview routing failures and correct monorepo git paths 2026-05-14 14:56:29 -07:00
abf9bf89c2 chore: convert submodules to standard directories for true monorepo structure 2026-05-13 14:54:23 -07:00