sandbox-lifecycle-debug

bởi vercel

Gỡ lỗi vòng đời sandbox cho vercel-openclaw: tạo, tiếp tục, dừng, chụp nhanh, đặt lại, điều phối tiến trình chạy cũ, hành vi Sandbox v2 liên tục, nóng…

npx skills add https://github.com/vercel-labs/vercel-openclaw --skill sandbox-lifecycle-debug

Sandbox Lifecycle Debug

Use this skill when the sandbox state machine is the primary suspect.

For Sandbox v2 truth-model work, also load sandbox-v2-lifecycle. Official Vercel Sandbox v2 docs override older repo guidance that treats manual snapshots as the normal restore source.

Start Here

Read lat.md/sandbox-lifecycle.md sections Status State Machine, Triggers -- What Causes State Transitions, and the specific trigger involved. Run lat locate "Sandbox Lifecycle" or lat search "sandbox lifecycle <symptom>" when unsure.

Collect before edits:

  • GET /api/status and any UI state that triggered the action.
  • GET /api/admin/sandbox-diag.
  • GET /api/admin/logs filtered for sandbox., gateway., watchdog., proxy..
  • Local git rev-parse HEAD, remote git ls-remote origin main, and live deployment proof.

Split The State

Report these separately:

  • metadata status in SingleMeta.status
  • Vercel Sandbox SDK status
  • gateway readiness on port 3000
  • persistent auto-saved state availability
  • manual snapshot/checkpoint availability when relevant
  • lifecycle lock and start lock state when visible
  • UI polling status

Do not use running as shorthand for gateway-ready or user-ready.

Common Paths

  • Admin ensure: /api/admin/ensure -> ensureSandboxRunning() / ensureSandboxReady().
  • Gateway request: auth -> ensureSandboxRunning() -> token refresh -> touchRunningSandbox() -> proxy.
  • Stop/auto-save: stopSandbox() -> cleanup -> cron persistence -> sandbox.stop({ blocking: false }) -> snapshotting host metadata while v2 persists state.
  • Status polling: GET /api/status -> stale running or snapshotting reconciliation.
  • Reset: resetSandbox() destroys active sandbox and snapshots, clears cron and token metadata.

Sandbox v2 Rules

  • Main OpenClaw sandbox is one named persistent sandbox.
  • Normal resume uses the persistent name and auto-saved state, not manual snapshotId.
  • Observation of stopped/snapshotting state must use resume:false.
  • Manual snapshot() is explicit/debug/checkpoint only and shuts the sandbox down.
  • Worker/debug sandboxes are short-lived and must use persistent:false.

Fix Boundaries

  • Primary: src/server/sandbox/lifecycle.ts, src/server/sandbox/controller.ts.
  • Routes: src/app/api/admin/{ensure,stop,snapshot,reset,status}/** and src/app/api/status/route.ts.
  • Tests: lifecycle and harness tests under src/server/sandbox/**.test.ts and src/test-utils/harness.
  • Docs: lat.md/sandbox-lifecycle.md, docs/lifecycle-and-restore.md.

Verification

Use the narrowest command that covers the path, then run the repo verifier when the change has broad lifecycle impact:

node scripts/verify.mjs --steps=test,typecheck
lat check

For live lifecycle incidents, include before/after /api/status, /api/admin/sandbox-diag, and relevant log events.

Thêm skills từ vercel

benchmark-sandbox
vercel
Chạy các kịch bản đánh giá vercel-plugin trong Vercel Sandboxes thay vì các bảng WezTerm cục bộ. Cung cấp các microVM tạm thời với Claude Code và plugin được cài đặt sẵn,…
official
emil-design-eng
vercel
Kỹ năng này mã hóa triết lý của Emil Kowalski về trau chuốt giao diện người dùng, thiết kế thành phần, quyết định hoạt ảnh và những chi tiết vô hình giúp phần mềm mang lại cảm giác tuyệt vời.
official
vercel-react-best-practices
vercel
Hướng dẫn tối ưu hiệu suất React và Next.js từ Vercel Engineering. Kỹ năng này nên được sử dụng khi viết, xem xét hoặc tái cấu trúc mã React/Next.js…
official
vercel-react-best-practices
vercel
Hướng dẫn tối ưu hiệu suất React và Next.js từ Vercel Engineering. Kỹ năng này nên được sử dụng khi viết, xem xét hoặc tái cấu trúc mã React/Next.js…
official
write-guide
vercel
Tạo một hướng dẫn kỹ thuật dạy một trường hợp sử dụng thực tế thông qua các ví dụ tiến dần. Các khái niệm chỉ được giới thiệu khi người đọc cần đến chúng.
official
release
vercel
Phát hành vercel-plugin — chạy các cổng, tăng phiên bản, tạo tạo phẩm, commit và push. Sử dụng khi được yêu cầu "phát hành", "ship", "tăng và push", hoặc "cắt một bản phát hành".
official
deepsec
vercel
Chạy DeepSec trên bản checkout dự án Vercel từ dev3000. Sử dụng để thiết lập DeepSec một chạm, khởi tạo ngữ cảnh dự án, xử lý lần đầu có giới hạn, và…
official
backport-pr
vercel
Backport một pull request Next.js đã được merge từ canary sang một nhánh phát hành trước đó như next-16-2. Sử dụng khi người dùng yêu cầu backport, cherry-pick, hoặc mở một…
official