openclaw/extensions/bluebubbles/src
Ryan Haines 75a9ea004b
Fix BlueBubbles DM history backfill bug (#20302)
* feat: implement DM history backfill for BlueBubbles

- Add fetchBlueBubblesHistory function to fetch message history from API
- Modify processMessage to fetch history for both groups and DMs
- Use dmHistoryLimit for DMs and historyLimit for groups
- Add InboundHistory field to finalizeInboundContext call

Fixes #20296

* style: format with oxfmt

* address review: in-memory history cache, resolveAccount try/catch, include is_from_me

- Wrap resolveAccount in try/catch instead of unreachable guard (it throws)
- Include is_from_me messages with 'me' sender label for full conversation context
- Add in-memory rolling history map (chatHistories) matching other channel patterns
- API backfill only on first message per chat, not every incoming message
- Remove unused buildInboundHistoryFromEntries import

* chore: remove unused buildInboundHistoryFromEntries helper

Dead code flagged by Greptile — mapping is done inline in
monitor-processing.ts.

* BlueBubbles: harden DM history backfill state handling

* BlueBubbles: add bounded exponential backoff and history payload guards

* BlueBubbles: evict merged history keys

* Update extensions/bluebubbles/src/monitor-processing.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: Ryan Mac Mini <ryanmacmini@ryans-mac-mini.tailf78f8b.ts.net>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-21 20:00:09 -05:00
..
account-resolve.ts refactor(extensions): dedupe connector helper usage 2026-02-16 14:59:30 +00:00
accounts.ts Revert "channels: migrate extension account listing to factory" 2026-02-16 23:17:13 -05:00
actions.test.ts chore: Fix type errors in `extensions/bluebubbles` tests. 2026-02-17 10:14:00 +09:00
actions.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
attachments.test.ts refactor(msteams,bluebubbles): dedupe inbound media download helpers 2026-02-21 23:08:07 +01:00
attachments.ts refactor(msteams,bluebubbles): dedupe inbound media download helpers 2026-02-21 23:08:07 +01:00
channel.ts Revert "fix: resolve #12770 - update Antigravity default model and trim leading whitespace in BlueBubbles replies" 2026-02-16 21:11:53 -05:00
chat.test.ts test(bluebubbles): merge typing start stop method checks 2026-02-19 10:09:34 +00:00
chat.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
config-schema.test.ts refactor(security): unify webhook auth matching paths 2026-02-21 11:52:34 +01:00
config-schema.ts refactor(security): unify webhook auth matching paths 2026-02-21 11:52:34 +01:00
history.ts Fix BlueBubbles DM history backfill bug (#20302) 2026-02-21 20:00:09 -05:00
media-send.test.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
media-send.ts bluebubbles: harden local media path handling against LFI (#16322) 2026-02-14 17:43:44 +00:00
monitor-normalize.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
monitor-processing.ts Fix BlueBubbles DM history backfill bug (#20302) 2026-02-21 20:00:09 -05:00
monitor-reply-cache.ts refactor(bluebubbles): split monitor parsing and processing modules 2026-02-13 19:08:37 +00:00
monitor-shared.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
monitor.test.ts Fix BlueBubbles DM history backfill bug (#20302) 2026-02-21 20:00:09 -05:00
monitor.ts refactor(security): unify webhook auth matching paths 2026-02-21 11:52:34 +01:00
multipart.ts fix(bluebubbles): use Buffer for multipart body 2026-02-15 19:25:11 +00:00
onboarding.ts refactor(onboarding): reuse allowFrom merge helper in extensions 2026-02-16 23:47:57 +00:00
probe.ts fix: dedupe probe/token base types (#16986) (thanks @iyoda) 2026-02-15 11:36:54 -06:00
reactions.test.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
reactions.ts refactor(extensions): dedupe connector helper usage 2026-02-16 14:59:30 +00:00
request-url.ts refactor(msteams,bluebubbles): dedupe inbound media download helpers 2026-02-21 23:08:07 +01:00
runtime.ts refactor: rename to openclaw 2026-01-30 03:16:21 +01:00
send-helpers.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
send.test.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
send.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
targets.test.ts refactor(security): make empty allowlist behavior explicit 2026-02-21 19:54:59 +01:00
targets.ts refactor(extensions): dedupe connector helper usage 2026-02-16 14:59:30 +00:00
test-harness.ts test: annotate harness mocks to avoid TS2742 in CI 2026-02-16 15:19:11 +00:00
test-mocks.ts refactor(extensions): dedupe connector helper usage 2026-02-16 14:59:30 +00:00
types.ts bluebubbles: harden local media path handling against LFI (#16322) 2026-02-14 17:43:44 +00:00