openclaw/extensions
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
..
bluebubbles 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
copilot-proxy chore: bump version to 2026.1.23 2026-01-23 22:14:56 +00:00
diagnostics-otel chore: bump version to 2026.1.23 2026-01-23 22:14:56 +00:00
discord Channels: add per-group tool policies 2026-01-24 05:49:39 +00:00
google-antigravity-auth chore: bump version to 2026.1.23 2026-01-23 22:14:56 +00:00
google-gemini-cli-auth chore: bump version to 2026.1.23 2026-01-23 22:14:56 +00:00
googlechat fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
imessage fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
llm-task fix: publish llm-task docs and harden tool 2026-01-24 01:44:51 +00:00
lobster docs(lobster): document clawd.invoke tool allowlisting 2026-01-24 09:29:32 +00:00
matrix fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
mattermost fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
memory-core fix: clean docker onboarding warnings + preserve agentId casing 2026-01-24 19:07:01 +00:00
memory-lancedb chore: bump version to 2026.1.23 2026-01-23 22:14:56 +00:00
msteams fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
nextcloud-talk fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
nostr chore: update deps and test timeout 2026-01-24 10:30:30 +00:00
open-prose chore: bump version to 2026.1.23 2026-01-23 22:14:56 +00:00
qwen-portal-auth fix: enforce plugin config schemas (#1272) (thanks @thewilloftheshadow) 2026-01-20 11:03:17 +00:00
signal fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
slack Channels: add per-group tool policies 2026-01-24 05:49:39 +00:00
telegram fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
tlon fix(tlon): Fix Zod v4 record() and @urbit/aura v3 API changes (#1631) 2026-01-24 21:09:18 +00:00
voice-call refactor: align voice-call TTS with core config 2026-01-25 09:29:57 +00:00
whatsapp fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
zalo fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
zalouser fix: newline chunking across channels 2026-01-25 04:11:36 +00:00