Skip to content

Confirm acquisition seam: spawn owns RunInstances (no pre-acquired-instance bring-up); no exported ECR/container primitive #351

Closed

Description

@scttfrdmn

Context

Filing from calque (github.com/spore-host/calque), a spike consuming spawn as a Go library. calque's design spec assumed a seam of: "lagotto acquires a live instance, then spawn brings it up (launches the workload/container on the already-acquired instance)." Reading the actual source (v0.63.0 checkout, go.mod on main), that seam does not exist as written — filing to confirm the intended model rather than guess.

What we found

  1. spawn owns the launch, not "bring-up on a pre-acquired instance." launcher.Provision(ctx, client, LaunchConfig, Options) (pkg/launcher/provision.go:59) and (*aws.Client).Launch (pkg/aws/client.go:315) call EC2 RunInstances internally (pkg/aws/client.go:511). There is no exported function that consumes a pre-acquired live-instance handle and launches a workload onto it (no BringUp/Deploy/Run(handle, image)). The only existing-instance surface is the (region, instanceID string) SSM/lifecycle methods: WaitForSSMOnline, RunShellScript, GetInstanceState/PublicIP, WaitForRunning, Terminate, Stop/StartInstance.

    The package docs actually state the inverse of our assumption: SDK consumers like lagotto call Provision, and Provision returns immediately on InsufficientInstanceCapacity "the case lagotto retries on" (provision.go:133-139). So the real model appears to be spawn = acquisition mechanism (RunInstances), lagotto = retry policy above it. Can you confirm? (Companion issue on lagotto: TBD-link.)

  2. No exported ECR/container API. All docker login/pull/run logic lives in package cmd (cmd/app.go, cmd/app_byo.go) and is DCV-streaming-specific — not importable. The library path runs a shell command via cloud-init user-data (LaunchConfig.JobArrayCommand) or SSM RunShellScript. A downstream that wants "run this ECR image" must hand-build the aws ecr get-login-password | docker login && docker pull && docker run <ref> string itself.

    Ask: is a headless "run container image ref" library primitive (host provisioning + docker run, no DCV) something you'd want? If not, we'll build the command string in calque and log it as an integration leak — just confirming there isn't an exported helper we missed.

  3. LaunchResult carries no launch timestamp and no Region. LaunchResult (pkg/aws/client.go:266) has InstanceID/Name/PublicIP/PrivateIP/AvailabilityZone/State/KeyName but no time field, and Terminate returns only error. For measuring launch→terminate "rectangle-seconds" (calque's cost basis), we timestamp with our own wall-clock around Launch/Terminate — which is fine, but a returned launch time would remove ambiguity. Minor; flagging only.

None of this blocks calque — we'll adapt to the real API. Filing to (a) confirm the acquisition seam so we build against the intended split, and (b) surface the container/ECR gap in case a library primitive is on your roadmap.

/cc downstream: spore-host/calque

Activity

  1. added
    question
    area:launch
    area:lifecycle
    on Jul 15, 2026
  2. scttfrdmn commented on Jul 15, 2026

    @scttfrdmn
    ContributorAuthor

    Confirmed all three findings against current source (now v0.73.0, not the v0.63.0 you read — I checked the delta; see below). Your reading of the model is correct.

    The acquisition seam — confirmed as you found it (your assumption was inverted)

    spawn owns acquisition (RunInstances); lagotto is the retry policy above it. There is no "lagotto acquires, spawn brings up a pre-acquired instance" seam, and there shouldn't be. Grounding:

    • launcher.Provision (pkg/launcher/provision.go:59) → client.Launch (provision.go:136) → RunInstances (pkg/aws/client.go:511). spawn is the thing that calls RunInstances.
    • Provision's own doc (provision.go:42-46): it's "the headless equivalent of spawn launch… so SDK consumers get a fully-functional spore… instead of a naked instance." And provision.go:133-139 names your exact case: on InsufficientInstanceCapacity it returns immediately, no retry — "the case lagotto retries on."
    • So the split is: spawn = one-shot acquire-and-bring-up (RunInstances + spored + command + TTL/idle/on-complete); lagotto = the retry/watch policy that calls Provision repeatedly. There's no pre-acquired-handle bring-up because bring-up is fused into the launch (user-data), not a second step against a live handle. The existing existing-instance surface is only the (region, instanceID) SSM/lifecycle methods you listed (RunShellScript, WaitForSSMOnline, GetInstanceState/PublicIP, WaitForRunning, Terminate, Stop/StartInstance) — all confirmed present.

    For calque: build against launcher.Provision as the acquire+bring-up primitive; don't expect a BringUp(handle). If you need retry, that's lagotto's job (see lagotto#73) or your own loop keyed on LaunchError.Code (client.go:283, carries the verbatim AWS code — classify without string-matching).

    2. Headless "run container image ref" primitive — real gap, and I want it

    Confirmed: all docker login/pull/run + ECR logic lives in package cmd (cmd/app.go, cmd/app_byo.go), is not importable, and is DCV-session-bound (the run wrapper wires DISPLAY/XAUTHORITY/X11 into the container — GUI streaming, not headless). Note this is newer than your v0.63.0 checkout — the BYO-ECR / container-app features landed in v0.69.0 (#290, #392) — but they stayed in cmd and DCV-only, so your gap still holds at v0.73.0.

    Today the headless path is: build the aws ecr get-login-password | docker login && docker pull && docker run <ref> string yourself and pass it as LaunchConfig.JobArrayCommand (cloud-init) or via RunShellScript (SSM). That works but pushes ECR-login/GPU-flag/--gpus all knowledge into every consumer.

    Yes, a headless container primitive is worth having — it's the natural pkg-level extraction of what cmd/app.go already does minus DCV. Likely shape: a LaunchConfig.ContainerImage (+ optional registry-auth mode) that Provision turns into the login/pull/run bootstrap, so a consumer says "run this image ref" without hand-assembling the string. I'll scope it as a follow-up (it's more than a doc answer). For now, calque hand-building the command string is the correct interim — flag it as the integration leak you already called it.

    3. LaunchResult has no timestamp / no Region — confirmed, will add

    LaunchResult (pkg/aws/client.go:266) is exactly InstanceID/Name/PublicIP/PrivateIP/AvailabilityZone/State/KeyName — no launch time, no Region (unchanged since initial release). Adding both is cheap and unambiguously useful (you're timestamping with your own wall-clock for rectangle-seconds; a server-authoritative LaunchTime + the Region the instance actually landed in removes the guesswork). I'll add LaunchTime time.Time and Region string to LaunchResult. Low-risk additive change.

    Net

    • Seam: confirmed — spawn acquires + brings up in one shot; lagotto/you own retry. Build against Provision.
    • Container primitive: accepted as a follow-up (pkg-level headless docker run, DCV-free). Interim: hand-built command string.
    • LaunchResult Region + LaunchTime: will add (small additive change, next release).

    I'll open the LaunchResult change now and file a separate tracking issue for the headless-container primitive; will link both here.

  3. scttfrdmn commented on Jul 15, 2026

    @scttfrdmn
    ContributorAuthor

    Follow-up filed. The LaunchResult Region + LaunchTime addition is in #352. The headless container-run primitive is tracked separately in #353 (it's a larger design than a doc answer). This issue can close once #352 merges; #353 carries the container work.

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

    area:launcharea:lifecyclequestion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions