vercel-sandbox
Investigate Vercel Sandbox lifecycle, timeout, snapshot, and persistence behavior. Use when users ask about Vercel Sandbox, `@vercel/sandbox`, `Sandbox.create`, `Sandbox.get`, why files disappeared, how snapshots differ from persistence, or whether Vercel's persistent sandbox beta applies.
- License 许可
- Apache-2.0
- 所属仓库
- getsentry/junior
- 最近更新
- 2026-11-15
- Stars
- ★ 421
- Forks
- 45
01 前言 Front Matter
- name
- vercel-sandbox
- description
- Investigate Vercel Sandbox lifecycle, timeout, snapshot, and persistence behavior. Use when users ask about Vercel Sandbox, `@vercel/sandbox`, `Sandbox.create`, `Sandbox.get`, why files disappeared, how snapshots differ from persistence, or whether Vercel's persistent sandbox beta applies.
02 资源文件 4
- 参考文档references/api-surface.md7.1 KB
- 参考文档references/common-use-cases.md9.0 KB
- 参考文档references/troubleshooting-workarounds.md8.5 KB
- 参考文档SOURCES.md12.9 KB
03 SKILL.md 正文
Investigate Vercel Sandbox using current official docs, installed SDK contracts, and only then any consumer-specific integration code.
Step 1: Classify the request
Pick the narrowest reference set before answering:
| Request type | Read first |
|---|---|
| SDK/API behavior, lifecycle semantics, snapshots, stable vs beta persistence | references/api-surface.md |
| Product-level usage patterns and architectural choices | references/common-use-cases.md |
| Broken behavior, confusing docs, missing files, or suspected persistence bugs | references/troubleshooting-workarounds.md |
If the task spans categories, load only the relevant files above.
Step 2: Establish which sandbox model applies
- Inspect the installed
@vercel/sandboxversion and local types before trusting any doc page or changelog. - If local types only expose
sandboxId,Sandbox.get({ sandboxId }),extendTimeout, and snapshot-backedsource, treat the runtime as stable 1.x ephemeral sandboxes. - If local code and types expose named sandboxes,
name,persistent, session updates, or automatic resume after stop, treat the runtime as the persistent beta model. - Qualify time-sensitive claims with a date or retrieval note.
Step 3: Apply core guardrails
- Distinguish three separate clocks before diagnosing workspace loss:
- Vercel function/runtime timeout
- Application/request timeout in the embedding system
- Sandbox timeout
- On stable 1.x,
Sandbox.get({ sandboxId })only helps while the sandbox is still alive. - On stable 1.x, once the sandbox stops, its filesystem is gone. Do not describe that as resumable persistence.
sandbox.snapshot()is not workspace durability. It creates a new snapshot artifact and stops the source sandbox.- Snapshots and persistent beta solve different problems:
- snapshots create new starting points
- persistent beta preserves named workspace state across sessions
- In embedded systems, inspect the consumer's persistence wiring before concluding that Vercel destroyed the workspace immediately.
- Do not infer persistent-beta behavior from a changelog alone. Confirm the installed SDK and local call sites.
Step 4: Investigate the Vercel surface first
- Check the installed SDK surface first:
- installed
@vercel/sandboxtypes - official stable docs for concepts, snapshots, SDK reference, and limits
- persistent-beta changelog only if named persistence is relevant
- installed
- Determine whether the question is about:
- active sandbox reuse
- stopped sandbox recovery
- snapshot-based warm starts
- persistent named workspaces
- Establish which timeout fired first and whether the sandbox should still have been active.
Step 5: Inspect consumer code only when the task is app-specific
For repo-local debugging in Junior, inspect:
- timeout budget alignment:
packages/junior/src/chat/config.tspackages/junior/src/chat/app/production.ts
- sandbox identity persistence and reuse:
packages/junior/src/chat/runtime/thread-state.tspackages/junior/src/chat/runtime/turn-preparation.tspackages/junior/src/chat/sandbox/session.ts
- whether timeout paths actually resume:
packages/junior/src/chat/agent/index.tspackages/junior/src/chat/agent/resume.tspackages/junior/src/chat/task-execution/paused-turn.ts
- where sandbox metadata is persisted:
packages/junior/src/chat/sandbox/session.ts(reports each new ref throughonSandboxRefChanged)packages/junior/src/chat/providers/slack/turn.tsandpackages/junior/src/chat/task-execution/conversation-turn.ts(save it to thread state)
- whether consumer-specific snapshots are being confused with Vercel product persistence:
packages/junior/src/chat/sandbox/snapshot/
Step 6: Recommend the smallest correct fix
Choose the narrowest fix that matches the diagnosed failure mode:
- Sandbox still alive but next turn started fresh:
- Persist sandbox identity earlier.
- Resume from the active sandbox instead of recreating it.
- Sandbox actually stopped:
- Increase sandbox timeout or extend it while work is active.
- Externalize intermediate outputs if they must survive stop.
- Confusion caused by docs drift:
- Align implementation advice to the installed SDK, not the newest beta docs.
- Need true durability across stop/timeout boundaries:
- Use external storage or migrate intentionally to the persistent beta model after confirming API availability.
Step 7: Return a concrete diagnosis
Default report structure:
- Active sandbox model:
stable-ephemeralorpersistent-beta - What likely timed out first
- Whether the sandbox probably still existed after the failed turn
- Whether workspace loss came from Vercel stop/destruction or consumer state handling
- Smallest next fix, with the exact file(s) or SDK change required
04 同仓库更多 Skills
pantry-stock
Report what the office pantry has in stock. Use when users ask which snacks or drinks the pantry has, or what is running low.
junior
Build, review, or update Junior extension skills and plugins. Use when users ask to create a Junior SKILL.md, app skill, plugin, plugin.yaml, packaged plugin, MCP-backed plugin, OAuth or credentialed plugin, or to validate Junior extension files. Do not use for ordinary Junior usage, provider workflows, generic code editing, or non-Junior agent-skill authoring.
junior-qa
Validate Junior changes through local app-facing paths. Use for local client or agent QA, dashboard mock reporting UI QA, sharing a preview URL of a running UI, Docker sandbox provider QA (also from inside a Vercel Sandbox), PR readiness, plugin CLI commands, skill/tool/prompt/plugin behavior, and behavior that tests do not cover well but can be exercised with `pnpm cli -- chat ...`, another `pnpm cli` command, or `JUNIOR_DASHBOARD_MOCK_CONVERSATIONS=true pnpm dev`.
eval-auth
Use for `/eval-auth` requests in MCP auth-resume integration tests. Always connect through the disclosed MCP tool before answering, then continue the user's actual request using prior thread context when needed.
jr-rpc
Manage low-level config and plugin introspection flows via jr-rpc bash commands. Use only when the user explicitly asks to read or update provider defaults/config or list installed plugins. Do not use for PR, branch, push, or auth-order questions; load the matching provider skill instead.
xdotcom
Read public X (Twitter) data through the read-only X API v2. Use when users share an x.com or twitter.com link, or ask what someone posted on X, what people are saying about a topic, product, or launch on X, how much chatter something got, or for a post's text, metrics, replies, or an account's recent posts. Do not use it to post, reply, like, repost, follow, or send DMs, or to read private or protected data.