Repository navigation
fix(relay): Android pushes send a per-device hash instead of the account's user id to Google - #42459
Conversation
…ogle
FCM data pushes carried the raw Clerk user id so the Android handler could
ignore pushes for an account the install no longer has. They now carry
user_hash = sha256("<userId>:<deviceId>"), which the native handler
recomputes from its stored identity. The raw user_id is still sent to
builds before 2.4.0 (or with no reported version), whose handler drops any
push whose user_id does not match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
Every Android agent-activity push sent through FCM carried the account's raw Clerk user id (
user_id) in its data payload, so Google saw it on every push.Consumers found and the decision
apps/mobile/modules/t3-agent-notifications(AgentNotifications.receive). It drops a push unlessdevice_idanduser_idmatch the identity stored byconfigure(deviceId, userId, …), so pushes still in flight for an account the install signed out of (or switched away from) do not show up.user_id, and the relay smoke/watch scripts only send it.The check is still needed, and the device id alone cannot replace it: the device id is per install, not per account. So the relay now sends
user_hash = sha256("<userId>:<deviceId>"), usinghashTelemetryIdfrom@t3tools/shared. The native handler computes the same hash from its stored identity and compares the two. Hashing with the device id gives each install a different value, so the payload no longer carries an id that stays the same for an account across devices. The logic is inandroidRecipientData(fcmPayloads.ts), which the delivery path and both relay scripts use.Old clients
A build before this one only accepts a push when its raw
user_idmatches. Without the field, every push would be dropped silently: nothing would crash, but no notifications would arrive. To prevent that, the relay keeps sendinguser_idwhen the device's registeredapp_versionis below2.4.0or missing/unparseable, along withuser_hash. New builds ignoreuser_id. Once those old builds are gone, the fallback can be deleted. Note: this assumes the change ships in mobile 2.4.0 (app.config.tsis at 2.3.0 now). If the Android release that ships it has a different version, the threshold inandroidRecipientDatahas to change to match.Verification
vp test run src/agentActivity/FcmDeliveries.test.ts(infra/relay): 29 passed. The new case checks that a 2.4.0 device gets nouser_idand gets the expecteduser_hash.vp run check:changed: all passed (format, lint, knip, typecheck, tests).user:device, but did not run them locally because this machine has no Gradle project. CI's mobile native lane covers them. The account/device-switch test still covers rejecting old pushes.Claude Opus 5.5 via Claude Code in T3 Code.
🤖 Generated with Claude Code