← Back to PRs

#14429: feat(bluebubbles): handle iMessage edit events in webhook

by westhechiang open 2026-02-12 03:57 View on GitHub →
channel: bluebubbles stale size: M
## Summary - Detect iMessage edit events from BlueBubbles `updated-message` webhooks by checking for the `dateEdited` field - Route edit events through the normal message pipeline instead of silently dropping them - Tag edited messages with `[[edit:N]]` referencing the original message's short ID so the AI knows which message was corrected - Update the reply cache with the new text so future references reflect the edit ## Problem When a user edits an iMessage, BlueBubbles sends an `updated-message` webhook event. The existing handler only expected reactions/tapbacks from this event type. Non-reaction `updated-message` events (including edits) were silently dropped at the webhook handler level with "webhook ignored updated-message without reaction". This meant edits were completely invisible to the AI — the original text persisted and the correction was lost. ## Changes **`extensions/bluebubbles/src/monitor.ts`**: - Added `dateEdited` field to `NormalizedWebhookMessage` type - Added `dateEdited` parsing in `normalizeWebhookMessage()` (handles both camelCase and snake_case) - Added `normalizeWebhookEdit()` function that identifies edits (has `dateEdited`, no `associatedMessageGuid`) - Modified webhook handler to check for edits before dropping `updated-message` events - Modified `processMessage()` to skip tapback detection for edits and format with `[[edit:N]]` tag **`extensions/bluebubbles/src/monitor.test.ts`**: - Added 4 tests covering: edit with cached original, delivery receipt ignored, from-me edit, and edit without prior cache ## Test plan - [x] All 55 existing + new tests pass (`vitest run extensions/bluebubbles/src/monitor.test.ts`) - [x] Zero TypeScript errors in changed files - [ ] Manual test: send an iMessage, edit it, verify the AI receives `[[edit:N]] corrected text` - [ ] Manual test: verify delivery/read receipts are still silently dropped - [ ] Manual test: verify reactions/tapbacks still work correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR teaches the BlueBubbles webhook monitor to treat `updated-message` payloads with a `dateEdited` field as message edits (instead of dropping them as “updated-message without reaction”). It normalizes the edit timestamp, routes edits through the normal message pipeline, prefixes edited bodies with an `[[edit…]]` tag, and updates the reply cache so later references use the edited text. Tests were added to cover edit vs receipt handling and from-me behavior. Main issues to address before merge are around formatting/tagging: edited messages currently bypass reply tagging logic (so an edited reply can lose `[[reply_to:N]]` context), and the code often emits `[[edit]]` even though a shortId is assigned later in the same processing call for previously-unknown GUIDs. <h3>Confidence Score: 3/5</h3> - Mostly safe to merge after fixing edit-tag formatting edge cases. - Core normalization/routing changes are straightforward and covered by tests, but the current body composition for edits drops reply context tags and can emit `[[edit]]` even when a shortId is available later in the same processing flow, which can reduce correctness of the AI context. - extensions/bluebubbles/src/monitor.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs