#22564: fix(bluebubbles): include iMessage subject in message text
channel: bluebubbles
size: S
experienced-contributor
Cluster:
Bluebubbles iMessage Fixes
## Summary
- **Bug**: iMessage subject field is silently dropped when the message also has a text body
- **Root cause**: `normalizeWebhookMessage` in `monitor-normalize.ts` uses a fallback chain where `subject` is only read when `text` and `body` are both empty
- **Fix**: Extract subject separately and prepend it to the body text with a newline separator
Fixes #21976
## Problem
When an iMessage has both a `text` and `subject` field, the subject is silently dropped. The fallback chain at line 654-658:
```typescript
const text =
readString(message, "text") ??
readString(message, "body") ??
readString(message, "subject") ??
"";
```
Only uses `subject` when both `text` and `body` are empty/undefined.
**Before fix:**
```
Input: { text: "196, '214, '519, '190", subject: "All seem wrong titles" }
Output: "196, '214, '519, '190" (subject lost)
```
## Changes
- `extensions/bluebubbles/src/monitor-normalize.ts` — extract subject separately and combine with body: `subject + newline + body`
- `extensions/bluebubbles/src/monitor-normalize.test.ts` — new regression test with 6 cases
**After fix:**
```
Input: { text: "196, '214, '519, '190", subject: "All seem wrong titles" }
Output: "All seem wrong titles\n196, '214, '519, '190"
```
## Test plan
- [x] New test: 6 cases covering subject+text, subject-only, text-only, body-only, subject+body, neither
- [x] All 79 existing bluebubbles tests pass (6 suites fail due to pre-existing `opusscript` native module issue, unrelated)
- [x] Format check passes (`oxfmt --check`)
## Effect on User Experience
**Before:** Users sending iMessages with subject lines (enabled in iOS Settings > Messages > Show Subject Field) have their subject silently dropped. The agent only sees the body text, losing context.
**After:** Subject is prepended to the message text, preserving the full message content for the agent.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixes a bug where iMessage subject lines were silently dropped when a message also contained body text. The fix extracts the subject separately and prepends it to the message body with a newline separator. The implementation correctly handles all edge cases including subject-only, body-only, and combined scenarios. Six comprehensive test cases cover all permutations of subject/text/body field combinations.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is a focused bug fix with simple, well-tested logic. The implementation correctly handles all edge cases (empty strings, undefined values, and various field combinations). The six test cases provide comprehensive coverage of all scenarios, and the CHANGELOG entry is properly documented.
- No files require special attention
<sub>Last reviewed commit: 8c2a1b9</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#15240: fix(bluebubbles): URL dropped when sent in same iMessage bubble as ...
by yinghaosang · 2026-02-13
79.2%
#16304: fix(bluebubbles): accept webhook message fields at top level
by MisterGuy420 · 2026-02-14
77.0%
#23483: fix(bluebubbles): key debounce by chat+sender instead of messageId
by saucesteals · 2026-02-22
75.8%
#14429: feat(bluebubbles): handle iMessage edit events in webhook
by westhechiang · 2026-02-12
75.5%
#21174: fix(bluebubbles): trim leading newlines from message text
by cosmopax · 2026-02-19
74.1%
#12325: fix: trim leading/trailing whitespace from outbound messages
by jordanstern · 2026-02-09
73.5%
#18664: fix(imessage): honor groupConfig regardless of allowlistEnabled
by brandonwise · 2026-02-16
73.1%
#11600: fix(bluebubbles): always use private-api method for sending
by coletebou · 2026-02-08
73.0%
#19522: feat(bluebubbles): send TTS as native iMessage voice memos
by mwmacmahon · 2026-02-17
71.2%
#16733: fix(ui): avoid injected newlines when tool output is hidden
by jp117 · 2026-02-15
71.2%