Skip to content

feat(on-call): a page to a person also reaches their phone - #3024

Merged
Makisuo merged 103 commits into
mainfrom
oncall/mobile-paging
Nov 24, 2026
Merged

Makisuo merged 103 commits into
mainfrom
oncall/mobile-paging

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Stacked on #3023. When an escalation step pages a person, their phone hears it too.

What changed

  • Push as a paging channel. A step that pages a person, directly or through an on-call schedule, queued an email and a chat direct message. It now also queues a push to that person's own phones, when they have one that can still be pushed. Each channel is its own row in the page log, so the timeline shows "Paged Ben Brook by phone" beside the email, or why the phone was not reached.
  • A page is not filtered by notification preferences. The switches in the app tune what the org's incidents tell someone. A page is addressed to them, so it goes out even with every switch off, at the time-sensitive level.
  • It reuses what the app already does. The push carries the same payload an incident push does, so tapping it opens the incident in the app as installed today. No app update is needed for this PR.
  • Dead tokens. A phone Apple reports as gone is switched off, as an incident push does. A page that no phone took settles as skipped with the reason, not as a failure that retries.
  • A failed read is not "no phone". When the member's devices cannot be read, the page counts as failed and is retried, and the failure is logged.
  • The API and MCP descriptions of a page's channel now list push.

Not in this PR

The rest of the mobile plan needs the iOS app built and run, which this change was not: acknowledging from the notification and from the incident screen, the timeline's "Notified" wording, and Critical Alerts (which also needs the entitlement from Apple). They are left for a session that can build the app, and should be lined up with the App Review preparation that is in progress.

Bundling a burst of pages from one rule (many groups breaching at once) into one page is also left out: it should cover email, chat and phone together.

No screenshots: nothing in the dashboard changes shape. The timeline gains a row it already knows how to draw, with the label "phone".

Verification

  • MobilePushService.test.ts (4 new, 35 in the file): a device read that fails is a failed page, not a member without a phone; a page reaches only the member's own enabled phones whatever their preferences, at the time-sensitive level, with the incident's public id; a phone Apple says is gone is switched off and the page reports that nothing landed; nothing is sent for a member without a phone or without APNs credentials.
  • AlertsService.oncall-paging.test.ts (PGlite, 2 new, 23 in the file): the on-call person with a phone is paged there as well as by email, someone whose token is dead is not queued a phone page, and a phone page nothing took settles as skipped with why.
  • Suites run on the final branch: backend alerts, SLOs and push (69 files, 871 tests), API routes (69 files, 760), packages/web-data alerts (170), MCP tools (882), packages/db (83). Typecheck for backend, domain, web-data, ai, api, web and the alerting worker.

Not verified here

  • A real push on a real phone. APNs is not configured locally or on previews, so delivery is covered by the service tests with a stand-in for Apple's endpoint.

🤖 Generated with Claude Code

- A reopen above the severity the earlier incident reached is no longer
  muted as a flap.
- Deleting a rule (or the SLO, monitor, budget or detection that owns it)
  leaves one queued resolve per destination its open incidents paged.
- A retried trigger or reminder is not sent once its incident resolved.
- A pager whose page landed after the acknowledgement is told about it.
- A reminder planned before an acknowledgement committed is not sent.
- A reopen is a flap only of an incident whose page got through.
- Every page landing after an acknowledgement is acknowledged, whatever
  was acknowledged before it.
- One staleness rule for single deliveries and chat digests; a page whose
  incident is gone is stale too. Linear still files a late ticket.
- The all-clear of a deleted rule says so and does not link a deleted page.
- The delete reads only rows that may have paged, capped, and inserts in
  chunks.
- A skipped reminder leaves the reminder clock where it was.
- A shift of someone who left the org passes to the next person in the
  rotation; their overrides are ignored. Schedules report who left.
- A step that reaches nobody is not counted, records the gap on the
  incident's timeline and moves straight to the next step of the pass.
  A pass that ends having reached nobody pages the org's admins by email.
- A chain is labelled with the tier that names it, so an incident that
  opened critical keeps the warning tier's chain when it drops back, and
  an incident that turns critical runs an inherited chain that had run out.
- A schedule cannot be deleted while a running escalation still pages it.
- Step waits count from the step's due time, not from when the tick ran.
- Schedules report their coverage gaps for the next 14 days (API and MCP).
…noise

- A dead service keeps its page: the liveness probe reads the SLO's short
  windows, not the rule's day-long one.
- A tier needs 10 events and 2 bad ones in its long window to fire; on
  fewer it holds its state instead of clearing.
- A tier's factor is capped at 80% of the highest burn the target can
  reach, so a low target can alert at all.
- New slow-burn warning tier: 3x over 24h and 2h.
- A spent error budget is a warning of its own, in its own alert group
  with a daily reminder, so a burn page still resolves when the burn ends.
- One Postgres read and one warehouse read per SLI for an org's SLOs each
  tick, instead of one of each per SLO.
- The migration is regenerated on top of main's newest.
- A skipped step keeps its due time for the step that stands in for it,
  so that step still dedupes against the tier's own page.
- A step that reaches nobody for any reason is on the incident's timeline.
- A late step still leaves half its wait to acknowledge.
- A schedule edit reads the member directory fresh.
- The noise guard counts recorded spans, not sampling-weighted ones, so one
  sampled failure cannot pass as ten.
- The worker builds its services per tick, so the SLO reads share one
  lookup per tick and the window totals are read on every fifth tick, at
  the tick's own aligned bounds.
- A rule's stored thresholds follow its target: on a target edit, and once
  for rules saved before the tiers changed.
- The budget warning has a label of its own, no chart of another group's
  series, and a 2% margin before it clears.
- Bench cases for the batched alert reads.
…and pages in flight

The newest page per incident and destination is picked in SQL, so reminders to one
destination cannot crowd out another. Pages that never left are deleted first, a page
still on its way out gets its all-clear a minute later, and an all-clear already queued
survives the delete. The all-clear links to the alerts list. CI: backend lanes are sized
at 2.9s per file, lane 2 of 9 ran over the 240s budget on main too.
A chain that keeps running after a downgrade pages its next step with the breach as it
stands. A repeat that reaches nobody emails the admins like a first pass does, and the
step admins stood in for is on the timeline. A schedule can be deleted once a running
escalation is past the steps that page it. The schedule editor's preview ignores an
override whose person left, and a gap list cut at its cap says so.
…w time to acknowledge

The incident page gets a Resolve button that asks first. The inbox, the incident header
and a rule's history say how long an incident stood before its first acknowledgement.
An incident's timeline reads every delivery, not the newest 100. Adds an HTTP test for
the resolve route and a lab page for the incident page and rule history.
The quiet after a resolve by hand ends on a check that reads healthy or reads no data,
after a day at most, and when the rule is switched off or its evaluation changes, so a
group can no longer stay muted for good. The all-clear is prepared before anything
changes and written with the resolve; if it cannot be prepared the incident stays open.
The phone push says who resolved it. The incidents route reaches the resolve through a
narrow service, and paged deliveries are de-duplicated.
…s live

Once a read of the schedule has shown the link this page made, a later read without it means it was turned off, not that the read is old.
@maple-review-bot

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🍁 Maple PR preview

Note

Preview resources were removed when the preview label came off.

Final commit 9c15fe2 · View workflow run

@Makisuo Makisuo removed the preview Deploy a full PR preview stack (Cloudflare + AWS ingest); removing it tears it down label Nov 24, 2026
@Makisuo
Makisuo deployed to pr-preview November 24, 2026 12:36 — with GitHub Actions Active
@Makisuo
Makisuo deployed to preview-tinybird November 24, 2026 12:36 — with GitHub Actions Active
@Makisuo

Makisuo commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Two notes on this PR's state.

Review finding F5 (a dead phone token settles as "No phone is registered for this member"): fixed in 86c6fab. When Apple calls the member's only token dead, the page settles as skipped with "The member's phone no longer accepts pushes".

Preview. The preview label was added and the deploy failed in "Deploy the PR schema to the Tinybird branch": ai_evaluations_mv cannot be created in the branch ("some referenced tables do not exist", which Tinybird's own message calls an internal issue). That view is not part of this stack, and the same step has failed for every preview since the evaluations tables landed. I removed the label so the branch and its slot are released. The preview test and the trace check for this stack are therefore not done; what stands in for them is listed under Verification in each PR.

@maple-review-bot

This comment has been minimized.

…rg's

Also tests the retry of a phone page Apple could not take.
@Makisuo

Makisuo commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

On the two findings carried over in the review summary, both done in 3912cfc:

  • Org-wide device read per page: pageMember reads the member's own devices (listForUser) and keeps the enabled ones, so the read no longer grows with the org.
  • Untested retry of a failed push: AlertsService.oncall-paging.test.ts now covers it: the page stays queued with "The push could not be sent" while the send fails, and is sent on the second attempt once it works.

@maple-review-bot

This comment has been minimized.

Base automatically changed from oncall/calendar-feed to main November 24, 2026 13:48
@Makisuo
Makisuo merged commit 667bf3b into main Nov 24, 2026
8 checks passed
@Makisuo
Makisuo deleted the oncall/mobile-paging branch November 24, 2026 13:48
@maple-review-bot

maple-review-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 10/10 · safe to merge. Tenancy, dedupe keys and the retry/settle branches all hold; the only defect is a doc comment attached to the wrong function in AlertMemberNotifier.
1 note · tests covered · risk medium · 2/2 new units observable

An escalation step that pages a person now also queues a push page to that person's own phones, sent by MobilePushService.pageMember and settled as sent, retried, skipped or not configured, with a "phone" label in the timeline. Safe to merge.

  • loadStepRecipients queues a push recipient for members with a live device
  • MobilePushService.pageMember pushes one page per enabled phone, ignoring preferences
  • AlertMemberNotifier settles the phone page with its own failure reasons
  • pageChannelLabel and the MCP timeline render a push page as "phone"

Findings

🔵 Note · F6 · sendDirectMessage's doc comment now heads sendPush

maintainability · packages/backend/src/services/alerts/AlertMemberNotifier.ts:329-330

The block at 326-328 describes trying each of the org's chat workspaces in turn, and sendPush now sits directly under it, so its doc reads as being about chat. sendDirectMessage at 361 is left with no doc at all.

Define `sendPush` above that block (before line 326) so the workspace comment stays attached to `sendDirectMessage`.
🤖 Prompt to fix this finding with an AI agent
Findings from an automated review of commit bebe88c111917b81cf996d9af9c32235bb4f416c. Verify each one against the current code before changing anything, fix only those that still apply, and keep each fix to the lines it names.

---

F6 · Note · maintainability · packages/backend/src/services/alerts/AlertMemberNotifier.ts:329-330
`sendDirectMessage`'s doc comment now heads `sendPush`
The block at 326-328 describes trying each of the org's chat workspaces in turn, and `sendPush` now sits directly under it, so its doc reads as being about chat. `sendDirectMessage` at 361 is left with no doc at all.
Suggested fix: Define `sendPush` above that block (before line 326) so the workspace comment stays attached to `sendDirectMessage`.

bebe88c · What was checked, coverage and telemetry details are on the Maple / review check. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@maple-review-bot

Copy link
Copy Markdown

Maple: after this shipped

✅ Shipped clean. Nothing this change touches got worse in the hour after it deployed.

Deployed at 2026-11-24 14:38 UTC as 667bf3b. Compared the 60 minutes before and after.

  • 1 operations compared, 0 regressed

Details are in Maple. A public repository's comment names no service, operation or error.

@maple-review-bot

Copy link
Copy Markdown

Maple: after this shipped

✅ Shipped clean. Nothing this change touches got worse in the hour after it deployed.

Deployed at 2026-11-24 14:38 UTC as 667bf3b. Compared the 60 minutes before and after.

  • 1 operations compared, 0 regressed

Details are in Maple. A public repository's comment names no service, operation or error.

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.

1 participant