Repository navigation
Description
Go's spawn status is two things bolted together: a remote spored status over SSH/SSM, and four pure tag-derived notices appended after it. spawn-ts ports neither, but the four notices need no transport at all — every input is already in ManagedInstance.tags.
What's portable, and why it's worth porting
spawn status ends with (cmd/status.go:130-134):
fmt.Print(lifecycleProtectionBlock(instance))
fmt.Print(dnsStatusNotice(instance))
fmt.Print(sporedUpgradeNotice(instance.Tags["spawn:spored-version"], string(output), instance.InstanceID))
fmt.Print(elasticIPNotice(ctx, client, instance))Three of the four are pure functions of tags. All four surface conditions a user cannot otherwise see.
1. dnsStatusNotice (status.go:241) — the most valuable, and it's ~10 lines
status, ok := instance.Tags["spawn:dns-status"]
if !ok || status == "" { return "" }
if status == "registered" { return "" }
detail := instance.Tags["spawn:dns-error"]
if detail == "" { detail = "no detail reported" }
return fmt.Sprintf("\n%s DNS registration failed — the instance name may not resolve: %s\n", …)Its doc comment states exactly why it exists: spored records spawn:dns-status / spawn:dns-error "so a Function-URL auth rejection or other failure is visible here instead of only in the instance's journal, where the FQDN would otherwise just silently never resolve (#435)."
That is the whole point. spawn-ts already has the DNS naming story (src/dns/dns-name.ts, src/dns/dns-resolve.ts) — it tells the user what FQDN will exist. It has no way at all to report that registration failed. So a portal user gets a hostname that never resolves, with zero explanation, and the diagnostic is sitting in a tag the browser already fetched. Neither spawn:dns-status nor spawn:dns-error appears anywhere in src/.
Same #63 shape as the rest of this audit: the failure is recorded, and dropping the reader makes it indistinguishable from success.
2. lifecycleProtectionBlock (status.go:149) — mostly a port of logic spawn-ts already has
Guards on spawn:managed == "true" and a running/pending state, then prints the safety posture: in-instance vs out-of-band reaper, the hard termination deadline (from spawn:ttl-deadline, falling back to spawn:ttl for older instances — lifecycleDeadline), and the worst-case compute cost:
maxHours := deadline.Sub(instance.LaunchTime).Hours()
// "Max compute cost: ~$X by deadline (on-demand rate, compute only; idle-stop usually ends it sooner)"spawn-ts has the pieces: ttlDeadline (src/core/lifecycle.ts), accumulatedCost, and pricePerHour on the instance. What it lacks is the ceiling framing. src/cli/commands.ts status prints cost so far; Go prints the maximum this instance can cost before its deadline. Those answer different questions, and the second is the one that tells a user whether to worry.
Two details to carry over verbatim:
- The past-due branch:
"(past due — terminates on next check)"rather than a negative duration. Related to extend: no safety floor — extending an overdue instance yields a past deadline and it is reaped anyway #54 — the overdue state needs to be legible, not arithmetic. - The cost label must keep "compute only" — it excludes EBS and network, and Go says so in the string. Presenting it as total cost would understate the bill.
3. sporedUpgradeNotice — partially portable
Takes spawn:spored-version (a tag) and the spored status output. The version half works from tags alone; the output half doesn't. Port the tag comparison, drop the output-dependent part.
4. elasticIPNotice (status.go:222) — needs one API call, and it's a real cost leak
Calls GetInstanceElasticIP, then:
"⚠️ Elastic IP %s (%s) is attached to this %s instance and keeps billing (~$3.60/mo).
spawn never releases EIPs — release it yourself if unneeded: aws ec2 release-address --allocation-id %s"An EIP on a stopped instance bills while the instance costs nothing — the classic silent-charge case, which is also why spawn orphans lists unassociated EIPs (cmd/orphans.go:26). DescribeAddresses is plain EC2, already reachable from EC2Provider. The message's honesty is the part to preserve: spawn never allocates EIPs so it never releases them, and it hands the user the exact command instead of offering a button it shouldn't have.
What isn't portable
spawn status's primary output is sudo /usr/local/bin/spored status run remotely. Go tries SSH and falls back to SSM when no key resolves (status.go:93 → runStatusOverSSM, #222 — keyless/cohort-launched instances are SSM-only by design, #130).
SSM is CORS-open and spawn-ts already speaks it (src/ssm/session.ts:40), so SendCommand + AWS-RunShellScript is technically within reach — same transport #54 wants for spored reload. But spored status's value is in-instance state (actual idle time, live process/port activity, real completion-file state) that the tags only approximate. src/aws/ec2.ts:242 is candid about this: lastActivityMs: cfg.launchTimeMs, // real activity comes from spored tags; approximate here. Worth doing eventually; not the cheap win.
Also unportable: --check-complete's exit-code propagation (0/1/2/3, with SSH's 255 mapped to 3 — status.go:105). It's a shell contract for polling callers; a browser has no exit code. If spawn-ts ever exposes completion programmatically it should return the same four states as an enum, not invent new names.
Suggested shape
A pure src/core/notices.ts — dnsNotice(inst), lifecycleProtection(inst, nowMs), sporedUpgrade(inst) — returning structured { level: "info" | "warn", text } rather than pre-formatted strings, so the CLI, the dashboard and the portal render them differently from one source. Fully unit-testable with no credentials, matching the pure/SDK split used everywhere else. elasticIpNotice sits in src/aws/ since it needs DescribeAddresses.
Part of the parity audit.
Activity
scttfrdmn commentedon Jul 31, 2026
Part of #57 (spawn-ts vs spawn parity audit).
feat(status): port the four tag-derived notices from Go's `spawn stat…
feat(plugins): declare 7 at launch, detect all 12 (#53) (#65)
chore(release): 0.7.0, and make the release process repeatable (#69)