• Stefy Lanza (nextime / spora )'s avatar
    a request could ask for a warm floor but not for a ceiling (v0.4.33) · d6b35d18
    Stefy Lanza (nextime / spora ) authored
    /v1/runpod/scale set a FLOOR. "Give me 8 pods" meant "hold at least 8
    ready", and the autoscaler stayed free to grow the pool to the configured
    max_pods for as long as work kept arriving. A client running a staged
    batch -- 8 pods for the first stage, 32 for the next -- had no way to
    bound a stage at all, and nothing in the reply said so.
    
    Observed 2026-10-18: a run that asked for 8 pods was at 13 and climbing
    toward 128. Every pod past the plan is ~700s of paid boot producing
    nothing, which is why the realised cost per page came out 16.5x the
    measured baseline while every component behaved exactly as written.
    
    A lease may now also carry `max_pods`, under the same rule `gpu_types`
    already follows there: it may only ever NARROW the operator's ceiling, a
    larger number is clamped and reported in `notes`, and it dies with the
    lease. `pods: 0` with a `max_pods` is a cap with no floor -- what a
    client with a long tail of work wants; `pods: 0` alone releases both.
    
    The ceiling has to be read by EVERY path that decides whether to rent,
    or it is a race between the grower that honours it and the one that does
    not: _pods_for_demand, _grow_reason, _pods_needed and the warm-floor
    top-up all now read effective_max_pods(). A leased floor is clamped to
    it too, since a floor above a ceiling is a fleet that oscillates for as
    long as the lease lasts. A configured max_pods of 0 still means zero --
    that is the operator having turned renting off, not a lease.
    
    22 tests, including a guard that no growth path reads mcfg.max_pods
    directly, so a path added later cannot silently escape every cap.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01KnfkxBpcZ1v6ypRFFyhrVM
    d6b35d18
test_runpod_schedule_region_spend.py 12.1 KB