Repository navigation
Description
Found by running the real-hardware test for #725. More serious than #725
itself, and it changes that issue's premise.
What happens
A plain two-row sweep, no --ami, on the default path (detached is
auto-enabled for parameter sweeps):
$ spawn launch s725 --instance-type t4g.small --region us-east-1 \
--param-file rows.json --command 'sleep 1200' --ttl 20m --cost-limit 0.50
🚀 Invoking Lambda orchestrator...
✓ Lambda invoked
✅ Parameter sweep queued successfully!
Sweep ID: sweep-20261007-033000
...
The sweep is now running in Lambda. You can disconnect safely.
Exit 0. The orchestrator's own log for that sweep:
Launching 2 instances (slots available: 2)
Trying instance type t4g.small for param 0
Failed to launch instance 0: run instances failed: ... api error MissingParameter:
The request must contain the parameter ImageId
Trying instance type t4g.small for param 1
Failed to launch instance 1: run instances failed: ... api error MissingParameter:
The request must contain the parameter ImageId
All instances launched and completed
Zero instances. aws ec2 describe-instances in the target account returns
nothing. And the Lambda logs All instances launched and completed immediately
after two hard failures, so the CLI's "queued successfully" is never contradicted.
Root cause: the CLI and the Lambda disagree on the key set
The orchestrator builds RunInstancesInput from param keys
(lambda/sweep-orchestrator/main.go:715-718):
ami := getStringParam(config, "ami", "")
keyName := getStringParam(config, "key_name", "")
iamRole := getStringParam(config, "iam_role", "spawnd-role")
spot := getBoolParam(config, "spot", false)and sets input.ImageId only if ami != "". Diffing what it reads against
what the CLI writes into defaults:
| keys | |
|---|---|
| orchestrator reads | ami iam_role instance_type key_name spot ttl |
| CLI seeds | cost_limit iam_role idle_timeout instance_type region ttl volume_size |
| missing, required | ami → no ImageId → every RunInstances rejected |
| missing, silent | key_name (no SSH key), spot (--spot never honoured) |
The actual params.json the CLI uploaded for the run above:
{"defaults": {"cost_limit": 0.5, "instance_type": "t4g.small",
"region": "us-east-1", "ttl": "20m"},
"params": [{"trial": "a"}, {"trial": "b"}]}No ami. So this is #697's class again, on the Lambda path — flags that
reach a LaunchConfig the Lambda never sees. #697 fixed the foreground sweep and
explicitly scoped itself out of the detached one; this is the part that was left.
A detached sweep therefore works only if the param file spells out ami:
itself. --ami on the command line is dropped. That is consistent with #725's
reporter having seen real rows with spawn:sweep-id tags: their param file must
have carried an AMI.
Not a regression from the recent redeploy
I redeployed this Lambda earlier today (first update since 2026-01-17), so I
checked: git log --follow -S'getStringParam(config, "ami"' shows the AMI
handling unchanged since the initial commit, and the only other commit to the
file is #726's tag addition. The deployed binary is also byte-identical to a
local rebuild of main. This has never worked without an explicit ami: in the
file.
What it means for #725
#725 said detached rows carry no spawn:managed tag and so can be stopped by
nothing. The tag fix (#726) is correct, but unobservable on the default path,
because the default path creates nothing to tag. The ordering is now: this issue
first, then #725's tagging becomes verifiable.
It also revises an earlier diagnosis of mine. The hardware smoke's sweep leg
reported sweep INCONCLUSIVE: expected 2 running rows, found 0, and I attributed
that to checking before the Lambda had launched anything. That was wrong — or at
best half right. The rows never existed. "Found 0" was a true positive about
a total failure, and I explained it away as a timing artifact.
Suggested fix
- Seed every key the Lambda reads. The CLI already has the mechanism
(cmd/launch_sweep.gowritesinstance_type/region/etc. intoDefaults);
addami,key_nameandspot. Forami, the resolved value — the CLI
auto-detects the latest AL2023 when--amiis absent, and that resolution must
happen before the upload, not be left to a Lambda that cannot do it. - Make the key set a gate, not a convention. The orchestrator and the CLI
should agree by construction — a shared list of param keys, or a test that
grepsgetStringParam/getBoolParamin the Lambda and asserts the CLI seeds
each one. A silent""default is what turned a missing key into a 400 from
EC2 and then into a success message. - Stop reporting success after failing.
All instances launched and completedmust not be logged when zero of N launched, and a sweep whose rows
all failed must be recorded as failed in the sweep table so
spawn status --sweep-idsays so. Right now the only evidence is the Lambda's
own log. - Have the CLI verify, or stop promising. "The sweep is now running in
Lambda. You can disconnect safely" is a claim the CLI cannot currently support.
Either poll briefly for the first row, or soften the message and point at
spawn status --sweep-id.
(3) is arguably the worst of the four: a cost-control tool reporting a launch
that did not happen is the same failure class as #737, where a declined terminate
exited 0.
Cost note
Nothing leaked — zero instances were created, which is the one silver lining. The
test's own cleanup and an independent describe-instances both confirm 0 live
instances in the target account.
Environment: spawn built from main at 45815b3, spawn-sweep-orchestrator
deployed 2026-10-08 (CodeSha256 verified against a local rebuild), us-east-1,
target account 435415984226.
Activity
test(sweep): add the detached-sweep hardware test, and list the Lambd…
docs(changelog): record #749
fix(sweep): a detached sweep launched zero instances and reported suc…
test(sweep): the detached-sweep harness passes; correct its header
test(sweep): the detached-sweep harness passes; correct its header (#766
fix(egress-proxy): delete leaves no security group behind (#1651) (#1659