sandbox API
Table of Contents
upsquad/sandbox/v1/launcher.proto
AcquireWorkspaceRequest
AcquireWorkspaceRequest asks for a pinned shallow checkout.
| Field | Type | Label | Description |
|---|---|---|---|
| org_id | string | org_id, team_id scope the authorization the caller already performed; the launcher labels and bounds by them. | |
| team_id | string | team_id is the team whose source grant authorised this acquisition. | |
| run_id | string | run_id is the run the workspace is bound to. | |
| step | string | step is the dispatch step (roster agent_ref). | |
| ordinal | int32 | ordinal is the dispatch ordinal; (run_id, step, ordinal) is the workspace's execution identity (ADR-0037 D1). | |
| provider_host | string | provider_host is the SCM host (e.g. "github.com"), lower-case, matched exactly against the launcher's configured provider hosts. | |
| repo | string | repo is the repository as owner/name, matching ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$. | |
| ref | string | ref is the branch, tag or commit to check out; "" = default branch. At most 255 bytes and never starting with "-". A branch or tag can move between the founder-signoff gate and the clone, so a READ_WRITE dispatch should pass a commit; the pinned commit stamped on the result (AcquireWorkspaceResponse.commit, ADR-0037 D5) is the record of what was checked out. | |
| mode | WorkspaceMode | mode is the mount posture. | |
| clone_credential | CloneCredential | clone_credential is the one-time clone credential. | |
| max_bytes | int64 | max_bytes caps the working tree size the launcher will keep; a larger checkout is deleted and refused (resource_exhausted). At most the launcher's ceiling (invalid_argument above it). |
AcquireWorkspaceResponse
AcquireWorkspaceResponse identifies the checkout and its pin.
| Field | Type | Label | Description |
|---|---|---|---|
| workspace_id | string | workspace_id names the workspace for ServeSpec.workspace_id and ReleaseWorkspace. Launcher-issued, at least 128 bits of randomness. | |
| commit | string | commit is the pinned commit (git rev-parse HEAD after checkout). | |
| tree_bytes | int64 | tree_bytes is the working-tree size after checkout. | |
| fetched_bytes | int64 | fetched_bytes is what the clone transferred (shallow-clone evidence). |
CloneCredential
CloneCredential is the short-lived SCM credential the ORCHESTRATOR resolved from the vault for this one acquisition (ADR-0037 D3). The launcher uses it for the clone and discards it; it is never written to .git/config, never on argv, never logged, never in any sandbox environment.
| Field | Type | Label | Description |
|---|---|---|---|
| kind | string | kind is the provider token kind (e.g. "github_installation_token"). | |
| token | string | token is the secret. Never logged. | |
| expires_at | google.protobuf.Timestamp | expires_at is when the token stops working. REQUIRED: the launcher refuses an unset one (invalid_argument) and an expired one (failed_precondition). |
GetRuntimeRequest
GetRuntimeRequest is empty.
GetRuntimeResponse
GetRuntimeResponse reports the resolved runtime.
| Field | Type | Label | Description |
|---|---|---|---|
| runtime | string | runtime is "runsc" or "runc". |
LaunchOutcome
LaunchOutcome is the RAW batch result before the caller's output cap and termination mapping (sandbox.LaunchOutcome).
| Field | Type | Label | Description |
|---|---|---|---|
| exit_code | int32 | exit_code is the process exit code. | |
| stdout | bytes | stdout is the captured (capped) stdout. | |
| stderr | bytes | stderr is the captured (capped) stderr. | |
| output_artifacts | OutputBlob | repeated | output_artifacts are the captured declared outputs. |
| cpu_seconds | double | cpu_seconds is the metered cpu time. | |
| oom_killed | bool | oom_killed reports a memory cgroup kill. | |
| pids_exceeded | bool | pids_exceeded reports a pids.max kill. | |
| disk_exceeded | bool | disk_exceeded reports a /work disk-cap kill. | |
| egress_denied | string | repeated | egress_denied lists hosts the proxy refused. |
LaunchRequest
LaunchRequest carries one batch spec.
| Field | Type | Label | Description |
|---|---|---|---|
| spec | RunSpec | spec is the launch. |
LaunchResponse
LaunchResponse carries the raw outcome.
| Field | Type | Label | Description |
|---|---|---|---|
| outcome | LaunchOutcome | outcome is the raw result. |
MaterializedInput
MaterializedInput is one input artifact mounted read-side (sandbox.MaterializedInput). The count of inputs and their total bytes per request are bounded by the launcher's configured ceilings (invalid_argument above them).
| Field | Type | Label | Description |
|---|---|---|---|
| path | string | path is the sandbox-relative path under /work. | |
| content | bytes | content is the artifact bytes (already quota-capped by the caller). |
OutputBlob
OutputBlob is one declared output artifact the sandbox produced (sandbox.OutputBlob).
| Field | Type | Label | Description |
|---|---|---|---|
| path | string | path is the sandbox-relative path it was captured from. | |
| content | bytes | content is the captured bytes (output-capped). |
ProbeServedRequest
ProbeServedRequest asks whether a served sandbox is ready.
| Field | Type | Label | Description |
|---|---|---|---|
| sandbox_session_id | string | sandbox_session_id is the launcher-issued session to probe; the launcher dials the endpoint it issued for it, never a caller-named one. | |
| readiness_path | string | readiness_path is the path to GET; "" = "/". |
ProbeServedResponse
ProbeServedResponse reports readiness.
| Field | Type | Label | Description |
|---|---|---|---|
| ready | bool | ready is true on a 2xx/3xx. |
ReleaseWorkspaceRequest
ReleaseWorkspaceRequest deletes a workspace.
| Field | Type | Label | Description |
|---|---|---|---|
| workspace_id | string | workspace_id is the workspace to delete. |
ReleaseWorkspaceResponse
ReleaseWorkspaceResponse reports what changed in the tree before deletion (git status --porcelain, computed by the launcher — the platform's record of changed paths, never the model's).
| Field | Type | Label | Description |
|---|---|---|---|
| changed_paths | string | repeated | changed_paths are paths modified, added or deleted relative to the pin. |
| dirty | bool | dirty is true when changed_paths is non-empty. |
RenewLeaseRequest
RenewLeaseRequest extends a session's lease.
| Field | Type | Label | Description |
|---|---|---|---|
| sandbox_session_id | string | sandbox_session_id is the session. |
RenewLeaseResponse
RenewLeaseResponse reports the new expiry.
| Field | Type | Label | Description |
|---|---|---|---|
| lease_until | google.protobuf.Timestamp | lease_until is the new expiry. |
ResourceLimits
ResourceLimits are the HARD caps of one sandbox (sandbox.ResourceLimits). Post-clamp: the orchestrator clamped them to the org/tier policy; the launcher refuses a value above its own ceilings and never widens one. Every axis is REQUIRED and > 0: a zero or negative axis is refused (invalid_argument), never defaulted and never read as "no limit".
| Field | Type | Label | Description |
|---|---|---|---|
| cpu_millis | int32 | cpu_millis is the cgroup cpu cap in milli-cores. | |
| memory_mib | int32 | memory_mib is the OOM-kill cap in MiB. | |
| wall_seconds | int32 | wall_seconds is the in-sandbox hard-kill deadline. | |
| disk_mib | int32 | disk_mib caps /work (and ephemeral storage) in MiB. | |
| pids_max | int32 | pids_max is the fork-bomb cap. | |
| output_max_bytes | int64 | output_max_bytes caps stdout+stderr. |
RunSpec
RunSpec is the fully resolved, already governed batch launch request (sandbox.RunSpec). The launcher launches and bounds; it does no policy.
| Field | Type | Label | Description |
|---|---|---|---|
| org_id | string | org_id, run_id and step_name scope the run for labels and audit. | |
| run_id | string | run_id is the workflow run. | |
| step_name | string | step_name is the step within the run. | |
| image | string | image is the curated, DIGEST-PINNED image (repo@sha256:...). The launcher refuses a tag-only reference and an image not on its allowlist. | |
| entrypoint | string | repeated | entrypoint overrides the image entrypoint; empty keeps it. Its entry count and each entry's length are bounded by the launcher's ceilings. |
| args | string | repeated | args are passed to the entrypoint; count and length bounded like entrypoint. |
| input_tree_rev | int64 | input_tree_rev is the workspace revision the inputs were materialised at. | |
| inputs | MaterializedInput | repeated | inputs are materialised read-side under /work. |
| output_paths | string | repeated | output_paths are the declared output artifact paths to capture. |
| limits | ResourceLimits | limits are the hard caps. | |
| egress_grant | string | repeated | egress_grant is the derived forced-proxy allowlist (requested ∩ tenant ∩ ¬deny); empty = no egress. Every entry is a hostname containing a dot, never an IP literal and never a dotless (service) name; the entry count is bounded by the launcher's ceiling. |
| workspace_signer | WorkspaceSigner | Deprecated. workspace_signer is DEPRECATED (core#4637, ADR-0037 D4 as amended): no credential enters a sandbox, and the launcher refuses a request that sets it (ErrWorkspaceSignerRefused). |
ServeSpec
ServeSpec is the fully resolved serve-mode launch request (sandbox.ServeSpec) plus the workspace and relay fields ADR-0037 adds.
| Field | Type | Label | Description |
|---|---|---|---|
| org_id | string | org_id scopes the session. | |
| run_id | string | run_id is the workflow run. | |
| step_name | string | step_name is the step (for a coder dispatch: the roster agent_ref). | |
| preview_id | string | preview_id is a caller label for logs and audit only. It names nothing: the container name and the session handle are launcher-derived (StartServedResponse.sandbox_session_id). | |
| image | string | image is the curated, DIGEST-PINNED image. | |
| entrypoint | string | repeated | entrypoint overrides the image entrypoint; empty keeps it. Bounded as RunSpec.entrypoint. |
| args | string | repeated | args are passed to the entrypoint. Bounded as RunSpec.args. |
| input_tree_rev | int64 | input_tree_rev is the workspace revision inputs were materialised at. | |
| inputs | MaterializedInput | repeated | inputs are materialised read-side (batch-style inputs; unused when workspace_id is set). |
| limits | ResourceLimits | limits are the hard caps. | |
| egress_grant | string | repeated | egress_grant is the derived forced-proxy allowlist; empty = no egress. The launcher ADDS its configured platform tier (Model Gateway host, team gateway host) for a coder session; the tier never comes from here. Entries follow the RunSpec.egress_grant grammar and bound. |
| workspace_signer | WorkspaceSigner | Deprecated. workspace_signer is DEPRECATED (core#4637, ADR-0037 D4 as amended): no credential enters a sandbox, and the launcher refuses a request that sets it (ErrWorkspaceSignerRefused). | |
| port | int32 | port is the in-sandbox port the service (or relay) binds; 0 = 8080. | |
| readiness_path | string | readiness_path is the HTTP path probed for readiness; "" = "/". | |
| startup_timeout_seconds | int32 | startup_timeout_seconds bounds the first-ready wait; 0 = launcher default. | |
| hard_ttl_seconds | int32 | hard_ttl_seconds is the kernel-side backstop (activeDeadlineSeconds on Kubernetes); the lease is the primary owner. REQUIRED and > 0 for StartServed (invalid_argument otherwise). | |
| workspace_id | string | workspace_id, when set, mounts the acquired workspace at /work with the mode it was acquired in, replacing the serve path's scratch tmpfs. The workspace must belong to the same org and run. | |
| relay_secret | string | relay_secret, when set, is placed in the container environment as UPSQUAD_RELAY_SECRET for the in-sandbox relay (coder sessions). It is never on the launcher's argv or in its logs; it is present in the container environment by design and consumed by the relay. | |
| lease_ttl_seconds | int32 | lease_ttl_seconds is how long the session lives without RenewLease; 0 = launcher default (120). At most the launcher's ceiling (invalid_argument above it). |
StartServedRequest
StartServedRequest carries one serve spec.
| Field | Type | Label | Description |
|---|---|---|---|
| spec | ServeSpec | spec is the launch. |
StartServedResponse
StartServedResponse is the started sandbox's handle.
| Field | Type | Label | Description |
|---|---|---|---|
| sandbox_session_id | string | sandbox_session_id names the session for ProbeServed, RenewLease and StopServed. Launcher-issued, at least 128 bits of randomness. | |
| endpoint | string | endpoint is host:port the caller dials on the sandbox network. | |
| runtime_class | string | runtime_class is the runtime that actually ran (runsc | |
| degraded | bool | degraded is true when runc ran (dev only). | |
| lease_until | google.protobuf.Timestamp | lease_until is when the lease expires without renewal. |
StopServedRequest
StopServedRequest tears a served sandbox down.
| Field | Type | Label | Description |
|---|---|---|---|
| sandbox_session_id | string | sandbox_session_id is the launcher-issued session to stop; never a caller-named container or preview_id. |
StopServedResponse
StopServedResponse is empty; the call is idempotent.
WorkspaceSigner
WorkspaceSigner is DEPRECATED (core#4637): it was the per-run, prefix-scoped object-store signer. S6 streams the work tree into the pod instead, so no signer exists; the message stays only so field 12 still decodes (and is refused). Never logged.
| Field | Type | Label | Description |
|---|---|---|---|
| prefix | string | prefix is the only addressable blob prefix (orgs/{org}/runs/{run}). | |
| token | string | token is the short-TTL signer material. Never logged. | |
| expires_at | google.protobuf.Timestamp | expires_at is when the token stops working. |
WorkspaceMode
WorkspaceMode is the mount posture of an acquired workspace (mirrors workflow.v1.SandboxMode).
| Name | Number | Description |
|---|---|---|
| WORKSPACE_MODE_UNSPECIFIED | 0 | WORKSPACE_MODE_UNSPECIFIED is refused. |
| WORKSPACE_MODE_READ_ONLY | 1 | WORKSPACE_MODE_READ_ONLY mounts /work read-only. |
| WORKSPACE_MODE_READ_WRITE | 2 | WORKSPACE_MODE_READ_WRITE mounts /work read-write. |
LauncherService
LauncherService launches and bounds sandboxes and provisions their workspaces. Every RPC is authenticated as the orchestrator; any other caller is refused.
Every id the service hands out (sandbox_session_id, workspace_id) is launcher-issued, at least 128 bits of randomness, and never caller-chosen; a request naming an id the launcher did not issue to the same org and run is refused.
Refusals use these Connect codes, so a caller maps them without parsing messages:
- unauthenticated: the caller is not the orchestrator.
- permission_denied: org, run or workspace mismatch between the request and the session or workspace it names.
- invalid_argument: a grammar or bound below is violated, a tag-only or unlisted image, or a non-positive limit.
- failed_precondition: an expired clone credential, or an unknown provider host.
- resource_exhausted: the launcher's session ceiling, or a checkout larger than max_bytes.
- not_found: an unknown lease or workspace (on RenewLease: the session was already reaped).
- already_exists: the workspace is already mounted by a session.
| Method Name | Request Type | Response Type | Description |
|---|---|---|---|
| Launch | LaunchRequest | LaunchResponse | Launch runs a batch spec to completion and returns the raw outcome (sandbox.Launcher.Launch). |
| StartServed | StartServedRequest | StartServedResponse | StartServed starts a detached serve-mode sandbox and returns its endpoint and lease (sandbox.ServiceLauncher.StartServed). It does not wait for readiness; the caller probes. |
| ProbeServed | ProbeServedRequest | ProbeServedResponse | ProbeServed reports whether a served sandbox answers its readiness path (sandbox.ServiceLauncher.Probe). The sandbox is named by its launcher-issued sandbox_session_id; the launcher dials the endpoint it issued, never one the caller names. |
| StopServed | StopServedRequest | StopServedResponse | StopServed tears a served sandbox down. Idempotent: an unknown id is a no-op (sandbox.ServiceLauncher.StopServed). |
| RenewLease | RenewLeaseRequest | RenewLeaseResponse | RenewLease extends a served sandbox's lease. A lease that is not renewed expires and the launcher's reaper stops the sandbox and releases its workspace. Idempotent. |
| GetRuntime | GetRuntimeRequest | GetRuntimeResponse | GetRuntime reports the resolved container runtime (runsc |
| AcquireWorkspace | AcquireWorkspaceRequest | AcquireWorkspaceResponse | AcquireWorkspace shallow-clones repo@ref into a launcher-owned directory OUTSIDE any sandbox, pins it to a commit and returns that commit (ADR-0037 D3). The credential is used for the clone only and discarded; no remote survives acquisition. |
| ReleaseWorkspace | ReleaseWorkspaceRequest | ReleaseWorkspaceResponse | ReleaseWorkspace deletes a workspace (and stops any sandbox still mounting it) and reports what changed in it. Only the call that examined the tree answers with a list; a repeat call never reads clean: an unknown, already released, failed or reaped id is not_found, a workspace still being acquired or released is aborted (retryable), and a status that could not be read is internal (the tree is deleted anyway). Exactly 10000 changed_paths means the list is truncated. |
Scalar Value Types
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
|---|---|---|---|---|---|---|---|---|
| double | double | double | float | float64 | double | float | Float | |
| float | float | float | float | float32 | float | float | Float | |
| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| bool | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | |
| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |