feat(core): add the Sandbox resource type and its capability contract - #387
Open
ItamarZand88 wants to merge 1 commit into
Open
feat(core): add the Sandbox resource type and its capability contract#387ItamarZand88 wants to merge 1 commit into
ItamarZand88 wants to merge 1 commit into
Conversation
Greptile SummaryAdds the
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/alien-core/src/resources/sandbox.rs | Defines the Sandbox declaration, capability matrix, validation rules, quantity parsing, and resource contracts. |
| crates/alien-core/src/sandbox_capability_token.rs | Adds feature-gated Ed25519 capability-token minting and signature-first claim verification. |
| crates/alien-bindings/src/traits.rs | Adds the provider-neutral Sandbox session and command binding interface. |
| crates/alien-preflights/src/compile_time/sandbox_platform_support.rs | Connects Sandbox platform validation to the plan-time preflight pipeline. |
| crates/alien-preflights/src/compile_time/sandbox_host_required.rs | Refuses GCP Sandbox declarations that have no Worker available to host the launcher. |
| crates/alien-preflights/src/mutations/gcp_sandbox_launcher.rs | Marks GCP Workers for sandbox-launcher support when the stack declares a Sandbox. |
| packages/core/src/sandbox.ts | Adds the TypeScript Sandbox builder and serializes its declaration into the shared resource shape. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Declaration["Sandbox declaration"] --> Preflight["Compile-time preflights"]
Preflight --> Capabilities["Platform capability matrix"]
Capabilities -->|Supported| Mutation["Platform mutations"]
Capabilities -->|Unsupported| Refusal["Typed plan-time refusal"]
Mutation --> Plan["Deployment plan"]
Plan --> Binding["Runtime Sandbox binding contract"]
Reviews (26): Last reviewed commit: "feat(core): add the Sandbox resource typ..." | Re-trigger Greptile
ItamarZand88
force-pushed
the
itamar/alien-75-sandbox-1-core
branch
24 times, most recently
from
August 11, 2026 22:16
33adf5d to
f294621
Compare
ItamarZand88
force-pushed
the
itamar/alien-75-sandbox-1-core
branch
from
August 11, 2026 22:24
f294621 to
999dd35
Compare
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.
Summary
Adds
alien.Sandbox— a declaration for an isolated environment that runs untrustedcode, typically code an LLM just wrote. This layer is the type and its rules only: no
backend, no package emitters, no runtime.
What happens when a stack declaring a sandbox is planned:
deadline — is refused here, rather than accepted and quietly ignored.
This PR changes a sandbox from something you cannot express to something the platform
either honours exactly or rejects with the reason.
What I did
Sandboxresource: where its filesystem comes from, its cpu/memory/diskceilings, its outbound network policy, and its session lifetime.
supports instead of discovering a gap through a failure. Backends differ more than
you would expect — one cannot reconnect to a session at all, and only one can
restrict egress to a list of hostnames.
platform with no backend, a GCP sandbox is refused without a workload to host it,
and a declared ceiling a platform cannot enforce is refused rather than dropped.
operation class and expiry, all verified after the signature.
linked from a worker.
Files touched
crates/alien-core/src/resources/sandbox.rs— the type, its limits, egress andsession policy, and the per-platform capability matrix
crates/alien-core/src/sandbox_capability{,_token}.rs— the operation classes andthe claims an agent verifies
crates/alien-core/src/{ownership,gateability,resource_links}.rs— registrationcrates/alien-preflights/src/compile_time/sandbox_*.rs— the plan-time refusalspackages/core/src/sandbox.ts— the TypeScript builderHow I tested
alien buildagainst each target.A ceiling GCP cannot enforce, and a session deadline only Kubernetes has, are both
refused at plan time naming the capability they needed — not accepted and dropped.
alien-core32 sandbox tests (the per-platform capability matrix, thelimit/egress/session refusals, quantity parsing);
alien-preflightsdrives theplatform gate through the runner rather than calling the check directly;
@alienplatform/core90 tests including the builder and its gateability.this layer. Runtime behaviour is exercised in the layers that add it.
I also ran a security review on the diff. What it checked:
session id and the generation it started under, and both are checked after the
signature (
sandbox_capability_token.rs).claims, so a replaced session voids them.
deliberately coarse (execute vs manage), so a new method cannot fall inside one
already granted.
it — refused at plan time instead, which the preflight test drives through the runner.
Nothing turned up.