Skip to content

Orphan / zombie reaper (#23) - #31

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/orphan-reaper
Jul 21, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/orphan-reaper

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

A lifecycle safety-net for the exact failure mode #19 exposed: if spored dies or never installs, an instance runs past its TTL and bills indefinitely — nothing catches it. Closes #23.

  • src/core/orphans.ts — findOrphans(instances, now, grace?): managed + live (running/pending) + past its effective TTL deadline by a 10-min grace (spored's poll + shutdown lag is normal; a truly stuck box isn't). Reuses the now-exported ttlDeadline from lifecycle.ts. Instances with no TTL are never orphans.
  • SpawnClient.findOrphans() / reapOrphans() — detection over the last-known list; reap terminates (caller confirms first).
  • CLI orphans [--reap] [-y] — lists overdue instances; --reap terminates (with confirm unless -y).
  • Dashboard — a red warning banner above the instance list with a one-click, confirmed Reap N button.

Pure detection is provider-agnostic and 100% covered; client/CLI/dashboard tests stage a past-TTL instance via a shared-provider future-clock client (models spored having failed). 212 tests, build green.

A lifecycle safety-net for the #19 failure mode: an instance whose spored died
or never installed runs past its TTL and bills forever. findOrphans (core/
orphans.ts) flags managed, live instances past their TTL deadline + a 10-min
grace (reusing the now-exported ttlDeadline from lifecycle.ts).

- SpawnClient.findOrphans() / reapOrphans() — detection + confirmed terminate.
- CLI `orphans [--reap] [-y]` (list, then optionally terminate).
- Dashboard warning banner with a one-click reap (confirmed).
- Pure detection is provider-agnostic + 100% covered; client/CLI/dashboard tests
  use a shared-provider future-clock trick to stage a past-TTL instance. 212 tests.
@scttfrdmn
scttfrdmn merged commit 1c714c7 into main Jul 21, 2026
1 check passed
@scttfrdmn
scttfrdmn deleted the feat/orphan-reaper branch July 21, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Orphan / zombie reaper (spawn orphans + cleanup)

1 participant