feat(web,database): archiving a plan pauses its automations; a departed owner's webhook answers as none

Draft
DA
4d ago
+176-5

Draft. Frozen pending Dean's automations scope decisions (docs/proposals/automations-scope.md); do not merge. Stacked on #2516.

Dean confirmed that automations belong to a plan, so archiving the plan stops them. This also closes the departed-owner webhook gap from #2516's review.

  • Archive pauses. A PATCH that archives a plan pauses every automation of it that was on, with the new reason plan-archived (additive to AUTOMATION_PAUSE; v0.12.0 has no automations UI). Bringing the plan back resumes none of them; the owner turns each back on. An automation already off is left as it was.
  • A backstop if that pause is lost. The sweep's claim and a GitHub delivery's candidate query now require a plan that is not archived, as well as an owner who still reaches it (OWNER_REACHES_LIVE_PLAN).
  • Webhook reach. readWebhookAutomation requires that the owner still reaches the plan, so a call to a departed owner's webhook answers as no automation (404) and records nothing.
  • README's Automations section says all of the above.

Tests (each fails without the change):

  • plans-app.test.ts: archive, then unarchive, over HTTP. The automation is paused as plan-archived and stays paused.
  • automation-store.test.ts: an archived plan's due schedule is never claimed even with no pause written; the pause leaves an automation that was already off untouched; a leaver's webhook reads as none.

No Mac UI in this PR. pnpm check:affected exits 0.

šŸ¤– Generated with Claude Code


Open workspace in Conductor


Summary by cubic

Archiving a plan now pauses every automation of it that was on, with the new pause reason plan-archived; unarchiving the plan resumes none of them. The sweep and GitHub delivery also skip archived plans even if that pause was lost, and a webhook whose owner left the plan's workspace answers as no automation (404).

Details

  • Only automations that are on get paused; ones already off are left as their owner left them.
  • Tests cover the archive/unarchive flow over HTTP (the pause outlives the unarchive) and the store-level cases: no claim for an archived plan, the existing-off pause, and a leaver's webhook.