Skip to content

Lifecycle Events โ€‹

Spored emits lifecycle events when significant things happen to a running instance. Events are routed through the spore-bot Lambda to Slack DMs or Teams messages.

Event types โ€‹

EventWhen it firesDefault message
ttl_warning5 minutes before TTL expiresโฑ๏ธ name terminates in 5 minutes
ttl_expiredAt TTL expiry๐Ÿ”ด name has terminated โ€” scheduled end time reached
idle_warning5 minutes before idle timeout๐Ÿ’ค name will stop in 5 minutes โ€” no activity detected
idle_stoppedAt idle timeout (default)โน๏ธ name has stopped โ€” idle timeout reached
idle_hibernatedAt idle timeout with --hibernate-on-idle๐Ÿ’ค name has hibernated โ€” idle timeout reached
completionWhen spawn:completion-file is detectedโœ… name has completed
spot_interruptOn Spot interruption noticeโš ๏ธ name received a Spot interruption notice
pre_stop_startWhen pre-stop hook begins๐Ÿ”„ name is running its shutdown task before terminating

Receiving events โ€‹

Events reach you as Slack DMs or Teams messages. To enable:

  1. Set --slack-workspace when launching (or spawn defaults set slack-workspace <ID>)
  2. Run /spore notify <nickname> in Slack to subscribe your user

Without a subscription, events are posted to the channel webhook (if configured) but not sent as DMs.

Warning thresholds โ€‹

The 5-minute warning is fixed. If you need to respond (extend TTL, save work), you have that window. The warning fires once โ€” subsequent checks within the same warning window don't re-trigger it.

Completion events โ€‹

The completion event fires when spored detects the file at spawn:completion-file (default: /tmp/SPAWN_COMPLETE). After the delay specified by spawn:completion-delay (default: 30s), it executes the action in spawn:on-complete.

Typical pattern:

sh
# At the end of your script
touch /tmp/SPAWN_COMPLETE

Spored sees the file, sends the completion notification, waits 30 seconds, then terminates the instance.