Skip to content

Role sweep can never delete in an account without the schedules table (fail-closed since #1378) #1384

Closed as not planned

Description

@scttfrdmn

Since #1378, the per-task role sweep (REAPER_INSTANCE_ROLES, spawn cleanup --instance-roles) deletes nothing unless it can read the schedules: the spawn-schedules table in us-east-1, in the account the schedules live in. That is fail-closed by design. A schedule names a spawn-instance-* profile and launches with it later, so an unread schedule could lose its role. Two setups can never satisfy it, though:

  1. An account with no scheduler deployed. The table comes only from deployment/cloudformation/schedules-tables.yaml, and nothing creates it on demand. A scan-self reaper (spawn reaper deploy, or SAM ScanSelf=true) in such an account gets ResourceNotFoundException and never deletes a role. The same goes for the CLI with SPAWN_INFRA_PROFILE="" against that account, or when the infra profile (spore-host-infra) does not exist: LoadInfraAWSConfig fails and the CLI refuses.
  2. A scan-self reaper in a compute account whose schedules live in a different infra account. It reads its own account's table, not the infra account's. Today that fails closed (the table is missing). If someone deployed the scheduler tables there too, it would read the wrong store.

Treating "table not found" as "no schedules" was considered and rejected in #1378. It's sound for the CLI, which reads exactly where spawn schedule create writes. It isn't sound for case 2, where it would delete a role a schedule in another account names.

Options: an explicit declaration that the account has no scheduler (a reaper parameter or setting that skips the schedules source, logged on every run); or let the reaper read the infra account's schedules through a role, which needs a cross-account trust (read the account-boundary constraints first).

Until then, the roles are kept, so the cost is one IAM role each against the 1,000-role quota. Nothing breaks.

Activity

  1. added
    enhancement
    area:lifecycle
    on Oct 28, 2026
  2. added this to the v0.148.0 milestone on Oct 28, 2026
  3. scttfrdmn commented on Oct 28, 2026

    @scttfrdmn
    ContributorAuthor

    Decision (owner, 2026-10-28): keep fail-closed. A missing schedules table blocks role deletion.

    Reasons:

    • Production is unaffected: the production reaper runs in the infra account, where spawn-schedules exists.
    • The relaxed version fails silently: treating 'no table' as 'no schedules' would let a reaper that scans its own account, but whose schedules live in another account, delete a role a live schedule still needs. The schedule's next firing would then fail weeks later, with nothing tying it back to the reaper.
    • The cost is small: idle roles are kept in accounts with no scheduler, and they show in the report with the reason.

    If it's ever needed, relax it with an explicit opt-in (e.g. REAPER_NO_SCHEDULER=true / spawn cleanup --no-scheduler), never by inferring it from a missing table. Closing as decided; reopen with that opt-in if a real account needs it.

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:spawnenhancementtype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions