Skip to content

fix(sandbox): bump @vercel/sandbox to v2 — production incident#148

Merged
sweetmantech merged 1 commit intomainfrom
fix/bump-vercel-sandbox-v2-prod-incident
May 4, 2026
Merged

fix(sandbox): bump @vercel/sandbox to v2 — production incident#148
sweetmantech merged 1 commit intomainfrom
fix/bump-vercel-sandbox-v2-prod-incident

Conversation

@sweetmantech
Copy link
Copy Markdown
Contributor

@sweetmantech sweetmantech commented May 4, 2026

🚨 Production incident fix

Sandboxes are failing in production with `Status code 404 is not ok`. This PR fixes the cross-repo dep mismatch that caused it.

Failing run for reference: https://cloud.trigger.dev/orgs/recoup-8a7d/projects/recoup-chat-bQni/env/prod/runs/run_cmorfev4q72dv0olrfwo1ysgc

Root cause

`tasks/` was on `@vercel/sandbox: ^1.8.0`. After api PR #503 bumped api to `2.0.0-beta.11` (merged 2026-05-02), api started creating sandboxes with v2-style names (`gray-common-whale-eGd9JS` instead of `sbx_xxx`). The v1 SDK in tasks couldn't resolve those names — `Sandbox.get({ sandboxId })` returned 404.

Stack trace from the failing run:

Status code 404 is not ok
  at parse (.../@vercel+sandbox@1.8.0/...base-client.ts:136)
  at Function.get (.../@vercel/sandbox/src/sandbox.ts:324)
  at run (file:///src/tasks/runSandboxCommandTask.ts:46)

Fix

Mirrors api's PR #503: dep bump + minimum v1 → v2 SDK surface fixes.

Change Files
Bump `@vercel/sandbox` 1.8.0 → 2.0.0-beta.11 `package.json`, `pnpm-lock.yaml`
`Sandbox.get({ sandboxId, ... })` → `Sandbox.get({ name: sandboxId, ... })` `sandboxes/getOrCreateSandbox.ts`, `tasks/runSandboxCommandTask.ts`
`sandbox.sandboxId` → `sandbox.name` (log fields only) `tasks/codingAgentTask.ts` (×1), `tasks/setupSandboxTask.ts` (×2), `tasks/updatePRTask.ts` (×2)
Test mocks use `{ name }` instead of `{ sandboxId }` for Sandbox instances `sandboxes/tests/getOrCreateSandbox.test.ts`

api's vocabulary preserved: HTTP response shape from `createAccountSandbox` still uses `sandboxId` (per the api migration's design decision). Translation to `name` only at the v2 SDK boundary.

Verification

Check Result
`pnpm install` ✅ clean
`pnpm test` 356/356 pass
SDK-related typecheck errors ✅ 0 (pre-existing unrelated typecheck failures in this repo are out of scope and predate this fix)

What this fixes (real-world impact)

  • `run-sandbox-command` Trigger task — used by chat for openclaw agent runs ✅
  • `coding-agent` Trigger task — sandbox stop log accuracy ✅
  • `setup-sandbox` Trigger task — sandbox setup logs ✅
  • `update-pr` Trigger task — PR-update sandbox lifecycle logs ✅

Cross-repo dependency note

After this lands, the version pin chain is consistent:

  • `api`: `@vercel/sandbox: 2.0.0-beta.11` ✓ (since PR #503)
  • `tasks`: `@vercel/sandbox: 2.0.0-beta.11` ✓ (this PR)
  • `chat`: still uses api over HTTP — not affected by SDK version

🤖 Generated with Claude Code


Summary by cubic

Bumps @vercel/sandbox to v2 and updates call sites to fix production 404s when reconnecting to v2-named sandboxes. Aligns tasks with API-created sandboxes so runs and logs work again.

  • Bug Fixes
    • Upgrade @vercel/sandbox 1.8.0 → 2.0.0-beta.11.
    • Use Sandbox.get({ name }) instead of { sandboxId }; translate API sandboxId to name at the SDK boundary.
    • Replace sandbox.sandboxId with sandbox.name in log fields.
    • Update test mocks and expectations for the new shape.

Written for commit 5719f34. Summary will update on new commits.

Production sandbox runs were failing with "Status code 404 is not ok"
after api PR #503 bumped @vercel/sandbox from 1.x to 2.0.0-beta.11.
Sandboxes created by api with v2-style names (e.g. gray-common-whale-eGd9JS)
could no longer be reconnected from tasks (v1.8.0) — v1's Sandbox.get
expects v1-style identifiers and returns 404 for the new format.

Failing run for reference:
  https://cloud.trigger.dev/orgs/recoup-8a7d/projects/recoup-chat-bQni/env/prod/runs/run_cmorfev4q72dv0olrfwo1ysgc

Mirrors api's PR #503: bump dep + minimal v1 -> v2 surface fixes:

  package.json
    "@vercel/sandbox": "^1.8.0" -> "2.0.0-beta.11"

  v1 -> v2 API rename: { sandboxId } -> { name } at the v2 boundary.
  api keeps "sandboxId" as its public vocabulary (HTTP responses, payloads,
  internal variables) — translation only happens at the SDK call.

  Production code (4 files):
    sandboxes/getOrCreateSandbox.ts:30  Sandbox.get({ sandboxId, ... })
                                          -> Sandbox.get({ name: sandboxId, ... })
    tasks/runSandboxCommandTask.ts:46   same pattern
    tasks/codingAgentTask.ts:83         sandbox.sandboxId -> sandbox.name (log)
    tasks/setupSandboxTask.ts:40,50     sandbox.sandboxId -> sandbox.name (×2)
    tasks/updatePRTask.ts:38,86         sandbox.sandboxId -> sandbox.name (×2)

  Tests (1 file):
    sandboxes/__tests__/getOrCreateSandbox.test.ts
      mock Sandbox.get return: { sandboxId } -> { name }
      Sandbox.get call assertion: { sandboxId } -> { name }

Verification:
  - pnpm install: clean
  - pnpm test: 356/356 pass
  - SDK-related typecheck errors: 0 (pre-existing unrelated typecheck
    issues in this repo are out of scope and predate this fix)

Cross-repo coordination note: api is on @vercel/sandbox 2.0.0-beta.11
since PR #503 (merged 2026-05-02). Tasks needs to match. Without this
fix, prod sandbox runs created via the new api code path are
unreachable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 2 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4f2504e7-a544-4abc-a0d1-f3a7d42ab3eb

📥 Commits

Reviewing files that changed from the base of the PR and between f9a0d2a and 5719f34.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • package.json
  • src/sandboxes/__tests__/getOrCreateSandbox.test.ts
  • src/sandboxes/getOrCreateSandbox.ts
  • src/tasks/codingAgentTask.ts
  • src/tasks/runSandboxCommandTask.ts
  • src/tasks/setupSandboxTask.ts
  • src/tasks/updatePRTask.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bump-vercel-sandbox-v2-prod-incident

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
Review rate limit: 0/1 reviews remaining, refill in 43 minutes and 2 seconds.

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

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 8 files

@sweetmantech sweetmantech merged commit d488ac8 into main May 4, 2026
3 checks passed
@sweetmantech sweetmantech deleted the fix/bump-vercel-sandbox-v2-prod-incident branch May 4, 2026 17:06
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