Repository navigation
Description
Reported from the 2026-10-07 real-AWS demo run (spawn v0.123.0). Confirmed, and
the cause is worse than reported. Two independent defects in one function.
Reproduced
cmd/launch_regions.go:21:
func detectBestRegion(ctx context.Context, instanceType string) (string, error) {instanceType is a parameter and is never used anywhere in the function body
— verified by grep: the only occurrence of the identifier is the signature. So the
offering check cannot happen even in principle. Selection is:
GetEnabledRegions(17 here)- IP geolocation for a continent hint
- a serial
net.DialTimeouttoec2.<region>.amazonaws.com:443 - sort by continent match, then measured TCP latency
AWS_REGION, SPORE_REGION and the shared-config default are consulted
nowhere on this path.
$ AWS_PROFILE=spore-host-dev AWS_REGION=eu-central-1 \
spawn launch --name probe --instance-type c8a.large --estimate-only
🌍 No region specified, auto-detecting closest region...
✓ Selected region: us-west-1
...
💰 Cost estimate: cannot determine the on-demand price for c8a.large in us-west-1
AWS_REGION=eu-central-1 ignored. And:
$ aws ec2 describe-instance-type-offerings --region us-west-1 \
--filters Name=instance-type,Values=c8a.large --query 'length(InstanceTypeOfferings)'
0
$ ... --region us-west-2 ...
1
c8a.large is not offered in us-west-1 at all, which is the demo's
api error Unsupported: The requested configuration is currently not supported.
The selection is not stable
21 identical --estimate-only runs from one machine in one session: 20 chose
us-west-1, one chose us-west-2. That is the demo's observed mix of the two
regions across launches of the same shape, and it is latency-measurement noise
between two west-coast endpoints whose RTT difference is smaller than the jitter.
So the same command, same environment, no flags, lands in a region where the
launch works or a region where it cannot — by coin flip.
The information to prevent it was already in hand
The cost estimate printed no on-demand price found for c8a.large in us-west-1
before the launch. The Price List has no price because the type is not offered
there. spawn held a signal that the region was wrong and proceeded anyway.
Suggested fix
- Precedence before auto-detect:
--region→SPORE_REGION/AWS_REGION→
shared-config default → auto-detect. Auto-detect should be the last resort, not
the first, and the root--regionflag's own help already claims this ordering
("overrides SPORE_REGION/AWS_REGION and the shared config") — see the flag
shadowing note below. - Use the parameter: filter candidates by
describe-instance-type-offeringsfor the requested type before ranking. One
call per candidate region, or one call withName=locationfilters. A region
that cannot run the instance must never be a candidate. - Say why: print the chosen region and the reason ("lowest latency of 4
regions offering c8a.large"), so a surprising choice is debuggable at the time
rather than from anUnsupportederror three steps later. - Fail loudly if nothing qualifies, rather than falling back to
us-east-1
(cmd/launch_single.go:227) which may also not offer the type.
Related: the root --region flag is shadowed on launch
cmd/root.go:138 registers a persistent --region bound to spawnRegion,
documented as overriding SPORE_REGION/AWS_REGION and the shared config.
cmd/launch_flags.go:258 registers a local --region on launchCmd bound to
a different variable with no such fallback, and the local flag wins:
$ spawn launch --help | grep -A0 '^ --region'
--region string AWS region
That is the local flag's description, not the root's. So on launch — the one
command where it matters most — the documented precedence does not exist. Worth
fixing as part of (1), since otherwise the fix can be applied to a variable
nothing reads.
Environment: spawn v0.123.0, spored v0.124.0, 17 enabled regions, macOS controller.
Activity
scttfrdmn commentedon Oct 8, 2026
The 2026-10-07 follow-up repro reproduced this again on the first try —
AWS_REGION=us-east-1set,✓ Selected region: us-west-1— and it turns out to be the first link in a four-defect chain that produced the originally-reported "5+ minute hang": #732 places the instance in an unintended region → SSH never becomes reachable there → #740 discards that failure → #741 then SSHes to the unreachable host for ~4 minutes → #739 prints nothing throughout. Fixing this one alone would have prevented all of it in that run.Withdraw --proximity-from and --cost-tier (#864)
Withdraw --proximity-from and --cost-tier (#864) (#871)