openclaw/extensions/imessage/src
Rohan Marr b29e180ef4
fix: prevent self-chat dedupe false positives (#55359) (thanks @rmarr)
* fix(imessage): prevent self-chat dedupe false positives (#47830)

Move echo cache remember() to post-send only, add early return when
inbound message ID doesn't match cached IDs (prevents text-based
false positives in self-chat), and reduce text TTL from 5s to 3s.

Three targeted changes to fix silent user message loss in self-chat:

1. deliver.ts: Remove pre-send remember() call — cache only reflects
   successfully-delivered content, not pre-send full text.

2. echo-cache.ts: Skip text fallback when inbound has a valid message ID
   that doesn't match any cached outbound ID. In self-chat, sender == target
   so scopes collide; a user message with a fresh ID but matching text was
   incorrectly dropped as an echo.

3. echo-cache.ts: Reduce text TTL from 5000ms to 3000ms — agent echoes
   arrive within 1-2s, 5s was too wide.

Adds self-chat-dedupe.test.ts (7 tests) + updates deliver.test.ts.
BlueBubbles uses a different cache pattern — no changes needed there.

Closes #47830

* review(imessage): strip debug logs, bump echo TTL to 4s (#47830)

Bruce Phase 4 review changes:
- Remove all [IMSG-DEBUG] console.error calls from inbound-processing.ts
  and monitor-provider.ts (23 lines, left over from Phase 2 debug deploy)
- Bump SENT_MESSAGE_TEXT_TTL_MS from 3s to 4s in echo-cache.ts to give
  ~2s margin above the observed 2.2s echo arrival time under load
- Update TTL tests to reflect 4s TTL (expired at 5s, live at 3s)

* fix(imessage): add dedupe comments and canary/compat/TTL tests

* fix(imessage): address review feedback on echo cache, shadowing, and test IDs

* refactor(imessage): hoist inboundMessageId to eliminate duplicate computation (#47830)

* fix(imessage): unify self-chat echo matching

* fix: use inbound guid for self-chat echo matching (#55359) (thanks @rmarr)

---------

Co-authored-by: Rohan Marr <rmarr@users.noreply.github.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-03-29 12:51:17 +05:30
..
monitor fix: prevent self-chat dedupe false positives (#55359) (thanks @rmarr) 2026-03-29 12:51:17 +05:30
accounts.ts refactor: share merged account config helper 2026-03-22 19:01:52 +00:00
channel.outbound.test.ts fix(regression): restore imessage cold-runtime chunking 2026-03-27 20:50:03 -05:00
channel.runtime.ts perf: reduce plugin runtime startup overhead 2026-03-22 09:35:36 +00:00
channel.setup.ts Plugins: internalize imessage SDK imports 2026-03-17 21:35:32 -07:00
channel.ts refactor(acp): extract generic current conversation binding store 2026-03-28 05:53:07 +00:00
client.ts refactor: untangle remaining plugin sdk boundaries 2026-03-16 21:16:32 -07:00
config-schema.ts refactor: move channel config metadata into plugin-owned manifests 2026-03-27 01:59:30 +00:00
config-ui-hints.ts refactor: move channel config metadata into plugin-owned manifests 2026-03-27 01:59:30 +00:00
constants.ts refactor: move iMessage channel to extensions/imessage (#45539) 2026-03-14 02:44:23 -07:00
conversation-bindings.ts feat(acp): add conversation binds for message channels 2026-03-28 01:54:25 +00:00
conversation-id.ts refactor: remove plugin sdk extension facade smells 2026-03-28 03:12:07 +00:00
conversation-route.test.ts feat(acp): add conversation binds for message channels 2026-03-28 01:54:25 +00:00
conversation-route.ts feat(acp): add conversation binds for message channels 2026-03-28 01:54:25 +00:00
group-policy.contract.test.ts refactor: move extension-owned tests to extensions 2026-03-27 21:37:09 +00:00
group-policy.ts iMessage: fix group policy config import 2026-03-18 03:39:21 +00:00
monitor.gating.test.ts refactor: move iMessage channel to extensions/imessage (#45539) 2026-03-14 02:44:23 -07:00
monitor.shutdown.unhandled-rejection.test.ts refactor: move iMessage channel to extensions/imessage (#45539) 2026-03-14 02:44:23 -07:00
monitor.ts refactor: move iMessage channel to extensions/imessage (#45539) 2026-03-14 02:44:23 -07:00
outbound-adapter.ts perf: reduce plugin runtime startup overhead 2026-03-22 09:35:36 +00:00
outbound-payload.contract.test.ts refactor: move extension-owned tests to extensions 2026-03-27 21:37:09 +00:00
plugin-shared.ts refactor: move agent runtime into agents layer 2026-03-16 22:53:16 -07:00
plugins-core.contract.test.ts refactor: move extension-owned tests to extensions 2026-03-27 21:37:09 +00:00
probe.ts refactor: consolidate plugin sdk surface 2026-03-20 19:24:10 +00:00
registry-backed.contract.test.ts refactor: move extension-owned tests to extensions 2026-03-27 21:37:09 +00:00
runtime.ts refactor: untangle remaining plugin sdk boundaries 2026-03-16 21:16:32 -07:00
send.ts fix: prevent self-chat dedupe false positives (#55359) (thanks @rmarr) 2026-03-29 12:51:17 +05:30
setup-core.ts refactor: share top-level setup dm policies 2026-03-26 23:20:26 +00:00
setup-surface.ts refactor: deduplicate setup wizard helpers 2026-03-18 03:58:22 +00:00
shared.ts refactor: move channel config metadata into plugin-owned manifests 2026-03-27 01:59:30 +00:00
target-parsing-helpers.ts refactor: untangle remaining plugin sdk boundaries 2026-03-16 21:16:32 -07:00
targets.test.ts test: collapse imessage test suites 2026-03-25 05:21:16 +00:00
targets.ts Outbound: move target resolution heuristics behind plugins 2026-03-18 04:24:54 +00:00