Repository navigation
Add a built-in push notifications plugin and the interaction.pending plugin event - #2872
Merged
SawyerHood merged 21 commits intoSep 2, 2026
Merged
Conversation
…tifications-thr_nuee4d9q4w
The settings test that main added renders GeneralSettingsSection with explicit props and needed the push notification ones. The plugin SDK root bundle now carries the notifications SDK area, so the Plugin Guide inventory hash moved. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…pUrl Co-Authored-By: Claude Fable 5.1 <[email protected]>
…tifications-thr_nuee4d9q4w
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…in the Tasks test Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
SawyerHood
marked this pull request as ready for review
September 2, 2026 16:22
…tifications-thr_nuee4d9q4w # Conflicts: # apps/server/test/services/plugins/official-plugins.test.ts # packages/plugin-api-map/sdk-public-api.json
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit 147feae)
Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit ac81bf9)
SawyerHood
deleted the
bb/add-mobile-push-notifications-thr_nuee4d9q4w
branch
September 2, 2026 16:42
SawyerHood
added a commit
that referenced
this pull request
Sep 2, 2026
## Human comments ## What was wrong The bb mobile app could not notify a user when the app was closed. #2872 adds the server side as the built-in `push-notifications` plugin. This PR stacks on it and adds the phone client. The design and decisions are in `plans/bb-mobile-push-self-hosted.md`. ## What changed All under `apps/mobile/**`. - Registration talks to the plugin through `sdk.plugins.callRpc` (`pushSubscriptions.add|list|remove`) with local zod schemas for the outputs. A missing row on remove counts as already removed. A server without the plugin or with it disabled shows "Push notifications plugin is disabled on this server" in Settings. - `src/data/notifications/`: registration policy (`decidePushSync`, `syncPushRegistration`, `unregisterPushRegistration`, `enablePushForProfile`, `describePushStatus`), the coalescing registration controller, the MMKV push store, the RPC wrapper keyed by server URL so a removed profile's row can still be deleted, notification payload to profile resolution, and the badge count. - Registration refuses a Direct profile over plain `http://` unless the host is loopback. Tailscale Serve and bb connect profiles register normally. The Settings row shows "Push needs HTTPS or bb connect". - `src/notifications/`: `PushNotificationsHost` (mounted once in `app/_layout.tsx`) syncs on connect, AppState active, token roll, and toggle; cleans up removed profiles; routes taps, including cold start, to `/threads/<id>` on the owning profile by matching the `serverUrl` hint first and probing saved profiles only when no hint matches; shows a foreground toast with Open; shows the one-time "Get notified…" sheet after the first successful connection and never on launch. `AppBadgeSync` owns the app-icon badge. - Settings: new `app/settings/notifications.tsx` and `NotificationsSettingsScreen` with one switch per server profile and a status hint, linked from Device settings, reachable at `bb://settings/notifications`. - e2e: `shell-deep-link.yaml` opens the Notifications screen. README push section and release check updated. ## How you verified - Tests: `push-subscriptions-api.test.ts` (RPC mapping, not-found on remove, both unloaded-plugin server messages), `push-registration.test.ts` (including the plain-HTTP refusal and loopback allowance), `push-registration-controller.test.ts`, `push-store.test.ts`, `push-notification-target.test.ts` (hint match before probing), `app-badge.test.ts`, `shell-links.test.ts`. - `pnpm exec turbo run typecheck test --continue --filter=@bb/mobile`: green, 43 test files, 325 tests. - Not run here: the dev client and `xcrun simctl push` (Linux host). Acceptance on a physical iPhone with an EAS development build follows the checklist in the plan. > AGENT GENERATED --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
The bb mobile app had no way to reach a user when the app was closed. An earlier end-to-end implementation (
b0362ef65onbb-mobile-4-push) never landed and fell 400 commits behind. It also returned full Expo push tokens from the unauthenticated list route, had no runtime off switch, ignoredHTTPS_PROXY, and could not tell a multi-server phone which server sent a push. Plugins also could not observe a new pending interaction, so a notifier could not be written as a plugin at all. The design, the alternatives, and the settled decisions are inplans/bb-mobile-push-self-hosted.md: the server posts to Expo's push API directly, so a self-hosted server needs no Apple or Google key and bb connect holds nothing.What changed
Server side only. The mobile client follows in the stacked PR #2881.
interaction.pendingthread event carrying the thread and pending interaction DTOs, emitted after the pending row commits. Newbb.server.experimental_appUrlexposing the operator'sBB_APP_URL(ornull). Both have entries indocs/api_to_audit.md, Plugin Guide card updates, and a refreshed SDK inventory. RPC method names may now use dot-separated segments.push-notifications(plugins/push-notifications, enabled by default). Listens tointeraction.pending,thread.idle(root, visible threads), andthread.failed; coalesces per thread for 2 s; re-reads the thread and its interactions through the SDK at flush time and drops the push when the thread was read, the interaction was answered, the status moved on, or the thread is archived, deleted, or hidden. Posts batches of 100 to Expo through undici withEnvHttpProxyAgent(honorsHTTPS_PROXY/NO_PROXY), removes rows onDeviceNotRegistered, warns on network failures at most once per hour, never logs tokens, and includesserverUrlin the push data when the app URL is configured.pushSubscriptions.list|add|remove(list returnstokenSuffix, never the token). CLIbb push-notifications list|add|remove|status. Declarative settingexpoPushUrl(defaulthttps://exp.host/--/api/v2/push/send). Disabling the plugin is the off switch.docs/configuration.md,docs/platform-support.md, a new "Push notifications on a self-hosted server" section indocs/multiple-devices.md, regenerated guide templates, bb-cli and plugin-authoring skill references.HOST_DAEMON_PROTOCOL_VERSIONis unchanged. No core schema change: the earlier core table and migration were removed before this PR left draft.How you verified
plugins/push-notifications/server.test.ts(fake Expo endpoint and fake plugin host: each trigger, coalescing, read and resolved-interaction cancellation,serverUrlpresent and absent, proxy dispatcher, warning throttle,DeviceNotRegisteredcleanup, RPC and CLI surfaces),public-sdk-only.test.ts,apps/server/test/services/plugins/plugin-thread-events.test.tsfor the new event, the builtin-registry tests,packages/plugin-sdkfake host tests, and the Plugin Guide api-sync tests.pnpm exec turbo run typecheck test --continue --filter=@get-bb/plugin-sdk --filter=@bb/plugin-api-map --filter=@bb/db --filter=@bb/domain --filter=@bb/server-contract --filter=@bb/server --filter=@bb/sdk --filter=@bb/cli --filter=@bb/config --filter=bb-app --filter=@bb/app --filter=bb-plugin-push-notifications: 30 tasks green.bb plugin build plugins/push-notificationsandpnpm exec turbo run smoke:tarball --filter=bb-app: the packed app ships and starts the plugin.