Repository navigation
fix(sweep-orchestrator): make detached sweep rows reapable (#725) - #726
Merged
Merged
Conversation
Detached is the DEFAULT — launchParameterSweep auto-enables it — so the common
sweep launches through this Lambda, and its rows carried only spawn:sweep-id,
spawn:sweep-index and Name.
Two consequences that compounded into something worse than either:
- No UserData, so no spored: no TTL, idle or cost enforcement in-instance.
- No spawn:managed tag, so the reaper could not act either. Its
ec2:TerminateInstances grant is conditioned on exactly that tag —
deliberately, as the rail that keeps it away from resources spawn does not
own.
So neither layer of the lifecycle invariant (#70/#72) applied: nothing inside the
instance enforced anything and nothing outside it was permitted to. --ttl,
--cost-limit and --on-complete were all accepted on the command line and none
could function. A detached sweep ran until a human noticed, and `spawn orphans`
could not even show it, for the same missing tag.
Rows now carry spawn:managed=true, plus spawn:ttl-deadline when the sweep has a
ttl. Nothing needed plumbing: applyCLISpendControlsToSweep already writes ttl
into paramFormat.Defaults, and that map is uploaded to S3 and read here.
WHAT THIS DOES AND DOES NOT FIX, because the distinction matters: it restores the
BACKSTOP, not in-instance enforcement. A row is now reclaimed on a reaper cycle
rather than at its TTL to the minute. "Reaped within the hour" and "runs until
someone notices" are different kinds of problem, and this closes the second. The
UserData half needs the full launch config to reach this Lambda and stays open on
An absent ttl deliberately yields NO deadline rather than a guessed one. The
reaper's own max-age ceiling still bounds the instance, whereas a fabricated
deadline would terminate work the user never put a clock on — the same reasoning
as the Nitro table returning unknown rather than a plausible version.
The orchestrator has TWO RunInstances call sites, single-region and multi-region.
Both are stamped, and a gate counts tag specifications against calls to the
helper — fixing one and not the other would make a row's reapability depend on
which sweep shape the caller used, which is the kind of half-fix that hides.
Verified by reverting one site and watching the gate name the asymmetry, and by
removing the tag entirely and watching the reapability gate fire.
scttfrdmn
force-pushed
the
fix/725-sweep-rows-reapable
branch
from
October 8, 2026 01:47
c876f2e to
a7f5b1a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 8, 2026
scttfrdmn
added a commit
that referenced
this pull request
Oct 9, 2026
The script's header still said THIS TEST FAILS on #749. It no longer does: 8/8 against spawn v0.126.0 and the orchestrator Lambda deployed 2026-10-08, the first run in which #725's assertions were observable at all. Replaces the stale claim with what a future reader actually needs: that two things must be true at once and only one of them is in the repo. The CLI must seed the params (#751, in v0.126.0) AND the deployed orchestrator must carry the tag fix (#726). A Lambda does not upgrade with the CLI (#654), so a regression here is as likely to be a stale deploy as a code bug — the header now says to check the deployed LastModified against 'git log -- lambda/sweep-orchestrator/' first. No behaviour change; comments only. bash -n clean.
scttfrdmn
added a commit
that referenced
this pull request
Oct 9, 2026
) The script's header still said THIS TEST FAILS on #749. It no longer does: 8/8 against spawn v0.126.0 and the orchestrator Lambda deployed 2026-10-08, the first run in which #725's assertions were observable at all. Replaces the stale claim with what a future reader actually needs: that two things must be true at once and only one of them is in the repo. The CLI must seed the params (#751, in v0.126.0) AND the deployed orchestrator must carry the tag fix (#726). A Lambda does not upgrade with the CLI (#654), so a regression here is as likely to be a stale deploy as a code bug — the header now says to check the deployed LastModified against 'git log -- lambda/sweep-orchestrator/' first. No behaviour change; comments only. bash -n clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The minimum viable mitigation for #725. Restores the backstop, not in-instance enforcement — that distinction is the whole point and I want it visible before this merges.
What was wrong
Detached is the default (
launchParameterSweepauto-enables it), so the common sweep launches through this Lambda. Its rows carried onlyspawn:sweep-id,spawn:sweep-indexandName.UserData→ no spored → no TTL, idle or cost enforcement in-instancespawn:managed→ the reaper couldn't act either; itsec2:TerminateInstancesis conditioned on exactly that tag, deliberately, as the rail keeping it away from resources spawn doesn't ownNeither layer of the lifecycle invariant (#70/#72) applied: nothing inside enforced anything, nothing outside was permitted to.
--ttl,--cost-limitand--on-completewere all accepted and none could function.spawn orphanscouldn't show these rows either, for the same missing tag.The fix, and its limit
Rows now carry
spawn:managed=true, plusspawn:ttl-deadlinewhen the sweep has attl. Nothing needed plumbing —applyCLISpendControlsToSweepalready writesttlintoparamFormat.Defaults, and that map goes to S3 and is read here.A row is now reclaimed on a reaper cycle rather than at its TTL to the minute. That's a real reduction in guarantee versus a normal launch, and worth stating plainly rather than claiming the bug is fixed. But "reaped within the hour" and "runs until a human notices" are different kinds of problem, and this closes the second. The
UserDatahalf needs the full launch config to reach this Lambda; it stays open on #725.Two deliberate choices
An absent
ttlyields no deadline, not a guessed one. The reaper's own max-age ceiling still bounds the instance, whereas a fabricated deadline would terminate work the user never put a clock on. Same reasoning as the Nitro table returning unknown rather than a plausible version.Both launch paths are stamped. The orchestrator has two
RunInstancescall sites — single-region and multi-region — and a gate counts tag specifications against calls to the helper. Fixing one and not the other would make a row's reapability depend on which sweep shape the caller used, which is the kind of half-fix that hides. I only noticed there were two because the patch reportedpatched 2 RunInstances tag spec(s).Verified
How this was found
Hardware-testing #697. The sweep smoke kept reporting "found 0 rows" and I fixed two real bugs in my own test leg before realising neither was the cause: the CLI had returned before any instance existed, because the work had gone to a Lambda I hadn't looked at. Reading the launch it actually performs is what surfaced this.