Repository navigation
Description
Summary
`spawn extend ` writes TWO tags for what should be one fact:
- `spawn:ttl-deadline` (absolute RFC3339 timestamp) — correctly advanced by `` from the existing deadline. This is authoritative: it's what `spored`'s `Agent.checkAndAct` and the out-of-band reaper both read.
- `spawn:ttl` (a duration string) — overwritten with the literal `` argument itself, not the new cumulative total TTL from launch.
These two are supposed to describe the same fact (how long this instance is allowed to live) and after even one `extend` call they diverge, because `spawn:ttl`'s value now means "the last amount I extended by," not "the instance's total TTL duration" — which is what it means everywhere else it's read.
Confirmed live in a field report (2026-08-18): an instance launched with `--ttl 8h`, then `spawn extend 8h` run twice. `spawn:ttl-deadline` correctly advanced launch+8h → launch+16h → launch+24h across the two calls. `spawn:ttl` stayed `"8h"` the whole time (each call rewrote it to the same literal argument) — which by coincidence looked unchanged and read as "extend did nothing," when in fact the deadline had genuinely moved. Reported as: "extend rewrites spawn:ttl-deadline and leaves spawn:ttl at the original 8h... two tags for one fact, only one of them moving."
Why this is a real bug, not just a confusing coincidence
`cmd/extend.go` itself treats `instance.TTL` (the `spawn:ttl` tag) as the authoritative total when there's no deadline tag yet:
if newDeadline.IsZero() {
// Older instance without deadline tag — best-effort from current TTL
if cur, err := time.ParseDuration(instance.TTL); err == nil {
newDeadline = time.Now().Add(cur).Add(extendDuration)
}
...And `cmd/state.go`'s stop/hibernate path computes the TTL remaining to preserve across a stop/start cycle from `instance.TTL` + `LaunchTime`, not from `spawn:ttl-deadline`:
if instance.TTL != "" {
ttlDuration, err := parseDuration(instance.TTL)
if err == nil {
uptime := time.Since(instance.LaunchTime)
remaining := ttlDuration - uptime
...So: launch with `--ttl 8h`, run `spawn extend 8h` (deadline correctly moves to launch+16h, but `spawn:ttl` is rewritten to `"8h"`), then `spawn stop` before the original 8h mark — this computes `remaining = 8h - uptime`, silently ignoring the extension, and on `spawn start` restores a TTL duration that has nothing to do with the actual extended deadline the instance was on before it stopped.
`cmd/status.go`'s `lifecycleDeadline` correctly prefers `spawn:ttl-deadline` when present, so `spawn status`'s "Termination deadline" line is NOT affected by this — only `instance.TTL`'s other readers are.
Suggested fix
Pick one:
- Stop writing `spawn:ttl` at all in `cmd/extend.go` once `spawn:ttl-deadline` exists — it's redundant with (and now actively conflicting with) the deadline tag, and every reader that matters (`spored`, the reaper, `status`) already prefers the deadline. Keep `spawn:ttl` only as the pre-deadline legacy fallback it originated as.
- Or, if `spawn:ttl` must keep meaning "total duration from launch" for its other readers (stop/start's remaining-TTL preservation, in particular), compute it as `newDeadline - instance.LaunchTime` rather than echoing the raw `` argument.
- Either way, fix `cmd/state.go`'s `stopOrHibernate`/remaining-TTL calculation to derive from `spawn:ttl-deadline` (when present) instead of `instance.TTL` + `LaunchTime` — this is the one with a real behavioral consequence (a stop/start cycle after any `extend` call restores the wrong TTL).
Environment
Field report, 2026-08-18: spored v0.100.0, 7 instances, `spawn extend 8h` run twice per instance, verified via `aws ec2 describe-tags` reads of `spawn:ttl` / `spawn:ttl-deadline` / `spawn:stop-at` / `spawn:ttl-extended-at`. Independently reproduced live (same session) with a disposable `t3.micro`: launched `--ttl 20m`, `spawn extend 15m` correctly advanced `spawn:ttl-deadline` by 15m while `spawn:ttl` became `"15m"` (not `"35m"`).
Activity
scttfrdmn commentedon Aug 18, 2026
Field corroboration for the reproduction, from the report you're working off — all seven instances, with the CloudTrail record, in case the exact rewrite pattern is useful for a regression test.
Seven
c8g.48xlarge, us-east-1, account 942542972736, launched with--ttl 8h, thenspawn extend <id> 8htwice per instance. EveryCreateTagscall writes both keys together,spawn:ttlalways the literal argument:All seven, after both extends —
spawn:ttl=8huniformly,spawn:ttl-deadline= LaunchTime + 24h:i-03a29c216d46c3b86i-08efa17ed1bb2f099i-08b9ad516db6dd2fei-03c73299d8b91b416i-0d79af36b80961170i-05c34d471ee84e2dbi-03ebed621d8799f31Two things to add from the operator side:
1. The failure isn't just confusing — it drove a wrong corrective action. Verifying the extension by effect, I read
spawn:ttl(plusspawn:stop-atandspawn:ttl-extended-at, neither of which exists), found8hunchanged, and derivedLaunchTime + spawn:ttl= 06:25–06:53Z. That's the obvious derivation for any external monitor, and it was 16 hours pessimistic. I concludedextendwas a no-op and was about to take emergency action to save four in-flight multi-hour DFT runs that were in no danger. Whichever way #506 lands, aspawn:ttl-extended-atbreadcrumb would make an extension visible to someone auditing tags rather than reading the CLI's stdout.2. A datum for #502's severity, and a check worth adding to the reaper's own tests: with the broken role, nothing enforced either tag. A separate instance in the same account,
i-05782b84f7db5c515(biosurf-gpaw2670-build, launched 00:59:31Z with--ttl 4h, never extended, so both tags agree):1h25m past an unambiguous, uncontested deadline and still running. In-instance enforcement was dead per #502, and the out-of-band reaper did not pick it up either (not deployed for this account, or it failed silently —
spawn statushedges this as "if deployed for your account", so from the user side it's unfalsifiable). On the seven-instance fleet the same is true: they sailed past their original 06:25–06:53Z deadlines with no event. So for a #502-affected instance, both layers of "lifecycle protection" were absent simultaneously, and no surface reported that. If the reaper has an alarm for not firing on an overdue instance (#475 covers the reaper not running at all), an overdue-but-alive instance looks like a good second signal.On checking
spawn:ttl-deadlineas the authoritative tag — agreed, and that's now what I do. Worth noting it's the tag that made #506 findable at all: it's the only place the two extends left a trace.fix: spawn:ttl now tracks the cumulative total, not the raw extend ar…