You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(sdk/go): bundle Create() positional parameters into options struct #2807
This follows the k8s client-go pattern this SDK models, where creation parameters are bundled into typed structs rather than passed as positional arguments. Since PR #2781 is already a breaking change, the migration cost for this improvement is minimal.
The same pattern should apply to CreateFromTemplate() if it has a similar parameter list.
Context
Identified during PR #2781 code review (comment). The parameter list grew from 5 to 7+opts when policy and providers were promoted to top-level request fields.
The readability problem is confirmed in the current head of #2781. Go is the only curated SDK that represents the optional sandbox-creation fields as a sequence of positional arguments: Python uses keyword-only arguments, while Rust and TypeScript use structured inputs.
Investigation
This also exposes a broader consistency issue. Go already has a SandboxSpec, but it represents the resolved state returned by the gateway and includes DriverConfig. Direct creation must not accept DriverConfig; an earlier version of #2781 risked silently discarding it.
Rust and TypeScript currently use SandboxSpec for caller creation intent instead. The SDKs therefore use the same name for different concepts.
The resolution should establish a uniform semantic model across the curated SDKs while retaining language-idiomatic APIs:
distinguish creation input from the resolved SandboxSpec;
provide separate inline-workload and template-based creation inputs;
align the supported fields, defaults, validation, and errors;
use keyword arguments, object parameters, or typed structs as appropriate for each language.
For Go, this likely means introducing a create-specific type such as SandboxCreateSpec or CreateSandboxParams, plus a distinct template-creation type, rather than accepting the existing resolved SandboxSpec.
Recommendation
Coordinate this with #2680 and #2781 and document the intended creation model across Go, Rust, Python, and TypeScript before finalizing the breaking API. Addressing the Go signature before #2781 merges would avoid a second breaking migration.
If #2781 changes direction and no longer introduces these signatures, reassess whether this issue remains applicable.
Human Decision Required
Decide whether the shared SDK creation model should be part of the #2781 acceptance criteria. If accepted, record that separately with state:accepted.
The triage assessment correctly identifies the deeper problem: Go reuses SandboxSpec for both creation input and resolved state, which leaks gateway-only fields like DriverConfig into the caller surface.
That said, Rust and TypeScript already solved this. Both have a creation-only type (SandboxSpec) that is distinct from the resolved output (SandboxRef). The Go fix should follow that established pattern rather than requiring a coordinated cross-SDK design effort.
Proposed scoping:
This issue (Go): Introduce a creation-specific struct (e.g. CreateSandboxParams) that excludes gateway-resolved fields. Fold this into feat(sandbox)!: introduce reusable sandbox templates #2781 before it merges to avoid a second breaking change.
Separate issue (Python): Python currently passes the raw proto SandboxSpec with no curated creation type at all. That's a distinct gap worth its own tracking issue.
Cross-SDK naming: The invariant that matters is semantic: creation input types must not include gateway-resolved fields. Exact naming can follow language idiom (CreateSandboxParams in Go, SandboxSpec in Rust/TS) rather than requiring string-identical names across SDKs.
Alignment happens by convergence on the same separation pattern, not by blocking on a formal specification document. Rust and TS are already there; Go joining them is the fix.
After deeper investigation, the original premise needs correction:
DriverConfig is a user-provided field, not a gateway-resolved leak. It lives on SandboxTemplate (proto field 11) and is intentionally part of CreateSandboxRequest. The gateway routes the matching block to the active compute driver. Callers should be able to set it.
This means the current Create() signature on main is actually fine:
A dedicated CreateSandboxParams struct is unnecessary since *SandboxSpec already represents creation intent correctly. The only fields outside the spec (labels, annotations) are better served by functional options.
Closing our earlier PR #3197 since it was based on the incorrect premise. The fix should be coordinated with #2781.
Activity
elezar commentedon Aug 20, 2026
rhuss commentedon Sep 4, 2026
The triage assessment correctly identifies the deeper problem: Go reuses
SandboxSpecfor both creation input and resolved state, which leaks gateway-only fields likeDriverConfiginto the caller surface.That said, Rust and TypeScript already solved this. Both have a creation-only type (
SandboxSpec) that is distinct from the resolved output (SandboxRef). The Go fix should follow that established pattern rather than requiring a coordinated cross-SDK design effort.Proposed scoping:
CreateSandboxParams) that excludes gateway-resolved fields. Fold this into feat(sandbox)!: introduce reusable sandbox templates #2781 before it merges to avoid a second breaking change.SandboxSpecwith no curated creation type at all. That's a distinct gap worth its own tracking issue.CreateSandboxParamsin Go,SandboxSpecin Rust/TS) rather than requiring string-identical names across SDKs.Alignment happens by convergence on the same separation pattern, not by blocking on a formal specification document. Rust and TS are already there; Go joining them is the fix.
rhuss commentedon Sep 5, 2026
Revised Analysis
After deeper investigation, the original premise needs correction:
DriverConfigis a user-provided field, not a gateway-resolved leak. It lives onSandboxTemplate(proto field 11) and is intentionally part ofCreateSandboxRequest. The gateway routes the matching block to the active compute driver. Callers should be able to set it.This means the current
Create()signature on main is actually fine:The problem only arises in PR #2781, which decomposes
*SandboxSpecinto individual positional parameters:Proposed approach (revised):
*SandboxSpecas the single creation input forCreate(). Don't decompose it into positional params.CreateFromTemplate()takes a template name +*SandboxSpecfor optional overrides (policy, providers, etc.).labelsandannotationsinto functional options (WithLabels(),WithAnnotations()) to keep the positional parameter list short.This gives:
A dedicated
CreateSandboxParamsstruct is unnecessary since*SandboxSpecalready represents creation intent correctly. The only fields outside the spec (labels, annotations) are better served by functional options.Closing our earlier PR #3197 since it was based on the incorrect premise. The fix should be coordinated with #2781.
Add brainstorm: Go SDK Create() params struct
feat(sdk/go)!: replace positional labels with functional Create options
feat(sdk/go)!: replace positional labels with functional Create options
feat(sdk/go)!: replace positional labels with functional Create options
feat(sdk/go)!: replace positional labels with functional Create options
elezar commentedon Oct 16, 2026
Reopening this to get working on the Go SDK.
feat(sdk/go)!: replace positional labels with functional Create options
feat(sdk/go)!: replace positional labels with functional Create optio…