Repository navigation
fix(image): warm seed needs SSM instance profile; distinguish dead from slow (#98) - #181
Merged
Merged
Conversation
…#98) The warm-AMI build's seed was launched without an IAM instance profile, so its SSM agent had no credentials to register — PingStatus could never reach Online. The warm stage then waited out the full 30-min timeout on a structurally impossible condition and failed (field report from Win11 25H2 import). - Launch the warm seed with the spored instance profile (SetupSporedIAMRole, which attaches AmazonSSMManagedInstanceCore) — same as the normal launch path. - WaitForSSMOnline now distinguishes "dead" from "slow": when an instance is not yet Online it checks for an attached instance profile; with none it returns ErrSSMUnreachable immediately instead of waiting out the timeout. The profile check is consulted only while registration is pending, so a transient describe gap on a healthy (already-Online) instance can't yield a false "dead". - Add WaitForSSMOnlineProgress with an elapsed callback; the warm build prints a periodic heartbeat so a long-but-live wait doesn't look hung. Substrate can't model the dead path (it reports every running instance as SSM Online and doesn't echo IamInstanceProfile), so the decision input (instanceHasInstanceProfile) is unit-tested directly; substrate gap filed. Refs #98
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
scttfrdmn
added a commit
that referenced
this pull request
Jun 15, 2026
…est (#182) substrate v0.71.0 models the SSM dead-state (substrate#331): a running instance with no IAM instance profile is no longer listed by DescribeInstanceInformation, and DescribeInstances now echoes the IamInstanceProfile set at launch. This lets WaitForSSMOnline's "dead vs slow" distinction (#98 / #181) be tested end-to-end again: restored TestWaitForSSMOnline_NoProfileIsDeadNotSlow, which asserts ErrSSMUnreachable fires fast for a no-profile instance instead of waiting out the timeout. It was unit-only while substrate reported every running instance as Online. The pkg/testutil import is already github.com/scttfrdmn/substrate/emulator (the v0.69.0 reorg path), so no import change was needed. go test ./pkg/aws ./cmd green; go vet clean.
Merged
scttfrdmn
added a commit
that referenced
this pull request
Jun 16, 2026
Promote CHANGELOG [Unreleased] → [0.53.0]. MINOR per SemVer (backward-compatible fixes + dep bump). Ships: - image import warm-AMI: SSM dead-vs-slow fix — warm seed gets the spored instance profile so SSM can register; fail-fast on no-profile instead of a 30-min timeout (#98 / #181). This is the Windows `spawn image import` SSM fix. - extend: floor TTL deadline at now+duration, no premature reaping (#374) - snapshot create: ext4 lost+found 0755, no spurious find Permission denied (#177) - substrate test dep → v0.71.0; re-enabled SSM dead-path e2e (#182) - Semgrep SAST enforcing in CI (#368)
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.
Field report (Win11 25H2
spawn image import): warm-AMI build fails after a 30-min wait — "warm seed's SSM agent never came Online ... instance did not register with SSM (PingStatus=Online) within 30m0s."Root cause
The warm seed was launched without an IAM instance profile (
cmd/image.goomittedIamInstanceProfile, unlike the normal launch path). WithoutAmazonSSMManagedInstanceCore, the SSM agent boots and runs but has no credentials to callUpdateInstanceInformation— so it can never register. The warm stage then waited out the full timeout on a structurally impossible condition. This is "dead," not "slow."Fix — two parts (matching the "tell slow from dead" ask)
SetupSporedIAMRole()(which attachesAmazonSSMManagedInstanceCore) — exactly whatcmd/launch.godoes.WaitForSSMOnlinenow, only while registration is still pending, checks whether an instance profile is attached. With none it returns a newErrSSMUnreachableimmediately (with elapsed context) instead of burning the timeout. The check is skipped once the instance is Online, so a transientDescribeInstancesgap on a healthy instance can't produce a false "dead." AddedWaitForSSMOnlineProgresswith an elapsed callback; the warm build prints a heartbeat every ~2 min so a long-but-live wait doesn't look hung.Tests
go test ./pkg/aws ./cmdgreen. NewTestInstanceHasInstanceProfile_NoProfilevalidates the decisive "dead vs slow" probe.Substrate limitation (gap filed): the emulator reports every running instance as SSM
PingStatus=Onlineand doesn't echoIamInstanceProfileinDescribeInstances, so it has no running-but-unregistered state to model the full end-to-end dead path. I test the decision input (instanceHasInstanceProfile) directly instead, and documented this in the test.Refs #98. Pairs with the earlier warm-AMI work and #153 (EC2Launch re-arm).