Skip to content

Bring Node sandbox features in line with Python SDK - #122

Merged
Dingway98 merged 15 commits into
mainfrom
devin/1790627036-python-sdk-parity
Sep 28, 2026
Merged

Dingway98 merged 15 commits into
mainfrom
devin/1790627036-python-sdk-parity

Conversation

@shrisukhani

@shrisukhani shrisukhani commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bring Node sandbox functionality in line with Python SDK 1.9.1. Commands collect complete output from the initial stream and report incomplete output explicitly. Image helpers support remote Dockerfile builds, local Docker imports, deterministic identities, cache reuse, and joining compatible builds.

Add streaming file transfers, resumable watch handles, snapshot startup, runtime sessions, and consistent request deadlines, cancellation, retries, and cleanup. Preserve existing Node APIs and gVisor support. Public helpers and handles are available through root and subpath exports. Tests are organized into unit, local integration, and live E2E projects in one Vitest config; default and watch commands run only local tests.

Validation

  • Build, source/test typechecking, lint, and 640 local regression tests pass.
  • Validated on Linux Node 20/22/24 and macOS Node 24, including installed CommonJS/ESM/TypeScript consumers and real Docker 29.4.2 packaging.
  • Live dev and production validation covered image build/reuse, lifecycle, processes, 20 MiB file transfers, watches, terminals, exposure, and snapshot restore.

Live volume tests are excluded by request; local volume contracts remain covered. Windows and additional Docker versions are unverified. Python-specific Pydantic models and sync/async entry points use native TypeScript contracts and Promises.

Streamed command starts require receiver support. Nullable response types and local launch validation can require consumer updates; release as the next minor version. This PR does not publish a package.


Note

High Risk
Large changes to sandbox runtime transport, process/file streaming, and new image-build upload paths; behavior and nullable API shapes may break consumers expecting the old request/response exec model.

Overview
This PR brings the Node sandbox client toward parity with the Python SDK: streaming process execution, image build/reuse, streaming files and watches, plus clearer errors, retries, and test layout.

Processes: exec() and processes.start() now open a single SSE stream from process start and collect full stdout/stderr locally (with maxOutputBytes, sequence checks, and structured errors). Local wait() timeouts do not stop collection; disconnect() / AbortSignal stop local collection without killing the remote process. RuntimeTransport gains openSSE (including POST starts), read-idle timeouts, and binary streamBytes.

Files & watches: Adds uploadStream / downloadStream, public SandboxFileWatchHandle with refresh, resumable events() (ws/stream routes), getWatch, rename overwrite, and convenience aliases (stat, mkdir, move, delete).

Image builds: New @hyperbrowser/sdk/image-builds (and root exports) for Dockerfile context fingerprinting/packaging, .dockerignore matching, local linux/amd64 Docker import via CLI, deterministic imageBuildName, artifact upload, and sandboxes helpers such as getOrBuildImage() with reuse/join/create flows (documented in README).

Platform: HyperbrowserError moves to error.ts with optional method/path; control-plane GETs retry 429/5xx and transient network errors; HYPERBROWSER_BASE_URL overrides the API base. Package adds engines (Node ≥20.20.2), typecheck, subpath exports for sandbox/image-builds, and Vitest unit / integration / e2e projects so default yarn test needs no API key or Docker.

Reviewed by Cursor Bugbot for commit 156b495. Bugbot is set up for automated code reviews on this repo. Configure here.

Add remote/local image builds (Dockerfile context manifests, Docker image
manifests, deterministic fingerprints, ready-image reuse and build joining),
streamed process start with complete output collection, configurable image
builder resources, and transient GET retries on the control transport.
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread src/sandbox/base.ts
@shrisukhani

Copy link
Copy Markdown
Contributor Author

@claude review this PR thoroughly and find any problems with it

Dingway98 and others added 5 commits September 28, 2026 13:39
Collected output now survives the replay window on the original handle
(410 only applies to a re-attached handle), local wait timeouts raise
wait_timeout, and snapshot list limits respect the server's 100 maximum.
…ty' into codex/sandbox-parity-pr122

# Conflicts:
#	tests/sandbox/e2e/process.test.ts
@Dingway98 Dingway98 changed the title Bring sandbox SDK to parity with the Python SDK Complete sandbox feature parity with the Python SDK Sep 28, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6c67ce7. Configure here.

Comment thread src/sandbox/files.ts
Comment thread src/services/sandboxes.ts Outdated
@Dingway98 Dingway98 changed the title Complete sandbox feature parity with the Python SDK Bring Node sandbox features in line with Python SDK Sep 28, 2026
@Dingway98
Dingway98 merged commit e1bd32d into main Sep 28, 2026
3 checks passed
@Dingway98
Dingway98 deleted the devin/1790627036-python-sdk-parity branch September 28, 2026 23:07
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