Skip to content

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

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

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
Contributor

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
drew force-pushed the feat/4857-v8-suspend-resume/drew branch from fafd76f to e2360e3 Compare October 27, 2026 02:08
@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
@rhuss

rhuss commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Heads-up: the Go SDK moves to ai-openshell/sdk-go on 2026-11-03 (#5031). This PR also changes hand-written SDK code under sdk/go/openshell/. Please keep it in the PR, since core still builds sdk/go until its Go CI gate is dropped. After the freeze, sdk/go here is a deprecated snapshot. Once this PR merges and its protos ship in a core release, the SDK part gets ported to sdk-go with your authorship. Nothing to do on your side.

@github-actions

Copy link
Copy Markdown

This pull request has had no activity for 14 days and is now marked stale.

@github-actions github-actions Bot added the state:stale Inactive item at risk of automatic closure. label Nov 17, 2026
@drew drew closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:stale Inactive item at risk of automatic closure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(example): demonstrate V8 sandbox suspend and resume

2 participants