Add Dynamic Workers runtime for cloud code execution - #124
Merged
Conversation
Introduces @executor/runtime-dynamic-worker, a new CodeExecutor implementation that runs sandboxed code in isolated Cloudflare Workers via the WorkerLoader binding. Tool calls dispatch over Workers RPC through a ToolDispatcher that bridges back to the existing SandboxToolInvoker interface. Cloud app changes: - Wire dynamic worker executor into the execution engine - Centralize all Cloudflare bindings in env.ts (single boundary) - Replace dynamic imports and `as any` casts with static typed access - Add @cloudflare/workers-types and include worker-configuration.d.ts in tsconfig
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | fa15e05 | Commit Preview URL Branch Preview URL |
Apr 09 2026, 02:22 AM |
Vitest 4 changes the default test include pattern and exits with code 1 when no test files match. Add local vitest.config.ts to packages that were relying on the old default, with passWithNoTests for packages that have no tests yet. This unblocks @cloudflare/vitest-pool-workers for integration testing dynamic workers in the Workers runtime.
Tests run in the actual Workers runtime via @cloudflare/vitest-pool-workers. Covers ToolDispatcher RPC dispatch, full code execution via WorkerLoader, console capture, tool invocation through the proxy, timeout enforcement, and egress blocking with globalOutbound: null.
makeTestConfig sets scope.name to the cwd which defaults to "/test", not "test". Update the assertion to match.
RhysSullivan
added a commit
that referenced
this pull request
May 31, 2026
* Add Dynamic Workers runtime for cloud code execution Introduces @executor/runtime-dynamic-worker, a new CodeExecutor implementation that runs sandboxed code in isolated Cloudflare Workers via the WorkerLoader binding. Tool calls dispatch over Workers RPC through a ToolDispatcher that bridges back to the existing SandboxToolInvoker interface. Cloud app changes: - Wire dynamic worker executor into the execution engine - Centralize all Cloudflare bindings in env.ts (single boundary) - Replace dynamic imports and `as any` casts with static typed access - Add @cloudflare/workers-types and include worker-configuration.d.ts in tsconfig * Upgrade vitest to 4.1+ and @effect/vitest to 0.29 Vitest 4 changes the default test include pattern and exits with code 1 when no test files match. Add local vitest.config.ts to packages that were relying on the old default, with passWithNoTests for packages that have no tests yet. This unblocks @cloudflare/vitest-pool-workers for integration testing dynamic workers in the Workers runtime. * Add integration tests for dynamic worker execution Tests run in the actual Workers runtime via @cloudflare/vitest-pool-workers. Covers ToolDispatcher RPC dispatch, full code execution via WorkerLoader, console capture, tool invocation through the proxy, timeout enforcement, and egress blocking with globalOutbound: null. * Fix SDK test expecting wrong scope name makeTestConfig sets scope.name to the cwd which defaults to "/test", not "test". Update the assertion to match.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@executor/runtime-dynamic-workerpackage (packages/kernel/runtime-dynamic-worker/) — a newCodeExecutorimplementation that runs sandboxed code in isolated Cloudflare Workers via theWorkerLoaderbindingToolDispatcherthat bridges back to the existingSandboxToolInvokerinterfaceworker_loadersbinding configured inwrangler.jsoncHYPERDRIVE,LOADER,MARKETING) in a singlecfexport inenv.ts— replaces scattered dynamicimport("cloudflare:workers")calls andas anycasts with static typed access@cloudflare/workers-typesto the cloud app for proper type safetyTest plan
globalOutbound: nullblocks direct network access from sandboxed code