Skip to content

fix: app launch 8h default TTL; service and pool workers terminate on idle; truthful idle wording - #1200

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/1150-1151-app-service-lifecycle
Oct 19, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/1150-1151-app-service-lifecycle

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1150
Fixes #1151
Fixes #1132
Refs #1146

What changed

App launch default TTL (#1150). spawn app launch --ttl now defaults to 8h (the owner's decision), so the default shows up in --help, and it flows into the launch config as before (TTL: appLaunchTTL). An explicitly empty --ttl "" is refused before any AWS client exists. The TTL is printed at launch (TTL: 8h (default; ...)) and in both ready summaries. Idle still stops, so a session can be restarted. app launch has no --no-timeout, and this PR does not add one: a session that needs longer passes a longer --ttl or runs spawn extend.

Service idle → terminate (#1151). New aws.LaunchConfig.TerminateOnIdle, written as spawn:terminate-on-idle=true. spored reads it (provider.Config.TerminateOnIdle), and idleTimeoutReached then terminates instead of stopping. It wins over hibernate. spawn service sets it. A Spot launch whose idle action is terminate stays a one-time request, since it no longer needs a stoppable one. spawn status and spored status say "terminates". The service dry-run Lifetime: line names the idle action.

Pool workers idle → terminate (refs #1146). Same mechanism, set in a new pure poolWorkerBaseConfig. This makes "Workers self-terminate on idle-timeout" true. It does not address #1146 item 2 (workers spinning after pool drain deletes the queue), so #1146 stays open.

Wording (#1151, #1132). The zombie-guard notice and the sweep's equivalent used to say "terminate" on every path. They now name the real action: stop, hibernate, or terminate. Corrected: launch --idle-timeout, --active-ports and --active-processes, burst --idle-timeout (burst still stops), app, defaults ("Hibernate instead of stopping on idle"), and the notify workspace add example plus two error messages that named workspace-add.

No new notification event: an idle terminate sends none. spore-bot has no idle_terminated message, and adding one is cross-repo. Users logged in to the instance still get spored's terminate warning.

Gates (each watched failing against a revert that compiles, with go vet clean)

  • TestIdleTerminateClaimsAreTrue walks the whole cobra tree (Short/Long/Example/flag usages) with i18n initialised and updateCommandDescriptions applied explicitly, so the result doesn't depend on test order. Any clause that mentions idleness and termination is a claim. The command making it must be in idleTerminateProofs, whose entry calls the command's real config builder, and that builder must set TerminateOnIdle. Fails on: service TerminateOnIdle: false, pool false, the old defaults text, the old burst text, the old launch --idle-timeout text. Strings that updateCommandDescriptions takes from spore-host/libs are discovered from its source and excluded. They're logged, not judged, because they live in another repo (see the follow-up issue).
  • TestIdleTerminateClaimMatcher pins the matcher against the shipped shapes, and checks it doesn't fire on the TTL-plus-idle-default sentences.
  • TestIdleDefaultNoticeNamesTheRealAction runs through guardZombieInstance. Fails on a hardcoded "terminate" notice and on service TerminateOnIdle: false.
  • TestAppLaunchAlwaysHasATTL checks the flag default and runs runAppLaunch with --ttl ""/" ". Fails on a "" default, and on removing the refusal (with the AWS env pointed at 127.0.0.1:1, so a regression can't reach a real account).
  • TestIdleActionHonoursTerminateOnIdle (pkg/agent), TestBuildTags_TerminateOnIdle and TestSpotRequestType_TerminateOnIdleIsOneTime (pkg/aws), TestConfigFromTags_TerminateOnIdle (pkg/provider), plus new TestIdleActionDescription cases. Each fails on its revert.

Checks

  • make check: steps 1-6 pass. Step 7, check-build-tags, fails identically on unmodified main on this machine (/private/tmp paths).
  • make check-docs: clean after make gen-docs.
  • make api-snapshot: one addition, field LaunchConfig.TerminateOnIdle bool.
  • semgrep scan --config=auto --error .: 0 findings.

Not verified on AWS. spored only picks up the new tag once it ships in a release (spored is release-only). Until then an older spored ignores the tag and stops as before.

@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.67568% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/spored/main.go 0.00% 3 Missing and 2 partials ⚠️
cmd/app.go 42.85% 4 Missing ⚠️
cmd/launch_sweep.go 0.00% 4 Missing ⚠️
cmd/bot.go 0.00% 2 Missing ⚠️
pkg/agent/agent.go 71.42% 1 Missing and 1 partial ⚠️
cmd/pool.go 94.11% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

scttfrdmn added a commit that referenced this pull request Oct 19, 2026
…-cost-limit

Pool workers now write the completion record on a clean drain (and a failed
one when they exhaust restarts), so on_complete=terminate fires. Worker.Run
drains at once when its queue is deleted and honours its idle deadline on the
claim-error path. Builds on #1200's TerminateOnIdle for spored's own idle
action. pool drain reports 'already drained' and exits 0 on a missing queue.
pool create gains a per-worker --cost-limit.

Fixes #1146
Fixes #1183
…le; truthful idle wording

spawn app launch sets an 8h TTL when --ttl is not given and refuses an
empty one (#1150). spawn service and pool workers set the new
LaunchConfig.TerminateOnIdle (spawn:terminate-on-idle), so spored
terminates them when idle instead of stopping them (#1151, refs #1146).
Help and notices that said idle terminates on stop paths are corrected,
and a gate walks the command tree for idle-terminate claims (#1132).
@scttfrdmn
scttfrdmn force-pushed the fix/1150-1151-app-service-lifecycle branch from 322f58a to b793afc Compare October 19, 2026 23:25
@scttfrdmn
scttfrdmn merged commit cfef98d into main Oct 19, 2026
8 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1150-1151-app-service-lifecycle branch October 19, 2026 23:45
scttfrdmn added a commit that referenced this pull request Oct 20, 2026
…-cost-limit

Pool workers now write the completion record on a clean drain (and a failed
one when they exhaust restarts), so on_complete=terminate fires. Worker.Run
drains at once when its queue is deleted and honours its idle deadline on the
claim-error path. Builds on #1200's TerminateOnIdle for spored's own idle
action. pool drain reports 'already drained' and exits 0 on a missing queue.
pool create gains a per-worker --cost-limit.

Fixes #1146
Fixes #1183
scttfrdmn added a commit that referenced this pull request Oct 20, 2026
…imit (#1146, #1183) (#1192)

* fix: app launch default TTL; service and pool workers terminate on idle; truthful idle wording

spawn app launch sets an 8h TTL when --ttl is not given and refuses an
empty one (#1150). spawn service and pool workers set the new
LaunchConfig.TerminateOnIdle (spawn:terminate-on-idle), so spored
terminates them when idle instead of stopping them (#1151, refs #1146).
Help and notices that said idle terminates on stop paths are corrected,
and a gate walks the command tree for idle-terminate claims (#1132).

* fix(pool): workers terminate when drained; drain is idempotent; add --cost-limit

Pool workers now write the completion record on a clean drain (and a failed
one when they exhaust restarts), so on_complete=terminate fires. Worker.Run
drains at once when its queue is deleted and honours its idle deadline on the
claim-error path. Builds on #1200's TerminateOnIdle for spored's own idle
action. pool drain reports 'already drained' and exits 0 on a missing queue.
pool create gains a per-worker --cost-limit.

Fixes #1146
Fixes #1183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant