Skip to content

fix(sweep): resume keeps the sweep's --ttl/--idle-timeout/--cost-limit and lifetime flags (#1394) - #1403

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/1394-resume-keeps-lifetime
Oct 28, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/1394-resume-keeps-lifetime

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1394

A resume rebuilt each pending sweep member from the param file and an empty base config, so the sweep's --ttl, --idle-timeout and --cost-limit (and --on-idle, --no-timeout, the completion/session settings) were dropped, and the 1h idle default was never applied. A resumed member could run with no lifetime bound.

Recorded. New checkpoints carry lifetime (SweepLifetime): ttl, idle_timeout, cost_limit, hibernate_on_idle, no_timeout, on_complete, completion_file, completion_delay, session_timeout, idle_cpu_percent. These come from the sweep's base config (newSweepLifetime(baseConfig, noTimeout)). A resume uses them as the base config and folds ttl/idle/cost into the defaults, the same way the launch does (foldSpendControls, now shared with applyCLISpendControlsToSweep). A row's own value still wins. A detached sweep needs no new record: the orchestrator relaunches from the params uploaded at launch, and each member's rendered tags and user data there already carry the bounds.

Old checkpoints (no lifetime) get the launch defaults: the row's own bound, else the 1h idle default (applyIdleDefault). Fresh launches have no default TTL. A notice explains how to pass --ttl.

New flags on spawn sweep resume / spawn resume: --ttl, --idle-timeout, --cost-limit. They replace the recorded values but may only tighten them. If a resume would lengthen a TTL or idle timeout, raise a cost limit, or drop any of them (including the 1h idle default a recorded sweep relied on), it is refused before launch. A member left with no bound at all (a --no-timeout sweep whose row sets none) is refused in lifetime.members (before AMI, key or IAM work), and again by a backstop in relaunchPending. The refusal message says to pass --ttl. With --detach the three flags are refused rather than silently ignored.

Gates (cmd/resume_lifetime_test.go). Each one was watched failing against a revert that compiles:

  • carries the original --ttl 4h --idle-timeout 30m --cost-limit 5 --on-idle hibernate on launch config and tags, row ttl still wins. Reverts tried: no Lifetime in the checkpoint, and the plan ignoring the record.
  • old checkpoint gets the launch defaults. Revert tried: no idle default.
  • unbounded member refused with zero launches. Reverts tried: the bound check always passes, and the backstop removed.
  • explicit flags override, and loosening is refused. Reverts tried: overrides ignored, and the weaker-bound check disabled.
  • detached: orchestrator params carry the limits, and --detach refuses the flags. Reverts tried: fold drops ttl, and the refusal disabled.
  • AST wiring: launch records the lifetime, runResume plans it before the nested-role check, members are built before AMI, --detach refusal comes before resumeSweepDetached, and runResume never calls buildLaunchConfigFromParams directly.

Two fixtures from #1385's tests (resume_iam_test.go, resume_indices_test.go) now have a TTL, because relaunchPending refuses unbounded configs.

make check, make lint (0 issues), semgrep --error, gen-docs/check-docs all clean. No exported pkg symbols changed. No AWS calls, and no new IAM permissions.

Follow-up: #1400 (resume still drops all other CLI flags: --pre-stop, --tag/--team, network, storage).

@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.68116% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/resume.go 52.94% 8 Missing ⚠️
cmd/sweep_lifetime_record.go 93.04% 8 Missing ⚠️
cmd/launch_sweep.go 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…t and lifetime flags (#1394)

New checkpoints record the CLI lifetime settings; resume re-applies them,
applies the launch defaults to old checkpoints, refuses a member with no
bound or a weaker one than the original, and gains --ttl/--idle-timeout/
--cost-limit overrides (refused with --detach).
@scttfrdmn
scttfrdmn force-pushed the fix/1394-resume-keeps-lifetime branch from ee8ee22 to c67a5b9 Compare October 28, 2026 22:13
@scttfrdmn
scttfrdmn merged commit 601b530 into main Oct 28, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1394-resume-keeps-lifetime branch October 28, 2026 22:36
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.

sweep resume drops the sweep's CLI --ttl/--idle-timeout/--cost-limit and skips the 1h idle default; a resumed member can run with no lifetime bound

1 participant