Skip to content

ST1: sandbox/v1 Protobuf contract — language-neutral wire IDL (shared foundation) #84

Closed

Description

@pdettori

ST1 — sandbox/v1 Protobuf contract (shared wire IDL)

Part of the SandboxTransport epic (see epic #89). Shared foundation — both the backend (TypeScript) and the worker (Go) codegen from this; build it first.

Spec: docs/specs/2026-07-08-sandbox-transport-grpc-design.md §4. Decision: ADR-0024.

Problem

The harness↔sandbox contract must be language-neutral so a worker can be any runtime (Go, Python, Rust, …) — driver #2 in the spec (§1). A TypeScript interface with JSON+base64 frames (the superseded revision) locked workers to TS. The .proto IDL is the source of truth; TS and Go are just two generated clients.

Goal

Define sandbox/v1 exactly as spec §4 — two services, no registry service, no Selector (matching stays in the harness pool):

  • SandboxWorker.Attach(stream WorkerFrame) returns (stream ServerFrame) — worker dials in, one bidi stream. worker→relay: Hello | Heartbeat | Chunk | End | ExecError. relay→worker: Exec | Abort.
  • SandboxExec.Exec(ExecRequest) returns (stream ExecEvent) + Abort(AbortRequest) returns (AbortResponse) — harness↔relay, in-cluster only.

Frame/message set per §4: Hello (id, labels, capabilities, image, arch, capacity_max, trust), Heartbeat{} (liveness only), Exec (req_id, command, bytes stdin, timeout_s, streaming), Abort, Chunk (bytes data), End (sint32 exit_code), ExecError, ExecRequest, ExecEvent, AbortRequest, AbortResponse.

  • Binary, not base64 — bytes stdin / bytes data ride protobuf's native binary encoding (§4 notes, §8).
  • Harness owns leases — Hello carries only capacity_max; the worker never self-reports capacity_in_use (§4 notes).

Non-goals (this task)

  • No registry/matching service and no Selector message (matching stays in select-sandbox, §6).
  • No transport/worker implementation (ST2/ST3/ST4).
  • No mTLS fields on the wire — bearer token lives at the edge, mTLS is an additive upgrade (§9, §13.4).

Acceptance

  • .proto compiles cleanly; TypeScript stubs (for the backend) and Go stubs (for the worker) both generate and are wired into their respective builds.
  • Field numbers and oneof layout match spec §4 verbatim.
  • Codegen is reproducible in CI (documented buf/protoc invocation; no hand-edited generated code).

Touches

New proto/sandbox/v1/…; codegen wiring for TS (backend package) and Go (worker module); build/CI hooks. This artifact is what the worker plan consumes and the backend plan publishes.

Next step

Land the .proto + codegen; then ST2/ST3 (backend) and ST4 (worker) build against it in parallel. Plan lives locally in docs/plans/ per contributor.

Activity

  1. added 2 commits that reference this issue on Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions