Repository navigation
Description
Summary
Each time the bb mobile app comes back to the foreground, it runs two push registration syncs, and each sync POSTs to https://exp.host/--/api/v2/push/getExpoPushToken before it finds that the registration is up to date. The Expo push token does not change between resumes, so both requests are redundant. Expected: no token request on a resume when the device token has not changed.
Versions and environment
- bb from source at origin/main
2a21dd56f69cb1b72d78f97d51e8d4d72f09fe2e(apps/mobile, expo-notifications 58.1.8). - Linux, Node v26.13.1 (measured with Vitest and the real
createPushRegistrationController; no device needed).
Steps to reproduce
- Turn on notifications for a server in the mobile app, so the server has a registration.
- Put the app in the background and bring it back.
- Count requests to
exp.host(for example with a proxy), or run the controller with fake modules as below.
Controller reproduction: create createPushRegistrationController with a fake PushNotificationsModule that counts getExpoPushToken calls and a fake PushSubscriptionsApi that counts register calls. Sync once (cold start), then repeat the host's resume pattern 10 times: refreshPermission().then(() => sync(profile)) (AppState active) together with sync(profile) (the effect that runs again when realtime reconnects).
Expected vs actual
Actual at 2a21dd56f6:
cold start (connected effect): token fetches=1 registers=1
10 resumes (AppState active + reconnect effect): token fetches=20 registers=0
device token roll: token fetches=2 registers=0
Expected: 0 token fetches on resume, and 1 fetch after a device token roll.
Evidence
- Two syncs per resume: the AppState
activehandler and the effect that depends onconnectedboth callcontroller.sync(PushNotificationsHost.tsx#L117-L131). - Each sync fetches the Expo push token first and only then compares it with the stored record (push-registration.ts#L140-L160).
- The fetch is
Notifications.getExpoPushTokenAsync(expo-push-module.ts#L70-L74). In expo-notifications 58.1.8 (src/getExpoPushTokenAsync.ts) this always POSTs toexp.host, and then turns on the library's automatic server registration. From then on,src/DevicePushTokenAutoRegistration.fx.tssends every device token change to Expo by itself, and checks the last uploaded device token at each app start. - Device token changes already reach the controller through
addTokenListenerandhandleTokenRolled(push-registration-controller.ts#L177-L185), and a 24 h re-registration exists (PUSH_REGISTRATION_REFRESH_MS).
What you ruled out
- Not a duplicate: searches for "expo push token resume", "getExpoPushTokenAsync", "push token exp.host" and "push registration resume" find only Content-free push, or a device-token path a self-hosted relay can use #8005 (payload privacy, unrelated).
- The resume sync itself is needed: it picks up permission changes made in system settings (Add mobile push notifications to the bb app #2881). Only the token request is redundant.
- No server registration is repeated:
registeris 0 on resume; the cost is the exp.host round trip on each sync.
AGENT GENERATED
Activity
bb-slop-cop commentedon Nov 26, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotmobile,remote;perf.confirmed-repro.b0ddaad731): three simulated resumes make six token requests and zero server-registration writes. All 29 relevant existing tests pass. Actual device traffic was not captured.Fetch the Expo push token once per device token on mobile (get-bb#8225)
Fetch the Expo push token once per device token on mobile (get-bb#8225)