Skip to content

pre-stop: surface a loud signal when the hook transfers nothing / exits non-zero #186

Closed

Description

@scttfrdmn

Follow-up to #184 / #63.

Problem

--pre-stop can "succeed" while doing nothing useful, with no signal to the user — the failure mode that cost a real 48h GPU run its output (#184): aws s3 sync ~/output … ran against the wrong (empty) dir, exited 0, and spored logged Pre-stop hook completed successfully. The instance then terminated and the ephemeral data was gone. The user only discovered it after the fact.

#63 fixes the specific root-cause (ran as root → wrong $HOME), but the broader gap remains: pre-stop gives no feedback about whether it actually flushed anything, so the next misconfiguration (wrong path, expired creds, bucket typo, timeout truncation) is equally silent.

Suggested

Make pre-stop outcomes observable instead of silently "successful":

  • Non-zero exit is currently logged at the same level as success and then ignored — surface it as a distinct pre_stop_failed notification (Slack/Teams/Discord/SMS), not just a log line.
  • Timeout (DeadlineExceeded, the multi-GB-sync case from --pre-stop does not reliably flush before TTL-triggered terminate → data loss on ephemeral storage #184 Q3) → a distinct pre_stop_timeout notification so a truncated sync isn't mistaken for a complete one.
  • Consider a lightweight "transferred nothing" heuristic: if the hook is the common aws s3 sync/cp shape, surface its summary (objects/bytes) in the completion notification, or at minimum emit the hook's stdout/stderr tail to the notifier so "synced 0 objects" is visible. (Best-effort; don't over-fit to one tool.)
  • Notifications already exist for pre_stop_start (pkg/agent/agent.go runPreStop → notifier.Notify(…, "pre_stop_start", …) and pkg/sms/sms.go), so this is mostly adding the terminal-state events + wiring the formatters.

Why it matters

pre-stop is the last chance to save data off ephemeral storage before terminate. A silent partial/no-op there is unrecoverable. The hook completing should not look identical whether it saved 200 GB or 0 bytes.

Relates to #63 (root-cause fix) and #184 (the data-loss report).

Activity

  1. added
    enhancement
    area:spored
    area:storage
    on Jun 16, 2026
  2. scttfrdmn commented on Jun 16, 2026

    @scttfrdmn
    ContributorAuthor

    Done — spawn#189 (spored emits pre_stop_failed/pre_stop_timeout with the hook's output tail) + #382 (Slack/Teams/Discord/SMS formatting) both merged. A failed/timed-out pre-stop is now a loud orange/red notification, not a silent success.

  3. added a commit that references this issue on Jun 16, 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:sporedarea:storageenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions