Skip to content

fix(gen2): harden workspace lifecycle recovery - #61

Merged
yousef20920 merged 5 commits into
mainfrom
codex/gen2-lifecycle-reliability
Sep 27, 2026
Merged

yousef20920 merged 5 commits into
mainfrom
codex/gen2-lifecycle-reliability

Conversation

@yousef20920

@yousef20920 yousef20920 commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Recover stale Gen 2 startup claims and let concurrent opens poll the shared workspace state without holding a long server request.
  • Bound each host-wake attempt and retry startup in the workspace page while Azure finishes waking.
  • Fence stop/start transitions, preserve snapshots when the host is unreachable, and wake the host before deleting guest and snapshot data so teardown fits the 300-second function limit.
  • Detect Firecracker exits during snapshot restore and retry from saved workspace disks; prevent new sandboxes from racing host shutdown.

Verification

  • pnpm typecheck passed.
  • pnpm lint passed with three existing warnings and no errors.
  • pnpm test passed: 13 infrastructure checks, 1,122 web tests (one skipped), and all other workspace package tests.
  • Focused lifecycle Vitest suite passed: 30 tests across four files.
  • Apple Container Rust checks passed: cargo fmt --check, Clippy with warnings denied, and 79 tests.
  • Local production build passed; http://127.0.0.1:3002/api/health returned HTTP 200.
  • Local Playwright suite passed: 38 tests, one skipped.
  • All GitHub checks passed on the current head.

Authenticated localhost lifecycle smoke

  • Ran two full Playwright passes against a local production next start on port 3003, with the current Drizzle schema in a disposable Apple Container PostgreSQL instance on port 55432 and CODEV_FAKE_GUEST=1. Each pass completed two create/open/delete cycles and two stop/reopen cycles; ready state and deletion were verified after every operation.
  • A concurrent lifecycle pass issued four opens together, stopped the instance, issued four reopens together, and deleted the workspace. All open requests returned 200 or 202; the final state was ready; stop and delete returned 200.
  • These runs exercised the real local Next.js routes and database with the guest boundary replaced by the in-memory contract fake. They did not create an Azure VM or Firecracker guest.

Environment limits

  • The preconfigured shared database in apps/web/.env.local has not applied migration 0054, which is already on main and adds deleting to gen2_workspace_status. Deletion against that stale schema returned 502 while reserving the delete state. The synthetic test account and fake workspace were removed; the shared database was not migrated. The isolated localhost lifecycle runs used the current schema.
  • A live Azure-backed host wake remains unverified because the local Azure CLI refresh token has expired. The Firecracker early-exit and host-shutdown reservation regressions are covered by the Rust tests and CI.

Copilot AI lite review requested due to automatic review settings September 26, 2026 08:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@yousef20920
yousef20920 force-pushed the codex/gen2-lifecycle-reliability branch from 348c365 to bbb82d8 Compare September 26, 2026 08:52
@yousef20920
yousef20920 force-pushed the codex/gen2-lifecycle-reliability branch from bbb82d8 to 8938aae Compare September 26, 2026 09:00
@yousef20920
yousef20920 merged commit 4edcd56 into main Sep 27, 2026
4 checks passed
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.

2 participants