Skip to content

Reaper InstanceRoles would delete a spawn-instance-* role that an enabled schedule still names #1378

Closed

Description

@scttfrdmn

Found while deciding whether to arm REAPER_INSTANCE_ROLES after v0.147.0 (#1300/#1321). It is currently report, and the first report lists 13 roles.

pkg/instancerole deletes a spawn-instance-* role once no pending-to-stopped instance holds its profile and it has been unused for Grace (24 h, instancerole.go:110). It does not consult schedules. spawn schedule create accepts a spawn-instance-* profile: refuseUnpassableDetachedProfiles (cmd/schedule.go:589) lets that prefix through by design (#1331), through --iam-policy/--s3-* or a row's iam_role. A schedule that fires weekly or monthly leaves its role idle between firings, so an armed reaper would delete it, and the next firing would fail every member at RunInstances with an invalid profile.

Pool and batch-queue roles are unaffected, because their workers hold the profile while they run.

Fix: before deciding, collect every instance-profile or role name referenced by an enabled schedule's stored params (scheduler-handler's record + S3ParamsKey) and treat those as in use. Make it fail closed: if the schedules can't be read, delete nothing. Do the same in spawn cleanup. Gate it with a schedule-referenced idle role that is kept, and an unreadable schedules table that deletes nothing.

Until this ships, keep InstanceRoles=report. EmptyBuckets and PoolQueues don't depend on it.

Activity

  1. added this to the v0.148.0 milestone on Oct 28, 2026
  2. added
    area:lifecycle
    spend-safety
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lifecyclecomponent:spawnspend-safetytype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions