Skip to content

Schedule params expire after 7 days (bucket lifecycle), so recurring schedules fail after their first week #1382

Closed

Description

@scttfrdmn

pkg/staging gives every schedules bucket a lifecycle rule that expires the schedule params after 7 days, so a recurring schedule cannot fire successfully after its first week.

Evidence (code, main at 5549f3f):

  • pkg/staging/staging.go ensureBucket (used by resolveSchedulesBucket, i.e. by UploadScheduleParams), on creating spawn-schedules-<region> / spawn-schedules-<account>-<region>, puts lifecycle rule expire-schedules: Prefix: "schedules/", Expiration.Days: 7. The comment above it reads "7-day lifecycle rule — queue configs are ephemeral". It looks copied from the queue-config path.
  • UploadScheduleParams writes the params to schedules/<schedule id>/params.yaml in that bucket. That's the prefix the rule expires.
  • lambda/scheduler-handler downloadParams reads that object on every firing (handler step 4). Once it has expired, every firing goes to recordError(... "load params: get object: NoSuchKey").
  • spawn schedule create --cron accepts any cadence, and nothing re-uploads the params.

So a daily schedule gets about 7 firings, and a weekly or monthly one gets at most one. Not reproduced live (no AWS calls). The claim is from the code path above.

Interaction with #1378: the per-task role sweep now fails closed when an active schedule's params object is missing. It deletes no role that run, logs the schedule ID, and counts instance_roles_references_unreadable. Until this is fixed, any active recurring schedule older than 7 days stops the reaper (and spawn cleanup --instance-roles) from deleting any role, until someone cancels the schedule.

Related, same lifetime class: scheduler.Client.SaveSchedule sets the record's DynamoDB ttl to now+90 days. A recurring schedule's record is auto-deleted after 90 days while its EventBridge schedule keeps firing ("schedule not found" each time). That EventBridge schedule is left with nothing that deletes it.

Suggested fix: don't expire schedules/ params while their schedule exists. Delete the params object in spawn schedule cancel / DeleteSchedule instead (it is the named deleter). Either refresh the record TTL on each firing or drop it, and have cancel/delete remove the EventBridge schedule. Existing buckets keep the rule until it is removed, so the fix needs a migration step (PutBucketLifecycleConfiguration without the rule).

Activity

  1. added
    area:lifecycle
    on Oct 28, 2026
  2. scttfrdmn commented on Oct 28, 2026

    @scttfrdmn
    ContributorAuthor

    Live check (2026-10-28, infra account, read-only):

    • The three production buckets spawn-schedules-{us-east-1,us-west-2,eu-west-1} carry a different rule from the one in the code: DeleteOldScheduleParams, no prefix (whole bucket), Expiration 90 days. They predate pkg/staging's expire-schedules (7 days, schedules/). So in production a recurring schedule loses its params after 90 days. A bucket newly created by pkg/staging would lose them after 7. Both are the same bug, and the fix must remove both rules (the migration step).
    • The spawn-schedules table holds 0 items, so no live schedule is affected today.
  3. added this to the v0.148.0 milestone 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:spawnlifecycletype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions