Skip to content

fix: make Computer Files startup non-blocking - #289

Merged
iamjr15 merged 1 commit into
mainfrom
fix/computer-startup
Aug 27, 2026
Merged

fix: make Computer Files startup non-blocking#289
iamjr15 merged 1 commit into
mainfrom
fix/computer-startup

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Return Files startup admission immediately instead of waiting 15–20 seconds for Daytona.
  • Run sandbox and code-server readiness through a durable, retry-safe Durable Object alarm workflow.
  • Keep app-builder runs on Browser while generation is active and show explicit Files startup phases.
  • Preserve the legacy GET path for safe Vercel/Cloudflare rollout and rollback compatibility.

Plan

docs/plans/cloudflare-critical-path-performance.md

Architecture

The web client starts a private operation with POST, polls its bounded status, then requests the existing signed Files session only after code-server has passed an HTTP readiness probe. One physical Durable Object alarm multiplexes keepalive and Files deadlines. State transitions are fenced by operation, attempt, and expected phase.

Decisions Made

Decision Choice Reasoning
Long startup owner ProjectSandbox Durable Object alarm Survives request termination and preserves per-user coordination
Readiness Daytona started plus code-server HTTP probe A preview URL alone does not prove the service is listening
Retry safety Stable operation ID with attempt and phase fences Prevents stale alarm delivery from reviving or overwriting a newer generation
Rollout Additive POST/status routes plus legacy GET fallback Vercel and Workers deploy independently
App-builder UX Select Browser during generation Avoids waking Files when the user expects the live app preview

Edge Cases Handled

  • Duplicate open requests coalesce onto the same active operation.
  • Alarm replay cannot increment beyond the bounded retry count.
  • Keepalive and Files deadlines cannot overwrite one another.
  • Existing pre-deploy keepalive alarms are migrated before the first new deadline write.
  • Stale pending operations expire read-only and retry with a new generation.
  • Process session and command identity invalidate stale readiness evidence.
  • Iframe recovery re-runs startup/session acquisition instead of only reloading a dead URL.
  • Older Workers return 404/405 and the new web client falls back to the legacy GET.

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm turbo build --force
  • pnpm deadcode
  • pnpm architecture:check
  • pnpm turbo skills:build
  • pnpm worker:performance-budgets
  • git diff --check
  • Signed-in production flow after deployment

Review Order

  1. project-sandbox-code-server-runtime.ts for the operation state machine.
  2. project-sandbox-alarm.ts and project-sandbox.ts for alarm multiplexing.
  3. sandbox-preview-http-routes.ts and shared schemas for the additive API.
  4. Web API polling and Computer panel behavior for rollout and UX handling.

Move Daytona and code-server readiness into a durable, fenced alarm workflow.
Show progressive Files startup states and retain a safe legacy fallback.
@iamjr15
iamjr15 merged commit 14c3384 into main Aug 27, 2026
4 checks passed
@iamjr15
iamjr15 deleted the fix/computer-startup branch August 27, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant