Skip to content

fix: sweep launch path silently drops CLI IAM flags (#539) - #541

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/539-sweep-iam-flags-ignored
Aug 19, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/539-sweep-iam-flags-ignored

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

  • spawn launch --param-file ... (the sweep path) accepted --iam-role, --iam-policy, --iam-policy-file, --iam-role-tags, and --iam-allow-full-access but never read them — every sweep instance silently got the shared spored-instance-role instead, with no warning and exit 0. Same bug class as Sweep dispatch silently drops --cost-limit and --ttl, then logs "Using safeguards: ttl=..." #525 (CLI spend controls dropped on the sweep path), but worse: a wrong/missing IAM role means the workload dies on its first AWS API call with AccessDenied, which reads as a workload bug rather than a launch-flag bug, so the entire run's compute spend can produce zero result.
  • Fixed via option (a) from the issue: resolves the CLI IAM flags into a real instance profile once per sweep (reusing the exact CreateOrGetInstanceProfile logic launch_single.go's ensureIAMProfile uses per instance — same validation, same audit logging) and folds the result into the sweep's defaults["iam_role"], mirroring the Sweep dispatch silently drops --cost-limit and --ttl, then logs "Using safeguards: ttl=..." #525 fix for spend controls. This reaches both the foreground and detached (Lambda orchestrator) paths through the existing iam_role: param-file key, with the established precedence: a row's own iam_role: > the CLI flag > the file's defaults:. A sweep with no CLI IAM flags and no file-level iam_role: still falls back to the shared spored-instance-role, unchanged from before this fix.
  • Went with (a) rather than (b) (rejecting the flags outright): the reuse of the existing per-instance IAM logic turned out to be a small, clean addition (~90 lines, one new function applyCLIIAMToSweep), so the more useful fix was tractable.

Test plan

--iam-role/--iam-policy/--iam-policy-file/--iam-role-tags/
--iam-allow-full-access parsed successfully on `spawn launch --param-file`
but were never read by the sweep path, so every sweep instance silently got
the shared spored-instance-role. A wrong/missing IAM role means the
workload dies on its first AWS API call with AccessDenied, which reads as a
workload bug rather than a launch-flag bug.

Resolves the flags into a real instance profile once per sweep (reusing the
same CreateOrGetInstanceProfile logic launch_single.go's ensureIAMProfile
uses per instance) and folds the result into sweep defaults, mirroring the
#525 fix for CLI spend controls: this reaches both the foreground and
detached (Lambda) orchestration paths, with a row's own iam_role: still
outranking the CLI flag, which still outranks the file's defaults:.

Adds Tier 0 e2e coverage (test/e2e/tier0_sweep_iam_test.go) asserting the
resulting instance profile against a Substrate-launched sweep, including the
row-overrides-CLI precedence case and the no-flags fallback regression
guard. Verified fail-without/pass-with via git stash.
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 17.94872% with 32 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/launch_sweep.go 17.94% 32 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 2df23a4 into main Aug 19, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/539-sweep-iam-flags-ignored branch August 19, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant