Skip to content

--estimate-only quotes a fabricated rate: c8g.metal-48xl priced at $0.20/hr against a real $7.66, and the same launch tags the instance correctly #543

Closed

Description

@scttfrdmn

Summary

spawn launch --estimate-only priced c8g.metal-48xl in us-east-1 at $0.2000/hr against
a real $7.6570/hr — 38× under — and quoted a 20-hour TTL at $4.00 against a real
$153.14. Measured today, spawn 0.101.0 (072c4b0), on a principal that can read the
Price List: the same launch, seconds later, stamped the correct rate on the instance
(spawn:price-per-hour=7.656960 on i-04194f1208ee1d602).

So this is not #533's IAM gap. The estimate path never asks. cmd/launch_single.go:298 calls
libs/pricing.GetEC2HourlyRate — the static guess table — unconditionally, with no live
lookup attempted and no fallback semantics involved. The correct rate was available, in
process, from the pricer the very next code path used.

#533 anticipated exactly this and deliberately deferred it ("The same table also feeds three
display surfaces … not filed as its own issue, so that this one is not held up behind a
cosmetic fix — because a fix here probably covers all four call sites"). It did not: #533's fix
landed on the enforcement side only (pkg/aws/pricing.go resolvePricePerHour, delegating to
truffle). Filing the deferred half so it is not lost, plus two things that are new.

New thing 1: fixing only the enforcement half inverted the direction of the harm

Before #533's fix, estimate and enforcement were consistently wrong in the same direction:
both said $0.20, so a cap sized from the estimate was enforced in the same fictional units and
merely failed to fire. After the fix they disagree by 38×, and only the wrong one is shown to
the human
:

spawn launch gbb-p2 --instance-type c8g.metal-48xl --region us-east-1 --az us-east-1a \
  --ttl 20h --cost-limit 200 ... --estimate-only

💰 Cost estimate for c8g.metal-48xl in us-east-1
   On-demand:  $0.2000/hr
   TTL cost:   $4.00 (20 hr)
✅ Estimate complete — no instances launched (--estimate-only)

A user who sizes --cost-limit from that output — which is what the output is for — picks
something around $5–10 for a 20-hour job. Enforcement now uses the true $7.6570, so
--cost-limit 5 fires at 39 minutes of a 20-hour sweep. The instance-hours are spent and
the run is incomplete: for a benchmark pass that is the whole cost with none of the result.
Pre-fix the same command overspent silently; post-fix it terminates early silently. Both are
spend-safety, and the second is not obviously the better one.

(This is why I dropped --cost-limit from the real launch and relied on --ttl alone. A limit
derived from a 38×-low rate reads as protection and provides none, in whichever direction it
turns out to be wrong.)

New thing 2: a second, larger mechanism — the metal size token

#533's measured cases all missed on basePriceLarge (unknown family → base = 0.10). This
one misses on sizeMultiplier too, and that term is the bigger one. ec2.go:222-238 has
exactly one metal key:

"48xlarge": 96.0,
"metal":    48.0,

Every Graviton bare-metal size is spelled metal-24xl / metal-48xl, not metal. None of
them match, so they take multiplier = 2.0 // default to xlarge (ec2.go:246-249) — a 192-vCPU box priced as a
4-vCPU one. Decomposing c8g.metal-48xl:

term guessed correct error
basePriceLarge["c8g"] 0.10 (default) 0.07976 (= 7.6570 / 96) 1.25× over
sizeMultiplier["metal-48xl"] 2.0 (default) 96.0 48× under
product $0.2000 $7.6570 38.3× under

The two defaults partially cancel, which is what makes the result plausible rather than
absurd. And the size term is scale-free: it will be 48× low for metal-48xl on any family,
including families someone later remembers to add to basePriceLarge. Note metal: 48.0 is
correct for c5.metal (96 vCPU) and pricing/pricing_test.go:146-150 asserts it — so the
mechanism tests green on the one spelling AWS stopped using. pricing_test.go:141-145
("Unknown size (uses xlarge default)") asserts the 2.0 default itself as intended behaviour.

Measured: all five instance types in a live campaign, wrong in both directions

us-east-1, 2026-08-20. "Live" is truffle's Price List answer
(truffle find <type> --regions us-east-1 --show-price) — the same authority
resolvePricePerHour uses, so guess and truth here come from the two halves of spawn's own
pricing story.

Instance type vCPU GetEC2HourlyRate truffle live Error
c8g.metal-48xl 192 $0.2000 $7.6570 38.3× under
c9g.metal-48xl 192 $0.2000 $8.3462 41.7× under
c8g.48xlarge 192 $9.6000 $7.6570 1.25× over
hpc7g.16xlarge 64 $3.2000 $1.6832 1.90× over
c7g.16xlarge 64 $3.2000 $2.3200 1.38× over
c6g.16xlarge 64 $3.2000 $2.1760 1.47× over

Five of those six are the host set of a real measurement campaign priced through spawn, and
not one is right. As #533 already noted, the sign flips by family, so a single spot-check
cannot tell you which side you are on — and here it flips within one campaign, so a user who
sanity-checks c7g.16xlarge (1.4× high, reassuringly conservative) concludes the estimator is
pessimistic right before it under-quotes the metal host by 38×.

Repro needs no AWS access at all:

pricing.GetEC2HourlyRate("us-east-1", "c8g.metal-48xl")  // 0.20
pricing.GetEC2HourlyRate("us-east-1", "c9g.metal-48xl")  // 0.20
pricing.GetEC2HourlyRate("us-east-1", "hpc7g.16xlarge")  // 3.20

Call sites still on the guess table

libs v0.43.3, spawn main:

Call site Surface In #533's table?
cmd/launch_single.go:298 --estimate-only: "On-demand:" and "TTL cost:" yes
cmd/service.go:196 spawn service: "Rate:" and "Max cost:" yes
pkg/cost/cost.go:257 spawn cost compute cost yes
libs/pricing/estimator.go:67 (EstimateSweepCost) sweep --estimate-only per-row estimate — cmd/launch_sweep.go:854, :939 no
↑ same value --budget comparison, reportSweepBudget(costEstimate.TotalCost) cmd/launch_sweep.go:862 no

The last one is the one I would prioritise after launch_single.go: --budget is documented
as a warning rather than a cap, but a sweep budget check computed from this table is a warning
that will not warn. On a fleet of metal-48xl rows it under-counts the whole sweep by ~38×.

Suggested fix

The precedent is already in this repo, written out in cmd/slurm.go:46-61: build truffle's
pricer, opt out of the static fallback for a spend-gate figure, and let an unpriceable type
be an error naming the type and region. That comment's reasoning — "it is what a user says yes
to before spawn launches billable instances, and a rate that is merely old is still wrong to
quote as current" — applies verbatim to --estimate-only, which is the say-yes surface.

  1. cmd/launch_single.go:294-310 — replace pricing.GetEC2HourlyRate with the same
    truffleaws pricer. awsClient is already in scope, so it is roughly the two lines of
    cmd/slurm.go:46 + :60. Print the PriceSource alongside the rate; truffle already returns
    it, and an estimate that does not say whether it was quoted or guessed cannot be audited.
  2. Same for cmd/service.go:196, where the label is Max cost: — a word that reads as a
    bound, not a guess.
  3. libs/pricing.GetEC2HourlyRate cannot say "I don't know", and that is the root defect.
    Give it an (float64, error) or (float64, bool) form. As written, its
    pricing data unavailable caller branch (launch_single.go:299) is unreachable: a type
    with no . gets 0.10 (ec2.go:185-187), and an unknown region silently substitutes
    us-east-1's table (ec2.go:166-169). The one branch that would tell the truth is dead
    because the fallback guarantees a plausible number.
  4. Do not fix this by adding c8g/c9g/metal-48xl to the tables. That is the treadmill
    --cost-limit is enforced against a fabricated rate: an $8 cap on g6e.xlarge does not fire until $74 #533 already declined to get on — the same table was found missing g6/g6e/p5/p5e/c7g/c8g
    nine months of instance launches ago, and the fix was to stop consulting it. Adding six
    keys buys a quiet year and then mis-prices c10g the same way.
  5. Regression test: GetEC2HourlyRate (or its successor) must not return a number for a
    type it does not know. pricing/pricing_test.go:66-71 and :131-135 currently assert
    unknown.xlarge → 0.2 as intended behaviour, which locks in the exact value this issue is
    about; :141-145 locks in the size default; :146-150's c5.metal case is the one metal
    spelling that works; and :60-65 locks in the silent unknown-region substitution. A case for
    c8g.metal-48xl would have caught this before a human read $4.00 and reached for
    --cost-limit.

Refs #533 (enforcement half; this is the display half it deferred),
spore-host/truffle#114 (same defect, same resolution: a missing rate is an error, not a guess).


Found while costing phase P2 of scttfrdmn/graviton-blas-bench, whose standing orders require
a cost estimate in the tracking issue before any instance is launched. The estimate that
policy depends on was 38× low.

Activity

  1. added
    bug
    area:cost
    spend-safety
    on Aug 20, 2026
  2. scttfrdmn commented on Aug 20, 2026

    @scttfrdmn
    ContributorAuthor

    Two more absent size keys, and they are not metal: 96xlarge (90× under) and 32xlarge (32× under)

    Second campaign, different project (scttfrdmn/keel, x86 AVX-512 BLAS), same estimator. Six
    types priced through spawn launch --estimate-only against truffle find --show-price,
    us-east-1 Linux on-demand, spawn 0.101.0, 2026-08-20:

    Instance type vCPU --estimate-only truffle live Error
    c8i.96xlarge 384 $0.2000 $17.9923 90.0× under
    c6i.32xlarge 128 $0.1700 $5.4400 32.0× under
    c8a.48xlarge 192 $9.6000 $10.3459 1.08× under
    c7a.48xlarge 192 $9.6000 $9.8534 1.03× under
    c5.24xlarge 96 $4.0800 $4.0800 exact
    c7i.48xlarge 192 $8.5728 $8.5680 1.0006× over

    This issue's "New thing 2" reads as a metal-spelling defect. It is not. c8i.96xlarge and
    c6i.32xlarge are ordinary Nxlarge spellings on current-generation x86. sizeMultiplier has
    no 96xlarge and no 32xlarge key, so both take multiplier = 2.0. Adding the Graviton metal
    spellings would leave both of these exactly as wrong as they are now.

    90.0× is the largest error measured on this issue so far (against 38.3× and 41.7×), and it
    is not a corner: c8i.96xlarge at $17.99/hr is the most expensive host in the campaign, so the
    worst-quoted type is the one whose quote matters most.

    c6i.32xlarge isolates sizeMultiplier with no contamination from basePriceLarge

    Every case on this issue so far mixes both defaults, which is what the "two defaults partially
    cancel" note is about. This one does not:

    term guessed correct error
    basePriceLarge["c6i"] 0.085 0.085 (= 5.4400 / 64) exact
    sizeMultiplier["32xlarge"] 2.0 (default) 64.0 32× under
    product $0.1700 $5.4400 32.0× under

    So the 32× is the size default alone, measured with the base term held right by the table
    itself. c8i.96xlarge decomposes as base 0.10 (default) vs 0.09371 — 1.07× over — against a
    size term 96× under, netting 90×.

    The spot-check hazard is worse than "the sign flips by family"

    It flips by size token within one vendor's adjacent generations, and one of the pair reads
    exact:

    • c7i.48xlarge → 0.06% over. Both terms present and right (base 0.0893, multiplier 96.0).
      This is the most accurate reading anywhere on this issue.
    • c8i.96xlarge → 90× under.

    A user sanity-checking the Intel arm of a fleet on c7i.48xlarge gets an answer correct to four
    decimal places, and concludes the estimator is trustworthy immediately before it under-quotes
    c8i.96xlarge by ninety-fold. c5.24xlarge reading exactly $4.0800 makes that worse, not
    better.

    Regression cases

    The suggested test in item 5 is c8g.metal-48xl. A metal-only case would still pass while
    96xlarge and 32xlarge are broken. Non-metal x86 cases that fail today:

    pricing.GetEC2HourlyRate("us-east-1", "c8i.96xlarge")  // 0.20, real 17.9923
    pricing.GetEC2HourlyRate("us-east-1", "c6i.32xlarge")  // 0.17, real 5.4400

    Confirming the fix target from the launch side

    The proposed fix — route --estimate-only through the pricer the launch path already uses — is
    confirmed by this campaign's own launch log. The same command that estimated c7a.48xlarge
    printed, seconds later:

    2026/08/19 23:27:31 pricing: c7a.48xlarge in us-east-1 = $9.8534/hr (truffle, live AWS Price List)
    

    Exact, sourced, and already labelled with its provenance, in the same process that had just
    quoted the guess. Nothing needs to be built for item 1; the call is there.

    Commented rather than filed separately: same root cause, same fix, and item 4 rules out the
    patch a second issue would invite.

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:costbugspend-safety

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions