Skip to content

feat(ai-sandbox-upstash-box): add Upstash Box sandbox provider#899

Draft
alitariksahin wants to merge 1 commit into
TanStack:mainfrom
alitariksahin:feat/upstash-box-sandbox-provider
Draft

feat(ai-sandbox-upstash-box): add Upstash Box sandbox provider#899
alitariksahin wants to merge 1 commit into
TanStack:mainfrom
alitariksahin:feat/upstash-box-sandbox-provider

Conversation

@alitariksahin

Copy link
Copy Markdown

Closes #898

What

Adds @tanstack/ai-sandbox-upstash-box, a sandbox provider that runs harness adapters inside isolated Upstash Box cloud sandboxes through the uniform SandboxHandle — alongside Docker / Daytona / Vercel / Cloudflare / Sprites.

How

Built on the Daytona provider as the closest reference:

  • fs — Box's native file API for read/write/list; shell (exec) for mkdir/remove/rename/exists. Virtual /workspace ↔ Box /workspace/home (Box.WORKSPACE) path mapping; list() returns paths in the caller's virtual namespace.
  • exec / spawn — shell-wrap cwd + env; env exports go before cd so a failed cd (&&-gated) doesn't run the command. spawn() streams stdout over exec.stream; wait() resolves on the exit chunk; kill() aborts via an AbortController that unblocks a silent stream. writableStdin: false (Daytona parity).
  • portsgetPublicURL, mapping bearer/basic auth to channel headers.
  • snapshots — native box.snapshot() / Box.fromSnapshot(), plus provider.restoreSnapshot().
  • capabilitiesbackgroundProcesses: true, snapshots: true, durableFilesystem: true; writableStdin/networkPolicy/fork false. Best-effort signal.throwIfAborted() pre-flight on create/resume/restoreSnapshot/destroy/exec/spawn (the Box SDK can't cancel in-flight calls).

Also updates the central provider-list table in @tanstack/ai-sandbox's README and adds a changeset.

Test plan

  • pnpm --filter @tanstack/ai-sandbox-upstash-box test:types — ✅
  • pnpm --filter @tanstack/ai-sandbox-upstash-box test:eslint — ✅
  • pnpm --filter @tanstack/ai-sandbox-upstash-box test:build (publint) — ✅
  • pnpm --filter @tanstack/ai-sandbox-upstash-box build — ✅
  • pnpm --filter @tanstack/ai-sandbox-upstash-box test:lib — ✅ 18 tests
    • Unit tests run against a mocked Box (path mapping, cwd/env wrapping, spawn streaming + silent-stream kill(), public-URL mapping, capability flags).
    • Gated integration tests (describe.skipIf(!UPSTASH_BOX_API_KEY)) run against live Upstash Box: create → exec → text/binary fs round-trip → streamed spawn → destroy, and snapshot → restoreSnapshot → verify file survives.
  • pnpm test:sherif / pnpm test:knip — ✅

Sandbox providers aren't part of the E2E harness matrix (testing/e2e/feature-support.ts covers chat/streaming adapters); this follows the Daytona/Docker/Vercel convention of gated integration tests in the package's own tests/.

Draft / blocked on

Opened as a draft because pnpm-lock.yaml still needs the @upstash/box entry. The lockfile couldn't be regenerated in my dev environment (registry/CDN metadata issues unrelated to this change). Will push the lockfile update to make CI green before marking ready for review.

Add @tanstack/ai-sandbox-upstash-box, a provider that runs harness adapters
inside isolated Upstash Box cloud sandboxes through the uniform SandboxHandle:

- fs via Box's native file API (read/write/list) + shell for mkdir/remove/
  rename/exists; paths normalized between the virtual /workspace root and Box's
  /workspace/home session home
- exec/spawn shell-wrap cwd + env (exports before `cd` so a failed cd is
  &&-gated); spawn streams stdout over exec.stream with abort-driven kill()
- ports.connect via getPublicURL (bearer/basic auth -> channel headers)
- native snapshots (box.snapshot / Box.fromSnapshot) and restoreSnapshot
- backgroundProcesses: true / writableStdin: false (Daytona parity); fork
  unsupported

Includes unit tests (mocked Box) and gated integration tests
(UPSTASH_BOX_API_KEY), README, changeset, and the central provider-list row.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1c3499df-1e47-40ec-a8d5-39d22ee1a68b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​upstash/​box@​0.5.174100100100100

View full report

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.

Add Upstash Box sandbox provider (@tanstack/ai-sandbox-upstash-box)

1 participant