feat(governor): page PagerDuty on kill-switch trips - #8052
Conversation
Wire the miner AMS kill-switch trip path into the existing PagerDuty alerting pattern instead of a new mechanism. packages/loopover-engine's kill-switch.ts gains a pure buildMinerKillSwitchPagerDutyAlert builder (mirrors buildMinerKillSwitchTransitionGovernorLedgerEvent's own no-op-unless-changed gate, but only on a TRIP, never a resume). packages/loopover-miner's governor-kill-switch.ts gains the IO wrapper notifyMinerKillSwitchPagerDuty, mirroring src/services/notify-pagerduty.ts's Events API v2 contract (LOOPOVER_ENABLE_PAGERDUTY flag, PAGERDUTY_ROUTING_KEY, dedup_key) with the same no-D1/Worker-Env simplification control-plane's own mirror (JSONbored#7667) used. recordMinerKillSwitchTransition now pages fire-and-forget after the ledger row lands, wrapped so a paging failure can never block or mask the ledger write. Closes JSONbored#7666
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-22 16:12:12 UTC
Review summary Nits — 7 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionPartially addressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. Scroll preview
A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|


Summary
recordMinerKillSwitchTransition(packages/loopover-miner/lib/governor-kill-switch.ts) now also fires a PagerDuty page — fire-and-forget, after the governor-ledger row lands, so a paging failure can never block or mask the ledger write.packages/loopover-engine/src/governor/kill-switch.tsgains a new pure builder,buildMinerKillSwitchPagerDutyAlert, mirroring the existingbuildMinerKillSwitchTransitionGovernorLedgerEvent's "no-op unless the scope actually changed" gate, but narrower: it also returnsnullon a transition into"none"(a resume) — only a trip pages.notifyMinerKillSwitchPagerDuty) mirrorssrc/services/notify-pagerduty.ts's Events API v2 contract exactly (LOOPOVER_ENABLE_PAGERDUTYflag,PAGERDUTY_ROUTING_KEY,dedup_key, enqueue URL/payload shape), with the same no-D1/Worker-Env simplificationcontrol-plane/src/pagerduty-notify.ts(Wire real PagerDuty alerting into control-plane provisioning failures #7667) already used for the same reason: the miner is a plain Node process with no Cloudflare Worker Env/D1 binding, so there's no per-repo routing-key map or severity-threshold/cooldown DB query here — PagerDuty's owndedup_keystill coalesces duplicate incidents. This is the same pattern the issue asked for reused, not a second alerting mechanism, and not a live call into the hosted module (which can't be imported from a plain Node package).Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run docs:drift-checknpm --workspace @loopover/engine run build(typecheck) +npm --workspace @loopover/engine run test(598/598 passing)npm run build:miner(typecheck for@loopover/miner, includescheck-syntax)npx tsc --noEmit -p tsconfig.json(root typecheck)npm --workspace @loopover/ui run typechecknpx vitest run test/unit/governor-kill-switch-pagerduty.test.ts test/unit/miner-governor-kill-switch.test.ts test/unit/kill-switch-incident-runbook.test.ts --coverage— both changed files (packages/loopover-engine/src/governor/kill-switch.ts,packages/loopover-miner/lib/governor-kill-switch.ts) at 100% lines/branches/functions/statementsnpx vitest run test/unit/miner-attempt-cli.test.ts test/unit/miner-loop-cli.test.ts(existing call sites into the kill-switch module, unaffected — 126/126 passing)If any required check was skipped, explain why:
npm run test:coverage(unsharded) timed out in this sandbox rather than passing or failing — a known sandbox resource constraint, not a signal about this change. Coverage for both changed files was verified directly (100% lines/branches/functions/statements) via a scopedvitest --coveragerun against the exact tests that exercise them, per this session's documented workaround for scoped verification.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.UI Evidence
This is a backend-only fix with no rendered UI delta — before and after are the same production capture at each required viewport.
apps/loopover-uiis dark-mode-only, so only the Dark row per viewport applies.Notes
src/services/notify-pagerduty.ts(the required pattern) andcontrol-plane/src/pagerduty-notify.ts(Wire real PagerDuty alerting into control-plane provisioning failures #7667, the same no-D1 mirror shape for a plain Node package).packages/loopover-mcpcompiled-artifact drift check (check-build-drift), unrelated to their PagerDuty logic itself. This PR doesn't touchpackages/loopover-mcp, andnpm run actionlint/the scoped build/typecheck runs above came back clean.