Skip to content

feat(example): demonstrate V8 sandbox suspend and resume - #4858

Open
drew wants to merge 8 commits into
mainfrom
feat/4857-v8-suspend-resume/drew
Open

drew wants to merge 8 commits into
mainfrom
feat/4857-v8-suspend-resume/drew

Conversation

@drew

@drew drew commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add suspend/resume to the V8 isolation-backend example and demonstrate retained JavaScript state through the OpenShell CLI. This PR is stacked on #4765; its diff contains only the example implementation and documentation.

Related Issue

Closes #4857

Depends on #4765 (shared sandbox lifecycle APIs, gateway, supervisor, and SDK support).

The author has verified repository ADMIN access; the linked issue does not yet have an acceptance label.

Changes

  • Retain the running V8 isolate in backend memory during suspension and continue it under a fresh supervisor generation on resume.
  • Keep restore-reference handoff private to the example driver and backend.
  • Preserve retained state after failed restores and readiness timeouts, and clean up failed supervisor launches.
  • Demonstrate a counter continuing through suspension in guest.js; document basic CLI commands in the example README.
  • Add focused tests for freezing, retained-state ownership, retry, and supervisor timeout cleanup.

Testing

  • Parent branch's existing V8 example builds with only unsupported-operation compatibility stubs.
  • Seven V8 example tests pass on the combined stack.
  • Fifteen gateway suspend/resume tests pass with the parent review fixes.
  • Repository commit checks pass, including workspace/example Clippy, formatting, protobuf lint, and Markdown lint.
  • Extraction preserves the previously tested example files byte for byte. The preceding CLI E2E held suspension for 14 seconds, resumed counts 1 through 12 without replaying initialization, and completed with exit code 0.

Limitations

State lives in backend process memory. Restarting the backend loses the retained isolate; use an explicit sandbox start for a clean boot. The example does not provide durable heap snapshots.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Relevant example implementation documentation updated

@drew
drew added this pull request to stack #4859 October 22, 2026 22:37
@drew
drew force-pushed the feat/4857-v8-suspend-resume/drew branch from 150563b to fafd76f Compare October 22, 2026 22:46
drew added 7 commits October 26, 2026 18:51
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
@drew
drew force-pushed the feat/4857-v8-suspend-resume/drew branch from fafd76f to e2360e3 Compare October 27, 2026 02:08
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
@drew
drew force-pushed the feat/4857-v8-suspend-resume/drew branch from e2360e3 to 0d96b77 Compare October 27, 2026 02:35
Base automatically changed from feat/sandbox-suspend-resume/drew to main October 27, 2026 03:21

This branch has not been deployed

No deployments
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