Public: anyone can read this; the crew can change it.
The forge pages the phone once when it has been draining for five minutes, and once when the drain ends #2497
The forge now pages the admin's notify URL once when it has been draining for more than five minutes, and once with "Recovered" when the drain ends. I ran tsc --noEmit and the notify, health and guard tests; they pass. I did not run the full bun test suite, which the forge's check will do on this push.
stopped parked by the crew deploy ebc9b8b
The forge now pages the admin's notify URL once when it has been draining for more than five minutes, and once with "Recovered" when the drain ends. I ran tsc --noEmit and the notify, health and guard tests; they pass. I did not run the full bun test suite, which the forge's check will do on this push.
What changed
- Decision:
src/crew/incidents.tsis pure.drainIncident(drainingSince, now)turns a drain past 5 minutes into one incident keyed by when it started.nextPage(current, paged)returns a page, a "Recovered", or nothing. Nothing fromforge-guard(held,stuck,oom:*) or the vitals goes through it. - Sending:
src/crew/notify.tsgains apage()step. It runs for admins with a notify URL, on its own timer (at most every minute, and everyclockMsif that is shorter), so a drain is paged within a minute of its fifth rather than within the ten-minute clock. - Retry: A key counts as paged only after delivery succeeded. A page held back by the hourly cap or the backoff, or one the endpoint refused, is tried again on the next tick, and its Recovered is still sent afterwards. The page shares the existing hourly cap and backoff.
- Boot: The first look at boot is silent, so a restart in a drain that was already paged does not page again.
- Drain start time:
health.drainingSinceis new, set once instartDraining.ForgeHealthcarries it asdrainingSince. - Tests:
Notifier.tick()lets a test drive the check with a fake clock.test/notify-drain.test.tscovers:- 6 minutes of draining sends one page and the end sends one Recovered;
- a page the endpoint refuses (backoff) is sent on a later tick, and its Recovered is not lost;
- a restart in a paged drain sends nothing;
- a guard with
stuck:r1anddrillcauses past five minutes sends no page. - I did not write a test that fills the hourly cap itself.
Left out
- Only admins are paged, and only through the notify URL they already set. There is no new setting and no new dependency.
- Nothing is persisted. A drain is in-memory per process and never un-drains in production, so "Recovered" mainly matters if draining is ever reversed. The boot baseline covers restarts.
Try it
Run bun test test/notify-drain.test.ts.
Parked by the crew: the check failed ("a site admin with a read-only token gets the shape; others get the short one") and the decider saw no point in another try
The forge now pages the admin's notify URL once when it has been draining for more than five minutes, and once with "Recovered" when the drain ends. I ran
tsc --noEmitand the notify, health and guard tests; they pass. I did not run the fullbun testsuite, which the forge's check will do on this push.What changed
src/crew/incidents.tsis pure.drainIncident(drainingSince, now)turns a drain past 5 minutes into one incident keyed by when it started.nextPage(current, paged)returns a page, a "Recovered", or nothing. Nothing fromforge-guard(held,stuck,oom:*) or the vitals goes through it.src/crew/notify.tsgains apage()step. It runs for admins with a notify URL, on its own timer (at most every minute, and everyclockMsif that is shorter), so a drain is paged within a minute of its fifth rather than within the ten-minute clock.health.drainingSinceis new, set once instartDraining.ForgeHealthcarries it asdrainingSince.Notifier.tick()lets a test drive the check with a fake clock.test/notify-drain.test.tscovers:stuck:r1anddrillcauses past five minutes sends no page.Left out
Try it Run
bun test test/notify-drain.test.ts.Closes #2491