Skip to content

spawn status performs a live DNS registration write (and re-runs agent init) on every invocation #733

Closed

Description

@scttfrdmn

Reported from the 2026-10-07 demo as "spored log lines leak into spawn status
output" with an alarming Warning: Failed to register DNS: DNS API returned HTTP 403 on screen. The leaked lines are a symptom. The cause is that spawn status
is not read-only.

What actually happens

spored status constructs a full agent:

// cmd/spored/main.go:622
ag, err := agent.NewAgent(ctx, prov)

and NewAgent registers DNS as part of construction
(pkg/agent/agent.go:248-256):

log.Printf("Registering DNS: %s -> %s", config.DNSName, identity.PublicIP)
resp, err := dnsClient.RegisterDNS(ctx, config.DNSName, identity.PublicIP)
if err != nil {
    log.Printf("Warning: Failed to register DNS: %v", err)
    agent.recordDNSStatus(ctx, "failed", err.Error())
}

So every spawn status:

  • POSTs to the spore.host DNS API, which mutates a Route53 record — a write,
    from a query command;
  • writes an EC2 tag via recordDNSStatus;
  • re-emits Agent initialized …, the TTL/idle config line, and the EBS
    cost-lookup line, which is the reported "leak";
  • prints a Warning … HTTP 403 when that write fails, describing a failure of an
    operation the user never asked for.

Six other spored subcommands take the same path (:832, :863, :929,
:1121, …), so this is not specific to status.

Why this is not just cosmetic

A read-only query having a control-plane side effect is a correctness problem
before it is a UX one: polling spawn status in a loop — which is the normal way
to watch a job — generates a DNS write per poll against a shared API. The 403 in
the demo means those writes are currently failing, which is the only reason it was
visible at all. If they had succeeded, nothing would have been printed and the
behaviour would still be wrong.

It also makes the previous fix in this area incomplete rather than wrong. #540
correctly removed a remote-side 2>&1 and cmd/status.go is careful to keep the
streams apart (emitStatus, cmd/status.go:462) — but separating stdout from
stderr cannot help when both land in the same terminal, and it was never going to
address a side effect.

Suggested fix

Split construction from activation. NewAgent should build state only; DNS
registration, the EBS cost lookup, and the initialization logging belong in a
Start/Activate the daemon calls and the query subcommands do not. A
read-only spored status should make no mutating call and emit no init logging.

If that split is too large for one change, a narrower first step: an
agent.NewAgentForQuery (or a provider.Config flag) that skips every side
effect, used by status, --check-complete and the other query subcommands.

Secondary, worth keeping once the above lands: the 403 itself. A DNS API refusing
this instance's registration is a real condition, and after the fix it should
surface where it belongs — at launch, and in spawn status's own
dnsStatusNotice annotation, which already reads the recorded status tag rather
than re-attempting the write.

Environment: spawn v0.123.0, spored v0.124.0.

Activity

  1. added
    bug
    on Oct 8, 2026
  2. scttfrdmn commented on Oct 8, 2026

    @scttfrdmn
    ContributorAuthor

    Noted from the demo guide: step 3 instructs presenters to run spawn status repeatedly, so each demo run performs several of these DNS writes. That makes the per-poll write a known, repeated count rather than a theoretical one.

    Also a possible shared fix with #741, raised by the reporter: that issue is the other caller of the DNS registration path (spawn launch shelling out to ssh on the critical path with a 4-minute retry). Making DNS registration explicitly asynchronous and best-effort with a deadline may address both. The call paths do differ — #741 shells out, this one is in-process in spored — so worth confirming before treating them as one change.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions