Skip to content

--cost-limit did not fire: on-demand c8gn.48xlarge with --cost-limit 25 ran ~$29 (after spawn extend + spored reload) #1262

Closed

Description

@scttfrdmn

Seen: scttfrdmn/adit G2 rerun, us-east-2a, 2026-10-20. spawn was built from the #1206 branch.

Setup: 8 on-demand c8gn.48xlarge launched with --ttl 2h --cost-limit 25. The Price List on-demand rate is $11.376/hr, so the hard kill should fire at about 132 min.

What happened:

  • Run time: each instance ran 152.5–157.8 min (launch 21:13:59–21:18:04Z, user-initiated terminate 23:50:35–23:51:54Z). That is about $28.9–29.9 of compute each, above the limit.
  • No kill: no cost-limit termination fired on any of them.

Possibly relevant: I extended every box twice with spawn extend <box> 1h, about 22:01Z and 23:25Z, each time followed by spawn connect <box> -- sudo spored reload. This is what spawn's own guidance says for Ubuntu.

Hypothesis, not verified: spored reload restarts spored's spend accounting (its runtime clock), so accrued cost resets on each reload and never reaches the limit. If so, a cost-limit is not a hard ceiling for any box whose TTL is extended. The expected behaviour is that accrued cost persists across reloads and extends.

Instance ids (us-east-2): i-03e203c85002fc005, i-04f04a2206fcd6761, i-089669de261bc8377, i-055656b3407dd51f3, i-08954b46358031e80, i-0ef0078d51eedbad0, i-054ee3b572cc36c78, i-033322107f10d7af7.

Activity

  1. scttfrdmn commented on Oct 23, 2026

    @scttfrdmn
    ContributorAuthor

    Two notes from reading the code (main, e45e1b9). No live repro yet.

    1. The reload is unlikely to be the cause. spored reload never reaches the running daemon: it reloads a throwaway agent in its own process (now spored reload never reaches the running daemon: it reloads a throwaway agent in its own process #1278). The compute base is persisted in a tag (pkg/agent/agent.go:1033), so nothing resets the cost clock.
    2. A likelier suspect: enforcement is silently off without a price. The check is gated on a.config.CostLimit > 0 && a.config.PricePerHour > 0 (pkg/agent/agent.go:754). If spawn:price-per-hour was missing or 0, for example because a price lookup for c8gn.48xlarge failed at launch, --cost-limit 25 was accepted and never enforced, with no warning. That would also explain the ~$29.

    To confirm on a repro: check the instance's spawn:price-per-hour tag, and whether spored status reports the cost limit as active. Separately from the root cause, a cost limit that cannot be enforced should fail at launch, or at least warn, rather than doing nothing silently.

  2. scttfrdmn commented on Oct 24, 2026

    @scttfrdmn
    ContributorAuthor

    Root cause found, and it corrects my earlier comment. spawn extend raised the cap. Since #639, extend by default raised spawn:cost-limit to whatever the new deadline needed. Each box had a 2h TTL and a $25 cap at $11.376/hr. Extending by 1h twice moved the deadline to 4h, and the cap went to about $34 and then about $46. The boxes were terminated by hand at about $29, before reaching it. Each extend printed Cost limit: $25.0000 → $….

    The price-tag theory in my earlier comment does not apply: a Linux launch with --cost-limit and no known price is already refused at launch. spored reload does not reach the daemon either (#1278).

    Fix in #1281, per the owner's decision. extend now keeps the cost limit. When the kept cap will terminate the instance before the new deadline, extend warns: it gives about when, what running to the deadline would cost, and the exact --cost-limit command to allow it. --raise-cost-limit restores the old raise. Targeted for the next release.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions