openclaw/src
Tyler Yust 0f662c2935
fix(bluebubbles): route phone-number targets to direct chats; prevent internal IDs leaking in cross-context prefix (#1751)
* fix(bluebubbles): prefer DM resolution + hide routing markers

* fix(bluebubbles): prevent message routing to group chats when targeting phone numbers

When sending a message to a phone number like +12622102921, the
resolveChatGuidForTarget function was finding and returning a GROUP
CHAT containing that phone number instead of a direct DM chat.

The bug was in the participantMatch fallback logic which matched ANY
chat containing the phone number as a participant, including groups.

This fix adds a check to ensure participantMatch only considers DM
chats (identified by ';-;' separator in the chat GUID). Group chats
(identified by ';+;' separator) are now explicitly excluded from
handle-based matching.

If a phone number only exists in a group chat (no direct DM exists),
the function now correctly returns null, which causes the send to
fail with a clear error rather than accidentally messaging a group.

Added test case to verify this behavior.

* feat(bluebubbles): auto-create new DM chats when sending to unknown phone numbers

When sending to a phone number that doesn't have an existing chat,
instead of failing with 'chatGuid not found', now automatically creates
a new chat using the /api/v1/chat/new endpoint.

- Added createNewChatWithMessage() helper function
- When resolveChatGuidForTarget returns null for a handle target,
  uses the new chat endpoint with addresses array and message
- Includes helpful error message if Private API isn't enabled
- Only applies to handle targets (phone numbers), not group chats

* fix(bluebubbles): hide internal routing metadata in cross-context markers

When sending cross-context messages via BlueBubbles, the origin marker was
exposing internal chat_guid routing info like '[from bluebubbles:chat_guid:any;-;+19257864429]'.

This adds a formatTargetDisplay() function to the BlueBubbles plugin that:
- Extracts phone numbers from chat_guid formats (iMessage;-;+1234567890 -> +1234567890)
- Normalizes handles for clean display
- Avoids returning raw chat_guid formats containing internal routing metadata

Now cross-context markers show clean identifiers like '[from +19257864429]' instead
of exposing internal routing details to recipients.

* fix: prevent cross-context decoration on direct message tool sends

Two fixes:

1. Cross-context decoration (e.g., '[from +19257864429]' prefix) was being
   added to ALL messages sent to a different target, even when the agent
   was just composing a new message via the message tool. This decoration
   should only be applied when forwarding/relaying messages between chats.

   Fix: Added skipCrossContextDecoration flag to ChannelThreadingToolContext.
   The message tool now sets this flag to true, so direct sends don't get
   decorated. The buildCrossContextDecoration function checks this flag
   and returns null when set.

2. Aborted requests were still completing because the abort signal wasn't
   being passed through the message tool execution chain.

   Fix: Added abortSignal propagation from message tool → runMessageAction →
   executeSendAction → sendMessage → deliverOutboundPayloads. Added abort
   checks at key points in the chain to fail fast when aborted.

Files changed:
- src/channels/plugins/types.core.ts: Added skipCrossContextDecoration field
- src/infra/outbound/outbound-policy.ts: Check skip flag before decorating
- src/agents/tools/message-tool.ts: Set skip flag, accept and pass abort signal
- src/infra/outbound/message-action-runner.ts: Pass abort signal through
- src/infra/outbound/outbound-send-service.ts: Check and pass abort signal
- src/infra/outbound/message.ts: Pass abort signal to delivery

* fix(bluebubbles): preserve friendly display names in formatTargetDisplay
2026-01-25 10:03:08 +00:00
..
acp fix: stabilize acp streams and tests 2026-01-18 08:54:00 +00:00
agents fix(bluebubbles): route phone-number targets to direct chats; prevent internal IDs leaking in cross-context prefix (#1751) 2026-01-25 10:03:08 +00:00
auto-reply Fix models command (#1753) 2026-01-25 10:02:12 +00:00
browser fix: handle extension relay session reuse 2026-01-24 04:41:28 +00:00
canvas-host chore: update a2ui bundle hash 2026-01-22 08:48:09 +00:00
channels fix(bluebubbles): route phone-number targets to direct chats; prevent internal IDs leaking in cross-context prefix (#1751) 2026-01-25 10:03:08 +00:00
cli fix: drop unused cli import 2026-01-25 03:42:32 +00:00
commands fix: stabilize venice model discovery 2026-01-25 02:43:08 +00:00
config fix: move gateway lock to temp dir 2026-01-25 09:21:46 +00:00
cron fix: clean docker onboarding warnings + preserve agentId casing 2026-01-24 19:07:01 +00:00
daemon test: stabilize service-env path tests on windows 2026-01-24 04:36:52 +00:00
discord TTS: gate auto audio on inbound voice notes (#1667) 2026-01-25 04:35:20 +00:00
docs refactor: route channel runtime via plugin api 2026-01-18 11:01:16 +00:00
gateway fix: listen on ipv6 loopback for gateway 2026-01-25 05:49:48 +00:00
hooks refactor: centralize config update logging 2026-01-23 04:01:26 +00:00
imessage fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
infra fix(bluebubbles): route phone-number targets to direct chats; prevent internal IDs leaking in cross-context prefix (#1751) 2026-01-25 10:03:08 +00:00
link-understanding Add link understanding tool support (#1637) 2026-01-25 00:15:54 +00:00
logging fix: gate diagnostic logs behind verbose 2026-01-24 05:06:42 +00:00
macos fix: type gateway lock handle 2026-01-21 23:05:11 +00:00
markdown fix: add per-channel markdown table conversion (#1495) (thanks @odysseus0) 2026-01-23 18:39:25 +00:00
media fix: anchor MEDIA tag parsing 2026-01-24 03:46:27 +00:00
media-understanding fix: skip image understanding for vision models (#1747) 2026-01-25 09:57:19 +00:00
memory chore: filter noisy warnings 2026-01-24 10:48:33 +00:00
node-host fix: honor tools.exec ask/security in approvals 2026-01-24 04:53:44 +00:00
pairing feat: add /allowlist command 2026-01-21 05:34:53 +00:00
plugin-sdk feat: add chunking mode option for BlueBubbles (#1645) 2026-01-25 00:47:10 +00:00
plugins refactor: align voice-call TTS with core config 2026-01-25 09:29:57 +00:00
process fix: harden exec spawn fallback 2026-01-25 06:37:39 +00:00
providers fix: log config update in copilot auth 2026-01-23 07:23:52 +00:00
routing fix: unify reasoning tags + agent ids (#1613) (thanks @kyleok) (#1629) 2026-01-24 19:56:02 +00:00
security fix: honor gateway env token for doctor/security 2026-01-23 03:16:52 +00:00
sessions fix: inherit model overrides for thread sessions 2026-01-22 06:03:23 +00:00
shared/text fix: unify reasoning tags + agent ids (#1613) (thanks @kyleok) (#1629) 2026-01-24 19:56:02 +00:00
signal fix: configurable signal startup timeout 2026-01-25 04:51:35 +00:00
slack fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
telegram fix(telegram): honor linkPreview on fallback (#1730) 2026-01-25 07:55:39 +00:00
terminal fix: clarify auth order exclusions 2026-01-24 01:18:03 +00:00
test-helpers refactor: add hook guards and test helpers 2026-01-18 06:15:24 +00:00
test-utils feat: add plugin command API for LLM-free auto-reply commands 2026-01-24 06:28:22 +00:00
tts refactor: align voice-call TTS with core config 2026-01-25 09:29:57 +00:00
tui fix: reload TUI history after reconnect 2026-01-25 00:36:36 +00:00
types TTS: gate auto audio on inbound voice notes (#1667) 2026-01-25 04:35:20 +00:00
utils feat: add beta googlechat channel 2026-01-24 23:30:45 +00:00
web TTS: gate auto audio on inbound voice notes (#1667) 2026-01-25 04:35:20 +00:00
whatsapp refactor: prune legacy group prefixes 2026-01-17 08:47:25 +00:00
wizard fix: always offer TUI hatch 2026-01-23 09:07:43 +00:00
channel-web.barrel.test.ts refactor!: rename chat providers to channels 2026-01-13 08:40:39 +00:00
channel-web.ts refactor!: rename chat providers to channels 2026-01-13 08:40:39 +00:00
docker-setup.test.ts fix: update docker gateway command 2026-01-24 03:24:28 +00:00
entry.ts chore: filter noisy warnings 2026-01-24 10:48:33 +00:00
git-hooks.test.ts fix: add git hook setup and stable config hash sorting 2026-01-19 02:02:17 +00:00
globals.test.ts
globals.ts CLI: streamline startup paths and env parsing 2026-01-18 23:10:39 +00:00
index.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
index.ts fix: tame invalid config logging 2026-01-21 01:58:47 +00:00
logger.test.ts fix: align rolling logs to local time 2026-01-22 07:02:52 +00:00
logger.ts refactor(logging): split config + subsystem imports 2026-01-19 00:15:44 +00:00
logging.ts fix: unblock bundled plugin load 2026-01-18 19:34:21 +00:00
polls.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
polls.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
postinstall-patcher.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
runtime.ts perf: speed up memory batch polling 2026-01-18 03:55:14 +00:00
utils.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
utils.ts refactor: centralize config update logging 2026-01-23 04:01:26 +00:00
version.ts