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
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
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
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
onboarding.ts
probe.ts
reactions.test.ts
reactions.ts
request-url.ts refactor(msteams,bluebubbles): dedupe inbound media download helpers 2026-02-21 23:08:07 +01:00
runtime.ts
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
test-harness.ts
test-mocks.ts
types.ts