Skip to content

fix(relay): iOS notifications no longer cut an emoji in half at the title limit - #29830

Open
saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:fix/relay-notification-emoji-truncation
Open

saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:fix/relay-notification-emoji-truncation

Conversation

@saphid

@saphid saphid commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Problem

The relay caps iOS push notification titles and bodies, Live Activity rows, and Live Activity alerts at 120 characters. When a payload is too big, it shrinks them further to 96, 76, and so on. The cut counts UTF-16 code units. If it lands between the two halves of an emoji, the payload keeps a lone high surrogate (JSON.stringify sends \ud83d), and the phone shows �... at the end of the thread title.

Example: a thread titled Fix the login flows 🚀🚀🚀… (60 rockets) is sent as Fix the login flows 🚀…🚀\ud83d....

Change

truncateText in infra/relay/src/agentActivity/agentActivityPayloads.ts now drops a trailing lone high surrogate before it appends .... This is the same one-line guard GitVcsDriverCore uses for worktree folder names. The Android FCM path (fitFcmData) already cuts by code point, so iOS now matches it.

Scope and approval

This is a very small, focused fix for an obvious bug, so it has no prior issue. The change is one guard in the single helper every APNs text cap goes through, plus one assertion in the existing APNs payload test.

Overlap search: #24611 (open) fixes the same class of bug in packages/shared truncate, but it doesn't touch the relay's own helper. #24679 (merged) fixed byte-size overflow for CJK titles, not surrogate cuts. No other open PR touches agentActivityPayloads.ts.

Verification

  • Red on main: cd infra/relay && vp test run --config ../../vite.config.ts src/agentActivity/ApnsClient.test.ts fails in "fits long routing metadata and multibyte alerts within the APNs 4096-byte limit": Received: "😀…😀�...".
  • Green: the same file passes 7/7. All of src/agentActivity/ passes 12 files, 102 tests.
  • vp run check:changed: format, lint, typecheck, tests, and knip all pass.
  • Not checked: a real APNs delivery to a device.

Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

…itle limit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 3, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at ad1e8c4

Macroscope's review found this PR approvable — The change prevents truncated notification and Live Activity text from ending with half a UTF-16 surrogate pair. Existing limits and delivery behavior remain unchanged, keeping the impact narrowly bounded.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

Relay notification text truncation now removes a trailing high surrogate before adding an ellipsis. The APNs payload-size test uses an emoji title and checks the sanitized output.

Changes: Relay text truncation

Layer / File(s) Summary
Truncate text and verify APNs output
infra/relay/src/agentActivity/agentActivityPayloads.ts, infra/relay/src/agentActivity/ApnsClient.test.ts
truncateText removes a trailing high surrogate before trimming and appending an ellipsis. The APNs test checks that sanitization turns the emoji title into 58 emoji followed by ....

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • pingdotgg/t3code issue 27842 reports emoji truncation that leaves a lone high surrogate before an ellipsis. This change removes a trailing high surrogate during relay notification text truncation.

Suggested labels: bugfix, size:S

Suggested reviewers: macroscopeapp

Merge Risk: Minimal · up to ad1e8

The surrogate-safe truncation change and regression test present no concrete merge-blocking risk.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing iOS notification titles from splitting emoji at the truncation limit.
Description check Passed The description includes all required sections. It explains the problem and expected behavior, describes the implementation, justifies the focused scope, and reports specific verification results and …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes all required sections. It explains the problem and expected behavior, describes the implementation, justifies the focused scope, and reports specific verification results and limitations.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.1)

ast-grep could not parse rule config: /ast-grep-rules/ast-grep-essentials/rules/javascript/security/insecure-hash.yml

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 5231459 and ad1e8c4.

Files selected for processing: 2
  • infra/relay/src/agentActivity/ApnsClient.test.ts
  • infra/relay/src/agentActivity/agentActivityPayloads.ts

Limit details: You’ve used all 10 included reviews currently available.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant