Repository navigation
fix(sweep-orchestrator): stop a legacy sweep at a missing spored-instance-profile and name the remedy (#1369) - #1387
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ance-profile and name the remedy (#1369) A legacy member (v0.146.0-or-older CLI params, or a schedule one created) with no iam_role launches with spored-instance-profile, which that CLI never ensured on the detached path. EC2 refuses it with InvalidParameterValue "Invalid IAM Instance Profile name". The orchestrator now classifies that refusal for legacy members: not capacity (no other instance type tried), the remaining members are not attempted on either launch path, and the sweep finishes FAILED with an error naming the remedy (re-run with spawn v0.147.0+, or re-create the schedule), both of which ensure the profile with the user's credentials. CLI-rendered members keep the existing behaviour. No IAM change.
scttfrdmn
force-pushed
the
fix/1369-legacy-member-profile
branch
from
October 28, 2026 19:07
1cc2b2a to
aeedc2a
Compare
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.
Fixes #1369
What
A member from a v0.146.0-or-older CLI's params (or a schedule one created) that names no
iam_rolelaunches withspored-instance-profile, the fallback inbuildRunInstancesInput(#1368). That CLI never ensured the profile on the detached path, so an account that only ever ran detached sweeps or schedules may not have it. In that case EC2 refuses every such member.The orchestrator now classifies the refusal. A member matches when:
spawn_user_dataand nospawn_tags),spored-instance-profile, andInvalidParameterValuewith "Invalid IAM Instance Profile" in the message (EC2's text isValue (spored-instance-profile) for parameter iamInstanceProfile.name is invalid. Invalid IAM Instance Profile name). This is the same shapepkg/aws.isTransientIAMInstanceProfilePropagationmatches for the propagation case (Task launch dies on a transient "Invalid IAM Instance Profile name" — the fixed 10s propagation sleep loses the IAM→EC2 race; RunInstances isn't retried #572).For such a member:
Not capacity.
isCapacityErrorreturns false for it, so none of the member's other instance types are tried.Fail fast. On both the single-region path (
launchBatch, pulled out ofrunPollingLoop) and the multi-region path (launchAcrossRegions, which drains every region's queue), the members not yet attempted are skipped. The sweep then finishesFAILED, even if some members with their owniam_rolelaunched before it (abortedStatus). Members that are already running stay monitored until they finish, so Detached (Lambda-orchestrated) sweeps never verify spored on their members (#1305 follow-up) #1313's heartbeat check still covers them.The remedy is named. It appears in the member's row error and in the sweep's
error_message, whichspawn status --sweep-idprints asError::spawn launch --param-file <params-file>.spawn schedule cancel <schedule-id>, thenspawn schedule create <params-file>with its--cron/--at.Both commands already call
ensureDetachedInstanceProfile(launchSweepDetachedandseedScheduleParams, covered byTestLaunchSweepDetachedSeedsBeforeUploadandTestSeedScheduleParams_CarriesTheBootstrap). It createsspored-instance-profilewith the user's credentials before anything is uploaded.spawn schedule createlaunches nothing itself. No remedy command was changed.spawn resume --detachis not named because it ensures no profile and the orchestrator does not resume a FAILED sweep.spawn onboardis not named because it is the portal BYOA flow and does not touch this profile.spawn doctoris not named because it is read-only by contract.Non-legacy members keep the existing behaviour. A CLI-rendered member that gets the same error fails its row with EC2's error and no remedy, is not retried as capacity, and the sweep's other members are still attempted. That CLI ensured the profile moments before it uploaded, so the cause there is propagation or a deletion since then, and "re-run with a current spawn" is what the user just did.
No IAM changes to the orchestrator, the cross-account role, or any member-account role. There is no
spawnd-rolefallback: that role has noec2:CreateTags, so #1313 would kill the member.Gates (each watched failing against a compiling mutation)
TestLegacyMemberMissingProfileStopsTheSweep(CLI + scheduled remedies, single-region),...MultiRegionSweep,TestLegacyProfileClassificationIsNarrowclassifyLaunchErrorreturns err unchangedt3.microoft3.micro|t3.small)isCapacityErrorreturns true for the profile errorlaunchBatchignores the abortTestCLIRenderedMemberMissingProfileKeepsGoing(non-legacy keeps behaviour)isLegacyParamsTestStoppedSweepIsFailedWhateverLaunchedabortedStatusreturns completionStatus's valueOn a full revert of the non-test code the tests don't compile. The capacity gate is a regression guard: on unmodified main the profile error was already non-capacity, so the gate fails only against the mutation.
Checks
make check,make lint(0 issues, all 10 modules), andsemgrep scan --config=auto --error .are clean.go test -racepasses inlambda/sweep-orchestrator. Help text is unchanged, so gen-docs was not needed. No AWS calls were made, so this is not live-verified.Deploy
This takes effect only once the hand-deployed
spawn-sweep-orchestratoris redeployed. After the release that carries it, runscripts/deploy-sweep-orchestrator.shfrom a clean checkout of that release tag; the script refuses anything else. Snapshot the function configuration before deploying and diff it afterwards.