Skip to main content

sandbox API

Table of Contents​

Top

upsquad/sandbox/v1/launcher.proto​

AcquireWorkspaceRequest​

AcquireWorkspaceRequest asks for a pinned shallow checkout.

FieldTypeLabelDescription
org_idstringorg_id, team_id scope the authorization the caller already performed; the launcher labels and bounds by them.
team_idstringteam_id is the team whose source grant authorised this acquisition.
run_idstringrun_id is the run the workspace is bound to.
stepstringstep is the dispatch step (roster agent_ref).
ordinalint32ordinal is the dispatch ordinal; (run_id, step, ordinal) is the workspace's execution identity (ADR-0037 D1).
provider_hoststringprovider_host is the SCM host (e.g. "github.com"), lower-case, matched exactly against the launcher's configured provider hosts.
repostringrepo is the repository as owner/name, matching ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$.
refstringref 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.
modeWorkspaceModemode is the mount posture.
clone_credentialCloneCredentialclone_credential is the one-time clone credential.
max_bytesint64max_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.

FieldTypeLabelDescription
workspace_idstringworkspace_id names the workspace for ServeSpec.workspace_id and ReleaseWorkspace. Launcher-issued, at least 128 bits of randomness.
commitstringcommit is the pinned commit (git rev-parse HEAD after checkout).
tree_bytesint64tree_bytes is the working-tree size after checkout.
fetched_bytesint64fetched_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.

FieldTypeLabelDescription
kindstringkind is the provider token kind (e.g. "github_installation_token").
tokenstringtoken is the secret. Never logged.
expires_atgoogle.protobuf.Timestampexpires_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.

FieldTypeLabelDescription
runtimestringruntime is "runsc" or "runc".

LaunchOutcome​

LaunchOutcome is the RAW batch result before the caller's output cap and termination mapping (sandbox.LaunchOutcome).

FieldTypeLabelDescription
exit_codeint32exit_code is the process exit code.
stdoutbytesstdout is the captured (capped) stdout.
stderrbytesstderr is the captured (capped) stderr.
output_artifactsOutputBlobrepeatedoutput_artifacts are the captured declared outputs.
cpu_secondsdoublecpu_seconds is the metered cpu time.
oom_killedbooloom_killed reports a memory cgroup kill.
pids_exceededboolpids_exceeded reports a pids.max kill.
disk_exceededbooldisk_exceeded reports a /work disk-cap kill.
egress_deniedstringrepeatedegress_denied lists hosts the proxy refused.

LaunchRequest​

LaunchRequest carries one batch spec.

FieldTypeLabelDescription
specRunSpecspec is the launch.

LaunchResponse​

LaunchResponse carries the raw outcome.

FieldTypeLabelDescription
outcomeLaunchOutcomeoutcome 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).

FieldTypeLabelDescription
pathstringpath is the sandbox-relative path under /work.
contentbytescontent is the artifact bytes (already quota-capped by the caller).

OutputBlob​

OutputBlob is one declared output artifact the sandbox produced (sandbox.OutputBlob).

FieldTypeLabelDescription
pathstringpath is the sandbox-relative path it was captured from.
contentbytescontent is the captured bytes (output-capped).

ProbeServedRequest​

ProbeServedRequest asks whether a served sandbox is ready.

FieldTypeLabelDescription
sandbox_session_idstringsandbox_session_id is the launcher-issued session to probe; the launcher dials the endpoint it issued for it, never a caller-named one.
readiness_pathstringreadiness_path is the path to GET; "" = "/".

ProbeServedResponse​

ProbeServedResponse reports readiness.

FieldTypeLabelDescription
readyboolready is true on a 2xx/3xx.

ReleaseWorkspaceRequest​

ReleaseWorkspaceRequest deletes a workspace.

FieldTypeLabelDescription
workspace_idstringworkspace_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).

FieldTypeLabelDescription
changed_pathsstringrepeatedchanged_paths are paths modified, added or deleted relative to the pin.
dirtybooldirty is true when changed_paths is non-empty.

RenewLeaseRequest​

RenewLeaseRequest extends a session's lease.

FieldTypeLabelDescription
sandbox_session_idstringsandbox_session_id is the session.

RenewLeaseResponse​

RenewLeaseResponse reports the new expiry.

FieldTypeLabelDescription
lease_untilgoogle.protobuf.Timestamplease_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".

FieldTypeLabelDescription
cpu_millisint32cpu_millis is the cgroup cpu cap in milli-cores.
memory_mibint32memory_mib is the OOM-kill cap in MiB.
wall_secondsint32wall_seconds is the in-sandbox hard-kill deadline.
disk_mibint32disk_mib caps /work (and ephemeral storage) in MiB.
pids_maxint32pids_max is the fork-bomb cap.
output_max_bytesint64output_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.

FieldTypeLabelDescription
org_idstringorg_id, run_id and step_name scope the run for labels and audit.
run_idstringrun_id is the workflow run.
step_namestringstep_name is the step within the run.
imagestringimage is the curated, DIGEST-PINNED image (repo@sha256:...). The launcher refuses a tag-only reference and an image not on its allowlist.
entrypointstringrepeatedentrypoint overrides the image entrypoint; empty keeps it. Its entry count and each entry's length are bounded by the launcher's ceilings.
argsstringrepeatedargs are passed to the entrypoint; count and length bounded like entrypoint.
input_tree_revint64input_tree_rev is the workspace revision the inputs were materialised at.
inputsMaterializedInputrepeatedinputs are materialised read-side under /work.
output_pathsstringrepeatedoutput_paths are the declared output artifact paths to capture.
limitsResourceLimitslimits are the hard caps.
egress_grantstringrepeatedegress_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_signerWorkspaceSignerDeprecated. 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.

FieldTypeLabelDescription
org_idstringorg_id scopes the session.
run_idstringrun_id is the workflow run.
step_namestringstep_name is the step (for a coder dispatch: the roster agent_ref).
preview_idstringpreview_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).
imagestringimage is the curated, DIGEST-PINNED image.
entrypointstringrepeatedentrypoint overrides the image entrypoint; empty keeps it. Bounded as RunSpec.entrypoint.
argsstringrepeatedargs are passed to the entrypoint. Bounded as RunSpec.args.
input_tree_revint64input_tree_rev is the workspace revision inputs were materialised at.
inputsMaterializedInputrepeatedinputs are materialised read-side (batch-style inputs; unused when workspace_id is set).
limitsResourceLimitslimits are the hard caps.
egress_grantstringrepeatedegress_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_signerWorkspaceSignerDeprecated. 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).
portint32port is the in-sandbox port the service (or relay) binds; 0 = 8080.
readiness_pathstringreadiness_path is the HTTP path probed for readiness; "" = "/".
startup_timeout_secondsint32startup_timeout_seconds bounds the first-ready wait; 0 = launcher default.
hard_ttl_secondsint32hard_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_idstringworkspace_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_secretstringrelay_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_secondsint32lease_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.

FieldTypeLabelDescription
specServeSpecspec is the launch.

StartServedResponse​

StartServedResponse is the started sandbox's handle.

FieldTypeLabelDescription
sandbox_session_idstringsandbox_session_id names the session for ProbeServed, RenewLease and StopServed. Launcher-issued, at least 128 bits of randomness.
endpointstringendpoint is host:port the caller dials on the sandbox network.
runtime_classstringruntime_class is the runtime that actually ran (runsc
degradedbooldegraded is true when runc ran (dev only).
lease_untilgoogle.protobuf.Timestamplease_until is when the lease expires without renewal.

StopServedRequest​

StopServedRequest tears a served sandbox down.

FieldTypeLabelDescription
sandbox_session_idstringsandbox_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.

FieldTypeLabelDescription
prefixstringprefix is the only addressable blob prefix (orgs/{org}/runs/{run}).
tokenstringtoken is the short-TTL signer material. Never logged.
expires_atgoogle.protobuf.Timestampexpires_at is when the token stops working.

WorkspaceMode​

WorkspaceMode is the mount posture of an acquired workspace (mirrors workflow.v1.SandboxMode).

NameNumberDescription
WORKSPACE_MODE_UNSPECIFIED0WORKSPACE_MODE_UNSPECIFIED is refused.
WORKSPACE_MODE_READ_ONLY1WORKSPACE_MODE_READ_ONLY mounts /work read-only.
WORKSPACE_MODE_READ_WRITE2WORKSPACE_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 NameRequest TypeResponse TypeDescription
LaunchLaunchRequestLaunchResponseLaunch runs a batch spec to completion and returns the raw outcome (sandbox.Launcher.Launch).
StartServedStartServedRequestStartServedResponseStartServed starts a detached serve-mode sandbox and returns its endpoint and lease (sandbox.ServiceLauncher.StartServed). It does not wait for readiness; the caller probes.
ProbeServedProbeServedRequestProbeServedResponseProbeServed 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.
StopServedStopServedRequestStopServedResponseStopServed tears a served sandbox down. Idempotent: an unknown id is a no-op (sandbox.ServiceLauncher.StopServed).
RenewLeaseRenewLeaseRequestRenewLeaseResponseRenewLease 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.
GetRuntimeGetRuntimeRequestGetRuntimeResponseGetRuntime reports the resolved container runtime (runsc
AcquireWorkspaceAcquireWorkspaceRequestAcquireWorkspaceResponseAcquireWorkspace 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.
ReleaseWorkspaceReleaseWorkspaceRequestReleaseWorkspaceResponseReleaseWorkspace 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 TypeNotesC++JavaPythonGoC#PHPRuby
doubledoubledoublefloatfloat64doublefloatFloat
floatfloatfloatfloatfloat32floatfloatFloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intintuint32uintintegerBignum or Fixnum (as required)
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/longuint64ulonginteger/stringBignum
sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)