feat(cubesandbox): exec-only provider (Phase 1, stacked on RFC #136) - #137
Open
JackWeiw wants to merge 1 commit into
Open
feat(cubesandbox): exec-only provider (Phase 1, stacked on RFC #136)#137JackWeiw wants to merge 1 commit into
JackWeiw wants to merge 1 commit into
Conversation
Add the cubesandbox provider (Cloud Hypervisor microVM, lifecycle-capable)
as an opt-in leaf submodule of env_provider, backed by the native
cubesandbox PyPI SDK (>=0.7.0). Phase 1 ships the exec-only surface:
create/detect/check_alive/cleanup/exec/save_ids over BaseSandboxManager
SDK seams (Sandbox.create/list/connect/kill + commands.run + get_info).
- src/env_provider/cubesandbox/{config,schemas,manager,__init__}.py +
tests (test_cubesandbox_manager.py + test_cubesandbox_provider.py,
36 tests; no live SDK needed -- fakes injected via monkeypatch).
- bench_core.bench: register --provider cubesandbox (CLI choices + lazy
_build_provider import; kernel stays SDK-free).
- pyproject: cubesandbox optional-dependency.
- config/common/replay*.yaml: cubesandbox: blocks (CUBE_* env, idle TTL).
default_replay_mode="exec_only", vmm_type=None (vm_monitor deferred).
SDK surface verified against CubeSandbox/sdk/python/cubesandbox 0.7.0:
Sandbox.list() returns a flat list[dict] (sandboxID key), commands.run ->
CommandResult(stdout, stderr, exit_code), native pause(wait=True), resume
via Sandbox.connect (deprecated resume()), get_info 404 -> dead. exec
maps a transport timeout to exit 124 (timeout(1) convention) so the
replay runner records a timed_out step and continues.
Phase 2 (separate stacked PR) adds LifecycleCapable/EphemeralCapable/
SnapshotSizeCapable and flips default_replay_mode to "lifecycle".
See RFC #136.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Phase 1 of the cubesandbox provider (Cloud Hypervisor microVM, lifecycle-capable), stacked on RFC #136 (
feat/cubesandbox-provider-rfc). This PR ships the exec-only baseline — the same surface cloud e2b has today — over the nativecubesandboxPyPI SDK.Scope (Phase 1 — exec-only)
New opt-in leaf submodule
src/env_provider/cubesandbox/:config.py—Config(CUBE_API_URL/KEY/TEMPLATE_ID/SANDBOX_DOMAINenv vars, template, idle TTL, ids_file, snapshot_dir) +setup_cube_env()(placeholder-credential skip; cube auth is optional, no CLI fallback)schemas.py—CubeSandboxState(handlecube_sandbox+ lifecycle flags + creation metrics)manager.py—CubesandboxManager(BaseSandboxManager)SDK seams + class attrs +detect_from_file+check_alive(control-planeget_info)__init__.py—CubesandboxProvider(EnvironmentProvider)adapter: create_all/detect_existing/detect_from_ids/save_ids/check_alive/cleanup_all/cleanup_existing/prepare_env/exec +_to_instance+build_providerRegistration + config:
bench_core.bench:--provider cubesandbox(CLI choices + lazy_build_providerimport; kernel stays SDK-free)pyproject.toml:cubesandboxoptional-dependency (cubesandbox>=0.7.0)config/common/replay{,-exec-only,-trajectory}.yaml:cubesandbox:blocks (CUBE_*env, idle TTL)default_replay_mode="exec_only",vmm_type=None(vm_monitor deferred).SDK surface (verified against source)
Read directly from
CubeSandbox/sdk/python/cubesandbox/(v0.7.0) — the manager seams bind to the real API, not assumptions:Sandbox.list()returns a flatlist[dict](keysandboxID) — not a paginator like e2bcommands.run(cmd, user, timeout, cwd, envs)→CommandResult(stdout, stderr, exit_code); raises only on transport/timeout (no partial output) →execmaps timeout → exit 124 so the replay runner records a timed_out step and continuespause(wait=True); resume viaSandbox.connect(id)(deprecatedresume());get_info()404 → dead (cleancheck_alive, no envd exec round-trip)SnapshotInfohas no size fields →snapshot_sizesdeferred to Phase 2 (returns None)Tests
36 new tests, no live SDK/cluster needed (fakes injected via monkeypatch, mirroring
test_e2b_manager.py/test_aenv_provider.py):test_cubesandbox_manager.py— SDK seams (create/envs=None, flat-list_list_existing, dict-key_external_id, connect_attach, exec probe, get_infocheck_alive) + base lifecycle (create_all / detect_existing / detect_from_file / cleanup_all / cleanup_existing)test_cubesandbox_provider.py— name/replay-mode/protocols,build_providerreads cubesandbox block,setup_cube_envplaceholder skip, exec success/timeout→124/transport-raise/cwd+envs forwarding,save_ids,_to_instancetemplate+idVerification
Stacking
feat/cubesandbox-provider-rfc) — this PR targets that branch.LifecycleCapable(pause/resume),EphemeralCapable(create_one/kill_one),SnapshotSizeCapable(returns None for v1), and flipsdefault_replay_modetolifecycle. vm_monitor integration (cube-hypervisor VMM type) is a follow-on.When #136 merges to main, this PR retargets to main.