From f20bf9280c7a6004241cab4ba8fa909ff60f6afb Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Sun, 19 Jul 2026 16:25:19 -0700 Subject: [PATCH] fix(selfhost): widen orb-relay-drain checkin margin to match redeploy cadence LOOPOVER-12 fired 1600+ missed-checkin outages over 2+ weeks. Ruled out the reentrancy-guard overlap-skip (0 occurrences in 14 days of live instrumentation) and in-process timeouts (~13 events, too few to explain the volume). The container's own StartedAt resets on every redeploy unlike its stable sidecars, and boot (image pull + Postgres-readiness wait + init) routinely exceeds the old 2-minute margin on a fleet redeploying multiple times a day. Raise checkinMargin from 2 to 6 minutes so a normal redeploy doesn't trip a false outage, while a genuinely stuck instance still alerts within ~21 minutes. --- src/selfhost/sentry.ts | 16 +++++++++++++++- test/unit/selfhost-sentry.test.ts | 24 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/selfhost/sentry.ts b/src/selfhost/sentry.ts index 7e427403f5..b4e96cd64d 100644 --- a/src/selfhost/sentry.ts +++ b/src/selfhost/sentry.ts @@ -109,7 +109,21 @@ const SENTRY_MONITORS: Record { expect(mocks.captureException).not.toHaveBeenCalled(); }); + it("gives orb-relay-drain a 6-minute checkin margin so a normal redeploy cycle doesn't false-positive as a missed check-in (LOOPOVER-12 regression)", async () => { + await initSentry({ + SENTRY_DSN: "d", + SENTRY_ENVIRONMENT: "prod", + } as unknown as NodeJS.ProcessEnv); + + await expect( + withSentryMonitor("orb-relay-drain", { jobType: "orb-relay-drain" }, async () => "ok"), + ).resolves.toBe("ok"); + + expect(mocks.captureCheckIn).toHaveBeenNthCalledWith( + 1, + { monitorSlug: "loopover-selfhost-prod-orb-relay-drain", status: "in_progress" }, + expect.objectContaining({ + schedule: { type: "interval", value: 1, unit: "minute" }, + checkinMargin: 6, + maxRuntime: 1, + failureIssueThreshold: 3, + recoveryThreshold: 1, + }), + ); + expect(mocks.captureException).not.toHaveBeenCalled(); + }); + it("records failed Sentry cron monitor check-ins with sanitized context", async () => { await initSentry({ SENTRY_DSN: "d",