Repository navigation
fix(relay): preserve conversation routing in iOS push responses - #16350
dannyclifford wants to merge 2 commits into
Conversation
| environmentId: input.notification.environmentId, | ||
| threadId: input.notification.threadId, | ||
| deepLink: input.notification.deepLink, |
There was a problem hiding this comment.
🟠 High agentActivity/ApnsClient.ts:195
Valid notifications with sufficiently long environmentId and threadId are rejected by APNs because this payload duplicates both values and exceeds the 4096-byte limit. The existing root fields already carry these values, so remove them when adding the Expo-compatible body copy.
- environmentId: input.notification.environmentId,
- threadId: input.notification.threadId,
- deepLink: input.notification.deepLink,🤖 Copy this AI Prompt to have your agent fix this:
In file @infra/relay/src/agentActivity/ApnsClient.ts around lines 195-197:
Valid notifications with sufficiently long `environmentId` and `threadId` are rejected by APNs because this payload duplicates both values and exceeds the 4096-byte limit. The existing root fields already carry these values, so remove them when adding the Expo-compatible `body` copy.
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This is a focused relay bug fix that restores iOS notification routing by moving metadata into the Expo-compatible payload location, with regression coverage and no schema, infrastructure, security, billing, or default-setting changes. The final code also avoids duplicating routing fields and verifies the APNs payload-size limit; the supplied High finding remains an independent blocking signal. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe APNs payload now places ChangesAPNs notification payload
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change intends to expose conversation routing data in iOS notifications. No concrete routing failure is established by the available evidence, so no actionable merge risk remains. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change preserves existing delivery controls and restricts navigation to conversation routes. No privilege escalation or additional data disclosure was established, but the native compatibility premise remains unverified and long links can retain an altered conversation identity. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Problem
Ordinary remote iOS alerts can arrive without opening their thread when tapped. The relay places routing metadata only at the payload root. In the pinned
expo-notifications@58.0.11,NotificationRecords.serializedNotificationDatareadsuserInfo["body"]intonotification.content.data; the mobile extractor reads that data.Reproduction at
3a9c1a6df1: build an ordinary alert with environment/thread IDs and a thread deep link, then apply the pinned remote-data selection. The root-only payload supplies no data dictionary, so the existing extractor returns no route. The metadata remains available inrequest.trigger.payload, but the extractor does not read it.Change
Move the routing dictionary under
body, which the current mobile consumer reads. Alert text remains inaps.alert.body. Avoid duplicating the root keys: a sanitized long-ID fixture otherwise grows to 4,603 bytes and exceeds APNs’ 4,096-byte limit.A client fallback to
trigger.payloadis possible; fixing the producer lets existing compatible clients use their current extractor without an app update. Correct route data also restores the existing foreground rule that silences alerts for the thread already on screen. Other-thread/overview behavior and notification preferences are unchanged.Scope and approval
This repairs existing notification-to-thread behavior documented in
docs/user/mobile-notifications.md; it adds no new workflow or setting. It is proposed under the small, focused obvious-bug exception, with no prior maintainer approval claimed.Only the APNs payload builder and its regression tests change. This is separate from the alert-selection work in #11073 and #15015 and the native response races in #15030. It does not replace those fixes. No native, dependency, schema or infrastructure configuration changes.
Verification
vp test run infra/relay/src/agentActivity/ApnsClient.test.ts apps/mobile/src/features/agent-awareness/notificationNavigation.test.ts apps/mobile/src/features/agent-awareness/foregroundNotificationBehavior.test.ts: 27 passed.body. This checks a concrete size regression, not a universal size bound for arbitrary input.vp run --filter t3code-relay typecheck, targeted lint and formatting: passed.Official store/production APNs, cold-start and foreground device behavior, and historical official binaries were not tested. The relay needs deployment for newly constructed payloads to benefit; already-delivered alerts retain their original data.
Prepared with GPT-6 Astra in the Codex harness. Independent local review: GPT-6.1 Sol in the Codex harness.