Skip to content

Sweep orchestrator's --max-concurrent is user-typed, not quota-derived — no automatic wave sizing to fit a real account ceiling #492

Closed

Description

@scttfrdmn

Context

lambda/sweep-orchestrator/main.go:runPollingLoop (line ~408) already implements a real wave/staged-launch primitive: it polls active instance count every pollInterval, computes available := state.MaxConcurrent - activeCount (line 460), and launches min(available, remaining) — genuinely "launch a batch, wait for room, launch more."

But state.MaxConcurrent/MaxConcurrentPerRegion (pkg/sweep/detached.go:77-78) are always a number the CALLER types in (cmd/launch_sweep.go's --max-concurrent/--max-concurrent-per-region flags, cmd/resume.go:48's --max-concurrent override). Nothing computes or suggests this value from the account's actual AWS quota ceiling.

Real-world motivation

A downstream consumer (calque) launched a 10-shard fleet with no --max-concurrent-equivalent guardrail, hit an account's real ceiling (a G/VT Spot quota of 64 vCPUs = 8 concurrent g7e.2xlarge instances) with zero warning, and had 2 shards fail immediately plus a later mass-failure/re-drive collision once the other 8 shards' TTLs expired near-simultaneously and tried to relaunch against a quota that hadn't freed up yet.

truffle's pkg/quotas.GetQuotas/CanLaunch (see truffle#[cross-reference once filed]) already has the machinery to answer "what's my real Spot/On-Demand vCPU ceiling for instance family X in region Y" — spawn just doesn't call it anywhere (grep -rn "truffle" spawn/**/*.go finds no import of truffle/pkg/quotas anywhere in this repo today).

Ask

Give the sweep orchestrator (and/or launch_sweep's flag parsing) an option to derive MaxConcurrent from a queried quota instead of requiring the caller to already know it: e.g. --max-concurrent=auto (or similar) that calls truffle's quota client for the target instance family/region, converts the vCPU quota to an instance count via the instance type's own vCPU count, and uses that as the wave ceiling — falling back to today's explicit-number behavior when the caller does supply one. This closes the actual gap: the wave MECHANISM already exists in this repo; it just isn't wired to a real ceiling.

Cross-repo context

This is one of 3 related issues filed together after the calque incident above: truffle (fix CanLaunch's spot-usage-undertracking), spawn (this issue — make wave sizing quota-derivable), lagotto (let snipe's terminal-failure classification for quota-exceeded errors signal "reduce concurrency and retry" instead of a flat give-up, for callers like calque that don't use spawn's sweep orchestrator directly).

Activity

  1. scttfrdmn commented on Aug 10, 2026

    @scttfrdmn
    ContributorAuthor

    Cross-referenced: spore-host/truffle#132, spore-host/lagotto#116, spore-host/calque#141 (the consumer-side incident + fix). All 4 filed together after the same real-world calque N=100k fleet run finding.

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