Repository navigation
Conversation
This was referenced Oct 15, 2026
Closed
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Oct 15, 2026
registry.NewPeerRegistry built its DynamoDB client from the ambient chain alone. On an instance that chain names no region (no AWS_REGION, and the SDK does not read IMDS unless asked), so every job-array member's Register failed with "Missing Region". Pin it to identity.Region, as every other spored client already does: `spawn burst` creates spawn-hybrid-registry in the region it launches into, so the instance's region is where the table is. The infra account holds no such table. Identity.AWSRegion treats the local provider's "local" placeholder as unset, so a local node without a configured region still uses the ambient chain; the local provider's own DynamoDB client now uses the same region as registration. `spored run-queue` had the same latent defect in its S3 results uploader; it now falls back to the IMDS region via config.WithEC2IMDSRegion.
The fake IMDS server writes its identity document through a JSON encoder instead of concatenating it into a raw ResponseWriter write, and the MPI harness runs rank 0's block from a script file rather than bash -c.
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.
Root cause
registry.NewPeerRegistry(pkg/registry/dynamodb.go) built its DynamoDB client with a bareconfig.LoadDefaultConfig(ctx). On an instance nothing ambient names a region: there's noAWS_REGION, no shared config, and the Go SDK only reads the region from IMDS if you passWithEC2IMDSRegion. So endpoint resolution failed before any request was sent, and every Register, Heartbeat and Deregister failed withMissing Region. Every other spored client already pinsidentity.Region, which comes from the IMDS identity document (agent.go, fsx_mount.go, pool_worker.go).Not MPI-specific. spored initialises the registry for any instance carrying
spawn:job-array-id.buildJobArrayMemberConfigsets that tag on every--countjob-array member, MPI or not.--mpiis just where it was noticed.Which region
It's the instance's own region, not a fixed control-plane region.
spawn-hybrid-registryis not one of the 21 tables in the infra account (docs/infra-account.md), and spored's credentials come from the instance role in the launching account. The table is created byspawn burst(registry.EnsureTable) in the CLI's account and region, andburstlaunches its instances into that same region from the same config.Fix
NewPeerRegistrynow pinsidentity.AWSRegion()and falls back to the ambient chain when that is empty.Identity.AWSRegion()treats the local provider's"local"placeholder (the default fromLoadLocalConfig) as unset, so a client is never pointed atdynamodb.local.amazonaws.com.DiscoverPeers, now uses the same region as registration. Before this, the two could hit different regions' tables.spored run-queue(spawn launch --batch-queue) had the same bug in its S3 results uploader. It now usesconfig.WithEC2IMDSRegion(), which only kicks in when nothing else sets a region.Tests
pkg/registry/region_test.go: with every ambient region source stripped (the instance's situation), the registry client's region is the instance's. The instance region also beats an ambient one, and""/"local"fall back to ambient.pkg/provider/region_test.go:Identity.AWSRegionis tested on the struct directly (rule 2). The local provider's DynamoDB client gets the configured region.pkg/agent/queue_runner_region_test.go: a fake IMDSv2 server shows the queue runner taking its region from IMDS, and an explicitAWS_REGIONstill wins.Each test was watched failing against a revert that compiles (
false && region != "", a neutralised"local"check, a droppedWithEC2IMDSRegion), withgo vetclean on the reverted tree.make check: everything passes exceptTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker, which needs a running Docker daemon that wasn't available locally. That's an environment problem unrelated to this change. All 9 nested modules pass.Known follow-up (not in this PR)
With a region set, an ordinary
spawn launch --countmember will now reach DynamoDB and fail differently.spored-instance-rolegrants no DynamoDB actions, and the table only exists in an account wherespawn bursthas run. So the warning should change fromMissing Regionto an AccessDenied or ResourceNotFound error rather than disappear. Nothing reads the registry for non-hybrid arrays: EC2 peer discovery uses tags, and MPI peers come from the cohort Assembler. Limiting registration to hybrid members (local provider, orspawn:burst=true) would be a separate behaviour change.Also still on the ambient-only chain, but not reached by any launch path in this repo:
pkg/pipeline(NewStageDataHandler,GeneratePeerDiscoveryFile,downloadPipelineDefinitionFromS3) underspored run-pipeline-stage.Fixes #899