Skip to content

feat(ai-sandbox): add Blaxel provider - #1065

Open
SystemSculpt wants to merge 3 commits into
TanStack:mainfrom
SystemSculpt:ready/ai-sandbox-blaxel
Open

feat(ai-sandbox): add Blaxel provider#1065
SystemSculpt wants to merge 3 commits into
TanStack:mainfrom
SystemSculpt:ready/ai-sandbox-blaxel

Conversation

@SystemSculpt

@SystemSculpt SystemSculpt commented Aug 7, 2026

Copy link
Copy Markdown

🎯 Changes

  • Add @tanstack/ai-sandbox-blaxel as a managed cloud sandbox provider.
  • Implement filesystem access, native file watch, environment values, bounded process streaming, token-gated previews, and resume by id.
  • Reconcile ambiguous remote creates and process starts so cancellation cannot strand billed sandboxes or persistent processes, even when the SDK promise never settles.
  • Document setup, runtime requirements, capability limits, and cleanup behavior.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Safety and scope

  • Give each sandbox a one-hour TTL by default.
  • Gate preview URLs with a token by default.
  • Bound stdout and stderr to 8 MiB per stream, with remote process cleanup on overflow or cancellation.
  • Delete only the sandbox create attempt that owns the unique attempt label.
  • Keep killableProcesses false until child process-group termination has direct proof.
  • Keep snapshot, restore, and fork support disabled until Blaxel exposes reconstruct-after-delete semantics.
  • Reject conflicting process-global Blaxel credentials to prevent cross-workspace requests.
  • Keep all provider-specific behavior inside the new package. This PR makes no core sandbox contract changes.

Test plan

  • Complete uncached pnpm test:pr across 74 projects
  • Declaration scan: 780 files clean across 54 package build directories
  • Blaxel package: TypeScript, type-aware lint, Vite build, and strict publint
  • Credentialed Blaxel suite: 91 passed, 3 documented capability skips
  • Never-settling abort coverage for sandbox creation, exec, and spawn
  • Live create, exec, failure exit, filesystem, stream, preview auth, HTTP 401 denial, resume, destroy, and journal proof
  • No test-owned tanstack-ai-* sandbox remained after the credentialed suite
  • Live Terminal playground opened from the final worktree with a private one-hour sandbox
  • Full browser E2E: 444 passed, 1 skipped, 1 existing origin/main durability failure

Browser baseline note

The only browser failure is durable runs - takeover - a real disconnect, then an attach, continues the stream. It expects detachedSince to be cleared after completion.

The same assertion fails on every retry in a clean detached origin/main worktree after all 53 upstream packages are rebuilt. This PR does not change the test, route, persistence code, sandbox core, or durability code. That fix should stay outside this provider PR.

Review notes

  • @blaxel/core uses ^0.3.10, the current stable release at validation time.
  • Node 22.22.3 and GNU Coreutils were used for the complete local gate.
  • The effective diff is 17 files: one provider package, its tests, docs, one changeset, the provider list, and the lockfile.

Summary by CodeRabbit

  • New Features

    • Added Blaxel as a sandbox provider for cloud-based isolated environments.
    • Supports filesystem operations, Git commands, environment variables, command execution, process output streaming, file watching, previews, and sandbox resumption.
    • Added configurable images, memory, regions, work directories, time-to-live, and preview access settings.
    • Sandboxes default to a one-hour lifetime.
    • Snapshot, fork, restore, and writable process input are not supported.
  • Documentation

    • Added installation guidance, provider configuration details, capabilities, limitations, and usage examples for Blaxel.

Signed-off-by: Michael Stolarz <146425971+SystemSculpt@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b48b24cf-147e-45ec-894b-23fbd8c7b9ae

📥 Commits

Reviewing files that changed from the base of the PR and between e58d7bf and 6aab0b1.

📒 Files selected for processing (5)
  • packages/ai-sandbox-blaxel/src/handle.ts
  • packages/ai-sandbox-blaxel/tests/blaxel.test.ts
  • packages/ai-sandbox-blaxel/tests/handle.test.ts
  • packages/ai-sandbox-blaxel/tests/provider.test.ts
  • packages/ai-sandbox/README.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/ai-sandbox/README.md
  • packages/ai-sandbox-blaxel/tests/blaxel.test.ts
  • packages/ai-sandbox-blaxel/tests/handle.test.ts
  • packages/ai-sandbox-blaxel/src/handle.ts

📝 Walkthrough

Walkthrough

Adds the @tanstack/ai-sandbox-blaxel provider with filesystem, command execution, bounded process streaming, previews, environment handling, resume, destruction, tests, package configuration, and documentation.

Changes

Blaxel provider implementation

Layer / File(s) Summary
Provider lifecycle and package wiring
packages/ai-sandbox-blaxel/package.json, packages/ai-sandbox-blaxel/src/provider.ts, packages/ai-sandbox-blaxel/src/utils.ts, packages/ai-sandbox-blaxel/src/index.ts, packages/ai-sandbox-blaxel/tests/provider.test.ts, packages/ai-sandbox-blaxel/tsconfig.json, packages/ai-sandbox-blaxel/vite.config.ts
Adds provider configuration, credential validation, sandbox creation, resume, destruction, cleanup reconciliation, public exports, package metadata, and lifecycle tests.
Handle operations and process supervision
packages/ai-sandbox-blaxel/src/handle.ts, packages/ai-sandbox-blaxel/tests/handle.test.ts
Adds filesystem, Git, watch, command, bounded process output, cancellation, previews, environment merging, and destruction behavior with focused tests.
Integration and conformance validation
packages/ai-sandbox-blaxel/tests/blaxel.test.ts, packages/ai-sandbox-blaxel/tests/journal.conformance.test.ts
Adds credential-gated integration coverage for lifecycle, filesystem, processes, previews, resume, and conformance registration.
Documentation and release metadata
docs/sandbox/providers.md, docs/config.json, packages/ai-sandbox/README.md, packages/ai-sandbox-blaxel/CHANGELOG.md, .changeset/add-ai-sandbox-blaxel.md
Documents Blaxel configuration and capabilities and adds package release metadata.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant BlaxelProvider
  participant BlaxelSDK
  participant BlaxelHandle
  Client->>BlaxelProvider: create(config)
  BlaxelProvider->>BlaxelSDK: create sandbox
  BlaxelProvider->>BlaxelHandle: prepare workspace
  BlaxelHandle-->>Client: return sandbox handle
  Client->>BlaxelProvider: resume(id)
  BlaxelProvider->>BlaxelSDK: inspect sandbox
  BlaxelProvider-->>Client: return handle or null
Loading

Possibly related issues

Possibly related PRs

  • TanStack/ai#1015 — Introduces related sandbox capability and journal conformance patterns.

Suggested reviewers: tombeckenham

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: adding the Blaxel provider to ai-sandbox.
Description check ✅ Passed The description covers the change, checklist, release impact, safety scope, test plan, and known unrelated browser failure.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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

socket-security Bot commented Aug 7, 2026

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
Addednpm/​@​blaxel/​core@​0.3.106610010099100

View full report

@socket-security

socket-security Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm js-yaml is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/@blaxel/core@0.3.10npm/js-yaml@4.2.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/js-yaml@4.2.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Deprecated by its maintainer: npm @hey-api/client-fetch

Reason: Starting with v0.73.0, this package is bundled directly inside @hey-api/openapi-ts.

From: pnpm-lock.yamlnpm/@blaxel/core@0.3.10npm/@hey-api/client-fetch@0.10.2

ℹ Read more on: This package | This alert | What is a deprecated package?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@hey-api/client-fetch@0.10.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🧹 Nitpick comments (6)
packages/ai-sandbox-blaxel/tests/blaxel.test.ts (1)

1-3: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Place these tests alongside their source modules.

Both files use Vitest correctly, but both are outside the required colocated test layout.

  • packages/ai-sandbox-blaxel/tests/blaxel.test.ts#L1-L3: Move this test beside its relevant module under packages/ai-sandbox-blaxel/src/ and update its relative import.
  • packages/ai-sandbox-blaxel/tests/journal.conformance.test.ts#L1-L6: Move this test beside its relevant module under packages/ai-sandbox-blaxel/src/ and update its relative import.

As per coding guidelines, “Test files should be placed alongside source code as *.test.ts files using Vitest with happy-dom for DOM testing.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai-sandbox-blaxel/tests/blaxel.test.ts` around lines 1 - 3, Move
packages/ai-sandbox-blaxel/tests/blaxel.test.ts into the relevant source
directory under packages/ai-sandbox-blaxel/src/ and update its relative import
of blaxelSandbox. Move
packages/ai-sandbox-blaxel/tests/journal.conformance.test.ts alongside its
relevant source module under the same src directory and update its relative
import; retain the existing Vitest test behavior and naming.

Source: Coding guidelines

packages/ai-sandbox-blaxel/src/index.ts (1)

3-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Export BlaxelSandboxLike with BlaxelHandleDeps.

BlaxelHandleDeps.sandbox has type BlaxelSandboxLike, but that type is not re-exported. A consumer who constructs BlaxelHandle directly cannot name or implement the dependency type without deep-importing ./handle.

♻️ Proposed export addition
-export type { BlaxelHandleDeps } from './handle'
+export type {
+  BlaxelHandleDeps,
+  BlaxelSandboxLike,
+  BlaxelDirectoryLike,
+  BlaxelProcessLike,
+  BlaxelProcessRequestLike,
+  BlaxelPreviewLike,
+  BlaxelWatchEventLike,
+} from './handle'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai-sandbox-blaxel/src/index.ts` around lines 3 - 4, Update the
package exports alongside BlaxelHandleDeps to re-export the BlaxelSandboxLike
type from the handle module, allowing consumers to name or implement the sandbox
dependency without deep imports.
packages/ai-sandbox-blaxel/src/handle.ts (1)

383-399: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Escape \n consistently inside the generated shell script.

Lines 385, 398, and 399 are template literals, so '\n' becomes a real newline character in the emitted script rather than the two characters \ and n. The resulting printf still prints a newline, because a literal newline inside single quotes is valid shell. Line 442 uses '%s\\n' and emits the escape sequence instead. The two forms are equivalent today, but the embedded raw newlines split one logical script line into two and break if the script text is ever normalized or re-indented.

Use \\n in all three places for consistency with Line 442.

♻️ Proposed change
-        `  printf '%s' ${q(recordPrefix)}`,
+        `  printf '%s' ${q(recordPrefix)}`,
         `  base64 < ${chunkFile} | tr -d '\r\n'`,
-        `  printf '\n'`,
+        `  printf '\\n'`,
@@
-          `  printf '%s\n' ${q(label)} >> ${limitsFile}`,
-          `  printf '%s\n' ${q(overflowMarker)}`,
+          `  printf '%s\\n' ${q(label)} >> ${limitsFile}`,
+          `  printf '%s\\n' ${q(overflowMarker)}`,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai-sandbox-blaxel/src/handle.ts` around lines 383 - 399, Update the
generated shell-script strings in the surrounding chunk-processing logic to use
escaped backslash-n sequences consistently in all three affected printf calls,
matching the existing format used by the limits-file output. Ensure the emitted
script contains the two characters \ and n rather than embedding literal
newlines.
packages/ai-sandbox-blaxel/tests/provider.test.ts (1)

347-370: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Create the rejected deleteGate lazily to avoid an unhandled rejection.

deleteGate is assigned an already-rejected promise, but no handler attaches until SandboxInstance.delete runs, which happens after several awaited steps. Node can report unhandledRejection in that window and make the test flaky. Make the fake produce the rejection when delete is called.

♻️ Proposed change: reject inside the fake
-let deleteGate: Promise<Record<string, never>> | undefined
+let deleteGate: (() => Promise<Record<string, never>>) | undefined
@@
     delete: async (name: string) => {
       calls.deleted.push(name)
-      return deleteGate ?? {}
+      return deleteGate ? await deleteGate() : {}
     },

Then set deleteGate = () => Promise.reject({ status: 500, message: 'delete failed' }) in the affected tests. Apply the same pattern to the eagerly rejected createGate values at Lines 331 and 348.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai-sandbox-blaxel/tests/provider.test.ts` around lines 347 - 370,
Update the fake gate used by SandboxInstance.delete to create its rejected
promise only when delete is invoked, then change the affected tests to assign a
rejection-producing function instead of an already-rejected promise. Apply the
same lazy-rejection pattern to createGate in both affected create-error tests,
preserving their existing error assertions and call tracking.
packages/ai-sandbox-blaxel/tests/handle.test.ts (1)

703-725: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the live child-process cleanup failure-safe.

rmSync(outputDir!) and the child termination run only on the success path. If vi.waitFor at Line 707 or Line 718 fails, the test leaves a real /tmp/tanstack-ai-output-* directory and possibly live sleep 30 process groups on the machine. Move the cleanup into a try/finally.

The test also depends on bash being installed, because the generated wrapper ends with exec bash <supervisor>. On a runner without bash, the pids file never appears and the failure mode is an opaque waitFor timeout.

♻️ Proposed change
       const child = spawnChild('/bin/sh', ['-c', script], {
         stdio: 'ignore',
       })
-      const pidsPath = `${outputDir!}/pids`
-      await vi.waitFor(() => expect(existsSync(pidsPath)).toBe(true))
-      const pids = readFileSync(pidsPath, 'utf8')
-        .trim()
-        .split(/\s+/)
-        .map(Number)
-      const exited = new Promise<void>((resolve, reject) => {
-        child.once('error', reject)
-        child.once('exit', () => resolve())
-      })
-      child.kill('SIGTERM')
-      await exited
-      await vi.waitFor(() => {
-        for (const pid of pids) {
-          expect(() => process.kill(-pid, 0)).toThrow()
-        }
-      })
-      rmSync(outputDir!, { recursive: true, force: true })
+      try {
+        const pidsPath = `${outputDir!}/pids`
+        await vi.waitFor(() => expect(existsSync(pidsPath)).toBe(true))
+        const pids = readFileSync(pidsPath, 'utf8')
+          .trim()
+          .split(/\s+/)
+          .map(Number)
+        const exited = new Promise<void>((resolve, reject) => {
+          child.once('error', reject)
+          child.once('exit', () => resolve())
+        })
+        child.kill('SIGTERM')
+        await exited
+        await vi.waitFor(() => {
+          for (const pid of pids) {
+            expect(() => process.kill(-pid, 0)).toThrow()
+          }
+        })
+      } finally {
+        child.kill('SIGKILL')
+        rmSync(outputDir!, { recursive: true, force: true })
+      }
       resolveWait({ exitCode: 0, stdout: '', stderr: '' })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai-sandbox-blaxel/tests/handle.test.ts` around lines 703 - 725, Make
the child-process test cleanup failure-safe by wrapping the spawn, PID-file
wait, termination, and process-group assertions in a try/finally, ensuring the
child is terminated and outputDir is removed even when either vi.waitFor fails.
Also make the test explicitly skip or guard execution when bash is unavailable,
since the generated wrapper invokes bash and otherwise produces a timeout.
packages/ai-sandbox-blaxel/src/provider.ts (1)

255-260: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Reconciliation can delay the rejection by about 29 seconds and ignores input.signal.

findOwnedSandbox polls up to CREATE_RECONCILE_ATTEMPTS (30) times with a 1000 ms sleep. The mayHaveCreatedSandbox branch at Line 259 awaits that reconciliation before create() rejects. A caller that receives a 504 therefore waits about 29 seconds, and an abort raised during that window has no effect because input.signal is not passed into findOwnedSandbox.

Consider passing input.signal into the reconciliation loop and detaching the wait from the caller promise, as the abort path at Line 245 already does.

♻️ Sketch: stop polling once the caller aborts
   private async findOwnedSandbox(
     name: string,
     attemptId: string,
+    signal?: AbortSignal,
   ): Promise<BlaxelSandboxLike | undefined> {
     for (let attempt = 0; attempt < CREATE_RECONCILE_ATTEMPTS; attempt += 1) {
+      if (signal?.aborted) return undefined
       try {

Also applies to: 290-306

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai-sandbox-blaxel/src/provider.ts` around lines 255 - 260, Update
the mayHaveCreatedSandbox reconciliation path around cleanupOwnedSandbox so
create() rejects immediately instead of awaiting polling. Run
cleanupOwnedSandbox in a detached, safely handled promise as in the existing
abort path, and propagate input.signal through cleanupOwnedSandbox to
findOwnedSandbox so reconciliation stops when the caller aborts.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/ai-sandbox-blaxel/src/handle.ts`:
- Around line 956-958: Update the token creation flow around
preview.tokens.create so the expiry is derived from the configured
BlaxelSandboxConfig.previewTtl instead of the fixed PREVIEW_TOKEN_TTL_MS value.
Preserve the existing default behavior when previewTtl is unset, and ensure
longer configured preview lifetimes produce tokens that remain valid for the
full preview duration.

In `@packages/ai-sandbox-blaxel/tests/blaxel.test.ts`:
- Line 156: Update the test around provider.create({}) to register the returned
sandbox handle with the suite cleanup tracker immediately after creation,
ensuring afterAll can retry destroy even if later assertions or cleanup fail.

In `@packages/ai-sandbox/README.md`:
- Line 56: Update the provider installation documentation around the
`@tanstack/ai-sandbox-blaxel` entry to explicitly show installing the selected
provider package separately, or clearly state that provider packages must be
installed independently of the base package. Ensure the example uses the
provider package name shown in the table.

---

Nitpick comments:
In `@packages/ai-sandbox-blaxel/src/handle.ts`:
- Around line 383-399: Update the generated shell-script strings in the
surrounding chunk-processing logic to use escaped backslash-n sequences
consistently in all three affected printf calls, matching the existing format
used by the limits-file output. Ensure the emitted script contains the two
characters \ and n rather than embedding literal newlines.

In `@packages/ai-sandbox-blaxel/src/index.ts`:
- Around line 3-4: Update the package exports alongside BlaxelHandleDeps to
re-export the BlaxelSandboxLike type from the handle module, allowing consumers
to name or implement the sandbox dependency without deep imports.

In `@packages/ai-sandbox-blaxel/src/provider.ts`:
- Around line 255-260: Update the mayHaveCreatedSandbox reconciliation path
around cleanupOwnedSandbox so create() rejects immediately instead of awaiting
polling. Run cleanupOwnedSandbox in a detached, safely handled promise as in the
existing abort path, and propagate input.signal through cleanupOwnedSandbox to
findOwnedSandbox so reconciliation stops when the caller aborts.

In `@packages/ai-sandbox-blaxel/tests/blaxel.test.ts`:
- Around line 1-3: Move packages/ai-sandbox-blaxel/tests/blaxel.test.ts into the
relevant source directory under packages/ai-sandbox-blaxel/src/ and update its
relative import of blaxelSandbox. Move
packages/ai-sandbox-blaxel/tests/journal.conformance.test.ts alongside its
relevant source module under the same src directory and update its relative
import; retain the existing Vitest test behavior and naming.

In `@packages/ai-sandbox-blaxel/tests/handle.test.ts`:
- Around line 703-725: Make the child-process test cleanup failure-safe by
wrapping the spawn, PID-file wait, termination, and process-group assertions in
a try/finally, ensuring the child is terminated and outputDir is removed even
when either vi.waitFor fails. Also make the test explicitly skip or guard
execution when bash is unavailable, since the generated wrapper invokes bash and
otherwise produces a timeout.

In `@packages/ai-sandbox-blaxel/tests/provider.test.ts`:
- Around line 347-370: Update the fake gate used by SandboxInstance.delete to
create its rejected promise only when delete is invoked, then change the
affected tests to assign a rejection-producing function instead of an
already-rejected promise. Apply the same lazy-rejection pattern to createGate in
both affected create-error tests, preserving their existing error assertions and
call tracking.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a619c30d-f13a-4915-9c71-75bf2d5c4d53

📥 Commits

Reviewing files that changed from the base of the PR and between 7d92296 and e58d7bf.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • .changeset/add-ai-sandbox-blaxel.md
  • docs/config.json
  • docs/sandbox/providers.md
  • packages/ai-sandbox-blaxel/CHANGELOG.md
  • packages/ai-sandbox-blaxel/package.json
  • packages/ai-sandbox-blaxel/src/handle.ts
  • packages/ai-sandbox-blaxel/src/index.ts
  • packages/ai-sandbox-blaxel/src/provider.ts
  • packages/ai-sandbox-blaxel/src/utils.ts
  • packages/ai-sandbox-blaxel/tests/blaxel.test.ts
  • packages/ai-sandbox-blaxel/tests/handle.test.ts
  • packages/ai-sandbox-blaxel/tests/journal.conformance.test.ts
  • packages/ai-sandbox-blaxel/tests/provider.test.ts
  • packages/ai-sandbox-blaxel/tsconfig.json
  • packages/ai-sandbox-blaxel/vite.config.ts
  • packages/ai-sandbox/README.md

Comment thread packages/ai-sandbox-blaxel/src/handle.ts
Comment thread packages/ai-sandbox-blaxel/tests/blaxel.test.ts Outdated
Comment thread packages/ai-sandbox/README.md
@SystemSculpt

Copy link
Copy Markdown
Author

Thanks, these were useful catches. I fixed the preview-token lifetime, made the live cleanup tests safer, clarified the provider install step, and cleaned up the two smaller test and shell-script issues.

I kept the tests in tests/ because that matches every other sandbox provider. I also kept ambiguous-create cleanup blocking and independent of caller aborts. Making that cleanup detached or abortable can leave a paid sandbox behind, especially with ttl: null.

Everything passes again: the full uncached PR gate across all 74 projects, plus 93 live Blaxel tests with 3 expected capability skips. No test sandboxes were left behind.

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.

1 participant