Repository navigation
fix(push): preserve distinct Android alerts while offline - #20066
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe push contract now accepts an optional Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The Android push payload migration and pane routing changes are validated without an identified remaining merge risk. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the problem, implementation, compatibility goal, and validation results. However, it does not follow the repository template and omits the required Linked Issue, Visual Proof or explicit N/A statement, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. Resolution Update the description to include all template sections. Add the required issue reference after "Fixes #". Add visual proof or state "N/A" with a reason. Complete the testing checklist and document platform coverage, review status, upstream-boundary applicability, notes, and the remaining checklist items.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Important
This change makes Android delivery depend on a native handler that is not in the released mobile app. There is no server-side gate preventing the data-only payload from reaching old clients, so deploying it ahead of #20068 silently drops push notifications for every Android user on the current release.
Reviewed changes
- Data-only FCM payload:
fcmMessageBodydrops thenotification/android.notification/collapse_keyshape and movestitle,message,tag,channelId, andsoundinto a non-collapsibledatapayload so distinct offline alerts survive reconnect. paneKeyrestored:PushNotificationSchemaandbuildPushDeliveryre-add the optionalpaneKey, re-syncing the source with the already-deployed gateway.- Test updates:
fcm-client.test.tsassertions rewritten for the new shape, dismissal/sound tests extended, and a newpush-pane-routing.test.tscovers the pane round-trip.
⚠️ Data-only delivery breaks the released Android app until #20068 ships
The gateway stops sending the FCM notification payload and relies on the device rendering the data payload itself. That rendering lives in the mobile push rollout that was reverted in #20040 and is only restored by the still-open #20068 (whose base is this branch). The current mobile source has no handler for data-only messages: there is no custom FirebaseMessagingService, no addNotificationReceivedListener, and setNotificationHandler in app/_layout.tsx only affects foreground presentation of notifications the OS already received. Android does not display a data-only FCM message on its own, so a backgrounded or killed app on the current release will receive the message and show nothing.
This is exactly the "changing what the publisher sends breaks old clients" hazard from docs/reference/remote-wire-compatibility.md (Rule 3), and unlike the RPC surface there is no capability handshake to soften it. The device registry (push_devices) stores only platform, not an app version or capability, so the gateway currently has no way to send the old shape to old clients and the new shape to new ones.
The PR body documents the coordination with #20068 and notes the gateway has already been deployed to a "notification-only production service" and validated against a #20068 build, so this is a sequencing concern rather than a code defect. The change is correct given the handler exists; the risk is an unguarded deploy ordering.
Technical details
# Data-only FCM payload must not reach clients without the native handler
## Affected sites
- cloud/apps/push/src/fcm-client.ts:40-51 — `notification`/`android.notification`/`collapse_key` removed; display fields moved into `data`.
- cloud/apps/push/src/device-registry-store.ts:16,88 — registration stores `platform` only; no app version/capability to gate on.
- mobile/src/notifications/local-notification-scheduling.ts — relies on local scheduling; no remote data-message rendering.
- #20068 (fix/mobile-push-recovery) — the handler this payload depends on; still unmerged.
## Required outcome
- The data-only format must only be delivered to app builds that contain the #20068 handler, or the gateway must otherwise be prevented from flipping before the mobile release is live.
## Suggested approach (optional)
- Add an app-version or capability field to device registration and gate the FCM payload shape on it, so old registrations keep the `notification` payload while new ones get data-only; or
- Hold the flip behind a deploy flag and coordinate the gateway and mobile release explicitly.
## Open questions for the human (optional)
- Is the "notification-only production service" separate from the gateway serving released app builds? If it is the same service, is the released Android app confirmed to already contain the #20068 handler?DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Android notification payloads collapse while a device is offline, so distinct agent alerts can be lost. Send non-collapsible data messages and let the existing native notification handler display them, preserving tray IDs, channels, sound preferences, routing metadata, and silent dismissal messages.
Retain the deployed gateway's optional
paneKeysupport, which the mobile rollout revert removed from source.Validation: 139 gateway tests and 30 contract tests passed; gateway typecheck passed. Four database integration checks skipped. On Android 36, six queued implementation payloads produced six notifications after reconnect, with OS grouping and correct normal/silent channels. The control notification payload produced only the last of six alerts. Network recovery was isolated using temporary emulator-only port translation; this change does not repair network restrictions on Google's push connection.
Deployed to the notification-only production service: https://github.com/stablyai/orca/actions/runs/34575782749. The first production test delivered all six offline alerts after approximately 79 seconds on the unmodified emulator network. Android cold-start dismissal registration is fixed separately in #20068; mobile restoration remains unmerged.
Repeated production verification with the app process confirmed absent: six of six alerts delivered; valid dismissal removed only its target and retained the other five. No network workaround; Google automatically fell back to port 443 after ~73 seconds. Temporary registration removed.