Repository navigation
Conversation
This was referenced Oct 15, 2026
Merged
Make the stranded Spot replacement alarm actionable; record why the reaper cannot end it (#984)
#996
Merged
…ation (#949) EC2 hibernates only an instance launched with HibernationOptions.Configured and an encrypted root, and only --hibernate set that. --on-idle hibernate, --hibernate-on-idle and --on-complete hibernate therefore launched instances whose hibernate fell back to a plain stop, and a persistent Spot request was interrupted by stop. pkg/aws Launch now implies Hibernate from LaunchConfig.HibernationRequested(), before tags, block devices and Spot options are built, so SDK callers get it too. The CLI sets it in buildLaunchConfig so the hibernation pre-flight (now also covering --on-complete hibernate), dry-run and estimate see it. With no --volume-size the hibernation root is sized from the type's real memory (DescribeInstanceTypes) + 10 GiB. spawn status reads EC2's HibernationOptions.Configured (new InstanceInfo.HibernationConfigured) and says a not-configured instance will be stopped, not hibernated. (#949)
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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 #949
Stacked on #951 (base
fix/922). Review and merge #951 first.What was wrong
EC2 hibernates only an instance launched with
HibernationOptions.Configured=trueand an encrypted root, and only--hibernateset those.--on-idle hibernate,--hibernate-on-idleand--on-complete hibernateall launched an instance whose hibernate fell back to a plain stop inEC2Provider.Hibernate, so RAM was lost. After #922, a persistent Spot request for one of these launches was interrupted by stop as well.Fix: imply, don't refuse
Implying hibernation is cheap here.
config.Hibernatealready carries the whole configuration:HibernationOptions, the encrypted root, and the hibernate interruption behaviour on a persistent Spot request. The CLI pre-flight already refused types that can't hibernate when--on-idle hibernatewas given.pkg/aws: addedLaunchConfig.HibernationRequested().LaunchnormalizesHibernatefrom it before it builds tags, block devices and Spot options. This is where the invariant lives, so SDK callers (lagotto, spore-host-mcp, sweeps) get the fix too.buildLaunchConfigsetsHibernatetoo, so the pre-flight, the dry-run plan and--estimate-onlyall see it. The pre-flight now covers--on-complete hibernateas well, and its refusal names the flag that asked for hibernation.--volume-size, a hibernation launch's root is sized from the type's real memory (DescribeInstanceTypes via the existingInstanceMemoryMiB) plus 10 GiB. The per-family table gave every m7i 16 GiB of RAM, so an m7i.4xlarge (64 GiB) got a 26 GiB root. When the lookup fails it falls back to that table. An explicit--volume-sizeis kept as given.spawn status: reads EC2'sHibernationOptions.Configured(new fieldInstanceInfo.HibernationConfigured). For an--on-idle hibernateinstance launched before this fix, it now says the idle timeout will stop it and RAM is not kept.LaunchConfig.HibernationRequested()andInstanceInfo.HibernationConfigured.Tests (each seen to fail against a revert that compiles)
pkg/awsTestLaunch_HibernateLifecycleConfiguresHibernationgoes through the realClient.Launchagainst a wire-level fake. It checksHibernationOptions.Configuredand the encrypted root for each lifecycle.pkg/awsTestLaunch_HibernationRootSizedFromRealMemoryandTestHibernationRootGiB.pkg/awsTestLaunch_SpotRequestShapeForEachLifecycle: the --spot launches one-time Spot requests, which EC2 cannot stop — idle-stop, on-idle/on-complete stop, hibernate and 'spawn stop' can never work for --spot #922 row that expectedon-idle hibernate→ interruptionstopwas asserting the bug, so it now expectshibernate. A newon-complete hibernaterow is added.cmdTestBuildLaunchConfig_HibernateLifecycleImpliesHibernation,TestHibernationRequestedBy, andTestIdleActionDescriptionwith a new not-configured row.Reverts tried:
HibernationRequestedreturning onlylc.Hibernate, the CLI implication disabled withif false &&, the RAM-size assignment replaced with_ = gib, and the status branch disabled withif false &&. Every one made its tests fail.make check: everything passes except the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nested: all 9 nested modules clean.Caveats
HibernateOnIdleorOnComplete: "hibernate"on a type or AMI that can't hibernate now gets an EC2RunInstanceserror, where before the launch succeeded and later stopped instead of hibernating. Only the CLI runs the friendly pre-flight.--spot --on-idle hibernatewith no idle timeout now makes a persistent request, because hibernation is configured.RunInstances.