Skip to content

feat(den): add the cloud runtime provider contract and move the sandbox bootstrap out of the Daytona module - #4444

Merged
reachjalil merged 1 commit into
devfrom
feature/cloud-runtime-contract
Sep 6, 2026
Merged

reachjalil merged 1 commit into
devfrom
feature/cloud-runtime-contract

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Current verification — September 5

Verification verdict: Passed for the hermetic runtime regression. Exact head: 58f23127b28dca50ab4457d2f9837ded28237e7a. The stack is based on dev@d9f7e12ad. This section supersedes the historical verification below.

  • Removed the added CI workflow commit completely. There are no .github/ changes anywhere in the stack; existing repository CI and review rules are unchanged.
  • Retained the provider contract, adapter correction, neutral-store backfill, generated SDK field and all regression tests. Range comparison confirms the CI commit is the only dropped change.
  • Ran pnpm evals:pr specs/remote-session-first-use.test.ts independently on this exact head: 1 passed, 0 failed, 0 skipped. The matching test-evidence comment has been updated, rather than reusing the previous head’s result. The three layers have 6, 10 and 11 passing assertion artifacts respectively.
  • Placement: isolated local Den with MySQL/Redis. The PR runner prints no placement line. The HTTP witness simulates provider infrastructure; live Linux bootstrap, tar/SQLite and provider-volume durability are not exercised. No live provider or production data is used.
  • On feat(den): store Cloud instances in a provider-neutral table and tell clients how endpoints behave #4446’s exact head, pnpm --filter @openwork-ee/den-db test against isolated MySQL passes 31/31 with zero skips, including seeded backfill, unchanged rollback rows and full migration replay.

Keep the original human-review hold and merge order #4444 → #4445 → #4446. Retarget and refresh each child after its parent lands. No merge or deployment is included in this update.


Stack

Merge bottom-up; each layer carries its own checks. After #4444 merges, retarget #4445 to dev; after #4445 merges, retarget #4446 to dev.

Summary

  • Part 1 of 3 (stack: this PR → Daytona adapter → neutral instance store). Introduces @openwork-ee/cloud-runtime, the provider-neutral contract every OpenWork Cloud sandbox host implements: capability descriptor, normalized instance states, error taxonomy (RuntimeProviderError codes instead of message matching), opaque provider references, exec with logs/exit codes, endpoint with expiry, storage attachment.
  • Moves the sandbox bootstrap and checkpoint shell script out of workers/daytona.ts into a renderer over an explicit config (renderOpenWorkBootstrapCommand, renderCheckpointFlushCommand, probe/marker commands). The Daytona provisioner now renders through it; the rendered scripts are byte-identical to dev (sha256 compared for the start and flush commands).
  • Ships an in-memory fake provider and a runner-agnostic conformance suite (sandboxProviderConformanceCases) that any future host must pass before Den can select it.
  • Adds the package to the Den API image so the production build's export check covers it.

Why

  • Den's Cloud lifecycle (provision, wake, recycle, idle stop) is written directly against the Daytona SDK, and the bootstrap script lives inside the Daytona module even though nothing in it is Daytona-specific. A neutral contract is the precondition for evaluating other hosts and for the wake/prewarm speed work that follows, without rewriting policy per host.

Scope

  • New package ee/packages/cloud-runtime (contract, bootstrap renderer, testing utilities).
  • ee/apps/den-api/src/workers/daytona.ts delegates script rendering to the package.
  • packaging/docker/Dockerfile.den copies the new package; lockfile importer added.

Out of scope

  • Any lifecycle behaviour change, the Daytona adapter, the orchestrator, persistence, client changes (later PRs in the stack).

Testing

Ran

  • ee/packages/cloud-runtime: pnpm typecheck, bun test src (renderer + conformance against the fake, incl. a stable-endpoint variant)
  • ee/apps/den-api: pnpm exec tsc -p tsconfig.json --noEmit; bun test --conditions development test/daytona-provisioning.test.ts test/daytona-checkpoint-command.test.ts test/cloud-lifecycle.test.ts test/cloud-runtime-access.test.ts test/cloud-instance-route.test.ts test/worker-runtime-signed-preview.test.ts test/cloud-failure.test.ts; pnpm test
  • Byte-for-byte check: dumped buildOpenWorkStartCommand/checkpointFlushCommand output for a fixed env before and after; cmp identical.

Result

  • pass/fail: pass — package 21/21; den-api typecheck clean; 20/1/14/10/40/13/3 pass in the listed files; CI test script 24/24; rendered scripts identical.
  • if fail, exact files/errors: none.

CI status

  • pass: pending at open
  • code-related failures: none known
  • external/env/auth blockers: none

Manual verification

  1. bun --conditions development -e a script that imports ee/apps/den-api/src/workers/daytona.ts with DAYTONA_* env set and prints buildOpenWorkStartCommand(...); compare with dev.
  2. pnpm --filter @openwork-ee/cloud-runtime test and build; confirm dist/{contract,bootstrap,testing} exist.
  3. pnpm --filter @openwork-ee/den-api run build:workspace-dependencies then the export check in scripts/build.mjs reports no missing production exports for the new package.

Evidence

  • Verdict: Incomplete for runtime journey proof — no evals/specs journey drives the Cloud instance lifecycle (every spec runs Den with the stub provisioner), so there is no exact-head testkit tape to attach. Behaviour preservation rests on the byte-identical rendered scripts and the unit suites above. No Daytona API call changes in this PR.

Risk

  • Low: script rendering is a pure move (verified byte-identical); the new package has no consumers beyond the renderer.

Rollback

  • Revert the PR; daytona.ts returns to its inline templates. No data or config changes.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Deploying openwork with  Cloudflare Pages  Cloudflare Pages

Latest commit: 58f2312
Status: ✅  Deploy successful!
Preview URL: https://db2dc114.openwork.pages.dev
Branch Preview URL: https://feature-cloud-runtime-contra.openwork.pages.dev

View logs

@vercel

vercel Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 6, 2026 12:04am UTC
openwork-den Ready Ready Preview Sep 6, 2026 12:04am UTC
openwork-diagnostics Ready Ready Preview Sep 6, 2026 12:04am UTC
openwork-landing Ready Ready Preview, v0 Sep 6, 2026 12:04am UTC

@diff-warden diff-warden Bot 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (83d4c49ff3534edf93ea7ed807d38c143149278e). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@benjaminshafii

Copy link
Copy Markdown
Member

@OmarMcAdam Please review this cloud-runtime stack before merging. The PR explicitly reports incomplete live Cloud lifecycle journey proof; confirm the bootstrap move and runtime coverage. Related PRs are #4445 and #4446.

Holding for your review under the current merge instructions.

@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 5, 2026 19:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app September 5, 2026 19:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 5, 2026 19:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 5, 2026 19:55 Inactive
diff-warden[bot]
diff-warden Bot previously approved these changes Sep 5, 2026

@diff-warden diff-warden Bot 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (fd28ff971816f35c42ccf0288d4e318736042c6e). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

…ox bootstrap out of the Daytona module

Introduce @openwork-ee/cloud-runtime, the provider-neutral contract every
OpenWork Cloud sandbox host implements: capability descriptor, normalized
sandbox state and error taxonomy, opaque provider references, exec with logs,
endpoint with expiry, and storage attachment. The package also owns the
OpenWork bootstrap and checkpoint shell script as a renderer over an explicit
config, an in-memory fake provider, and a runner-agnostic conformance suite
that any provider must pass before Den can select it.

The Daytona provisioner now renders its start, flush, checkpoint-probe, and
restore-marker commands through the package. The rendered scripts are
byte-identical to the previous inline templates; no runtime behavior changes.

The Den API image copies the new workspace package so its production build
can verify the default export targets.

@diff-warden diff-warden Bot 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (58f23127b28dca50ab4457d2f9837ded28237e7a). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@reachjalil

Copy link
Copy Markdown
Member Author

Test evidence — first-cloud-task-provisions-once-over-mcp-preserves-access-boundaries-and-runs-w — ✅ passed

SHA 58f2312 · engine v1

✅ passed · 6 expectations passed · 0 failed · 0 pending

screenshots not attached (gh < 2.99; run brew upgrade gh)

verdict passed · 0 user observations · 0 probes · steps 0/0

ℹ️ ASSERTION — 1. Paid access is checked before provisioning

A valid write token in an organization without Web access was denied; zero worker rows and zero provider creates.

  • ✅ PASS Paid access is checked before provisioning — A valid write token in an organization without Web access was denied; zero worker rows and zero provider creates.

ℹ️ ASSERTION — 2. Only a valid write-scoped create can allocate a workspace

Read-only create, invalid input, read, and send allocated no workers and made no provider creates.

  • ✅ PASS Only a valid write-scoped create can allocate a workspace — Read-only create, invalid input, read, and send allocated no workers and made no provider creates.

ℹ️ ASSERTION — 3. Concurrent first requests share one provisioning attempt

Six MCP create calls returned retryable provisioning with no submitted session; one worker row and one Daytona HTTP create were observed, before any browser endpoint was called.

  • ✅ PASS Concurrent first requests share one provisioning attempt — Six MCP create calls returned retryable provisioning with no submitted session; one worker row and one Daytona HTTP create were observed, before any browser endpoint was called.

ℹ️ ASSERTION — 4. Retry runs the first task without browser setup, and the browser reuses its workspace

The real provisioner observed healthy HTTP, persisted ready state, and the MCP retry created one native session with the original prompt. A subsequent browser request reused that ready workspace without another sandbox.

  • ✅ PASS Retry runs the first task without browser setup, and the browser reuses its workspace — The real provisioner observed healthy HTTP, persisted ready state, and the MCP retry created one native session with the original prompt. A subsequent browser request reused that ready workspace without another sandbox.

ℹ️ ASSERTION — 5. Members get distinct workspaces

A second member's first call created a different worker and sandbox without creating a session on the first member's runtime.

  • ✅ PASS Members get distinct workspaces — A second member's first call created a different worker and sandbox without creating a session on the first member's runtime.

ℹ️ ASSERTION — 6. Lapsed paid access blocks new work even with an existing workspace

After the seeded subscription was canceled, the same token was denied and session, worker, and sandbox counts remained unchanged.

  • ✅ PASS Lapsed paid access blocks new work even with an existing workspace — After the seeded subscription was canceled, the same token was denied and session, worker, and sandbox counts remained unchanged.

Test run created 2026-09-06T00:04:07.436Z · Source: evals/results/test-runs/2026-09-06T00-04-07-435Z-first-cloud-task-provisions-once-over-mcp-preserves-access-boundaries-and-runs-w/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4444 --test-run 2026-09-06T00-04-07-435Z-first-cloud-task-provisions-once-over-mcp-preserves-access-boundaries-and-runs-w

@reachjalil
reachjalil merged commit 93d551f into dev Sep 6, 2026
40 checks passed

This branch was successfully deployed

4 active deployments
Preview – openwork-app — 58f23127 Deployed Sep 6, 2026 by vercel[bot]
Preview – openwork-landing — 58f23127 Deployed Sep 6, 2026 by vercel[bot]
Preview – openwork-den — 58f23127 Deployed Sep 6, 2026 by vercel[bot]
Preview – openwork-diagnostics — 58f23127 Deployed Sep 6, 2026 by vercel[bot]
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