Skip to content

status: the four tag-derived notices are unported — a failed DNS registration is invisible despite spored recording why #56

Closed

Description

@scttfrdmn

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:

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

  1. added
    enhancement
    area: core
    cost-safety
    on Jul 31, 2026
  2. scttfrdmn commented on Jul 31, 2026

    @scttfrdmn
    ContributorAuthor

    Part of #57 (spawn-ts vs spawn parity audit).

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: corecost-safetyenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions