Skip to content

Make transport configurable per instance#614

Merged
aron-cf merged 4 commits intomainfrom
configurable-transport
Apr 23, 2026
Merged

Make transport configurable per instance#614
aron-cf merged 4 commits intomainfrom
configurable-transport

Conversation

@aron-cf
Copy link
Copy Markdown
Contributor

@aron-cf aron-cf commented Apr 22, 2026

This adds a new transport config option to the getSandbox() interface. Which allows custom transport to be specified per instance rather than for all sandbox instances via a worker level environment variable.

This enables two things:

  1. Different sandboxes to use different transports.
  2. The use of multiple transports on the same sandbox.

Primarily this will enable us to reduce the number of workers and container images down to a single set in CI. Ideally the entire transport mechanism will go away shortly when we replace with a unified websocket based transport.

The integration tests have been updated to use this method via a TEST_TRANSPORT file written into the test worker directory and loaded into the environment via the vite env. The follow up will remove the dual tests in actions. Then this hack can go away.


Open in Devin Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

🦋 Changeset detected

Latest commit: 830bb25

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/sandbox Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/sandbox-sdk/@cloudflare/sandbox@614

commit: 830bb25

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

🐳 Docker Images Published

Variant Image
Default cloudflare/sandbox:0.0.0-pr-614-830bb25
Python cloudflare/sandbox:0.0.0-pr-614-830bb25-python
OpenCode cloudflare/sandbox:0.0.0-pr-614-830bb25-opencode
Musl cloudflare/sandbox:0.0.0-pr-614-830bb25-musl
Desktop cloudflare/sandbox:0.0.0-pr-614-830bb25-desktop

Usage:

FROM cloudflare/sandbox:0.0.0-pr-614-830bb25

Version: 0.0.0-pr-614-830bb25


📦 Standalone Binary

For arbitrary Dockerfiles:

COPY --from=cloudflare/sandbox:0.0.0-pr-614-830bb25 /container-server/sandbox /sandbox
ENTRYPOINT ["/sandbox"]

Download via GitHub CLI:

gh run download 24846181940 -n sandbox-binary

Extract from Docker:

docker run --rm cloudflare/sandbox:0.0.0-pr-614-830bb25 cat /container-server/sandbox > sandbox && chmod +x sandbox

@aron-cf aron-cf marked this pull request as draft April 22, 2026 15:55
@aron-cf aron-cf force-pushed the configurable-transport branch from 2146bdf to 09dfd17 Compare April 22, 2026 16:00
Comment thread tests/e2e/helpers/global-sandbox.ts Outdated
@aron-cf aron-cf force-pushed the configurable-transport branch 2 times, most recently from 26df32a to 6e31c7e Compare April 22, 2026 16:47
Comment thread tests/e2e/test-worker/generate-config.sh Outdated
@aron-cf aron-cf force-pushed the configurable-transport branch 4 times, most recently from 6eab7f7 to b3be316 Compare April 23, 2026 14:27
@aron-cf aron-cf marked this pull request as ready for review April 23, 2026 14:43
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 7 additional findings in Devin Review.

Open in Devin Review

Comment thread packages/sandbox/src/sandbox.ts
aron-cf added 4 commits April 23, 2026 17:17
This adds a new `transport` config option to the `getSandbox()`
interface. Which allows custom transport to be specified per instance
rather than for all sandbox instances via a worker level environment
variable.

This enables two things:

 1. Different sandboxes to use different transports.
 2. The use of multiple transports on the same sandbox.

Primarily this will enable us to reduce the number of workers and
container images down to a single set in CI. Ideally the entire
transport mechanism will go away shortly when we replace with a
unified websocket based transport.
This allows us to use one worker with multiple sandboxes rather than one
worker per transport.
@aron-cf aron-cf force-pushed the configurable-transport branch from c167c4f to 830bb25 Compare April 23, 2026 16:18
@aron-cf aron-cf merged commit 74a58e9 into main Apr 23, 2026
20 checks passed
@aron-cf aron-cf deleted the configurable-transport branch April 23, 2026 16:28
@sandy-bonk sandy-bonk Bot mentioned this pull request Apr 23, 2026
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