hermes - ✅(Solved) Fix [Bug]: send_message cannot resolve BlueBubbles targets — missing target pattern in _parse_target_ref and no contact enumeration in channel directory [2 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#23409Fetched 2026-05-11 03:29:36
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Timeline (top)
labeled ×5cross-referenced ×2commented ×1

The send_message tool cannot send to BlueBubbles targets by email or phone number. Attempting send_message(target="bluebubbles:[email protected]", message="hello") fails with "Could not resolve" even though the BlueBubbles adapter is connected and capable of sending.

Error Message

  1. Observe error: "Could not resolve 'whovianjay14@xxxxxxxxx' on bluebubbles"
  • #3892 (closed) — MCP send_imessage returns empty error (address resolution?)

Root Cause

Three compounding gaps in the send_messagechannel_directory path, structurally identical to the fixed Slack bug (#15927 → #15947):

Fix Action

Fixed

PR fix notes

PR #23415: fix(send_message): add BlueBubbles email target support and channel directory enumeration

Description (problem / solution / changelog)

Summary

Add BlueBubbles email target support to send_message tool and enable channel directory enumeration for BlueBubbles chats.

Root Cause

The send_message tool cannot send to BlueBubbles targets by email address (e.g., bluebubbles:[email protected]) because:

  1. _parse_target_ref() has no BlueBubbles email pattern – only phones are handled by the _PHONE_PLATFORMS branch (pending PR #21683 merge)
  2. _build_channel_directory() has no BlueBubbles contact enumeration – only Discord and Slack have explicit enumeration functions
  3. Without enumeration, send_message(action=list) shows no BlueBubbles targets even though the adapter is connected

This is structurally identical to the fixed Slack bug (#15927 → #15947).

Fix

tools/send_message_tool.py

  • Add _BLUEBUBBLES_EMAIL_TARGET_RE regex to match email addresses
  • Add BlueBubbles branch in _parse_target_ref() to recognize emails as explicit targets
  • Phone numbers are already handled by the existing _PHONE_PLATFORMS branch once BlueBubbles is added (PR #21683 pending)

gateway/channel_directory.py

  • Add _build_bluebubbles() async function that queries BlueBubbles server's /api/v1/chat/query endpoint
  • Populate channel directory with DMs and groups, building display names from participant addresses
  • Call _build_bluebubbles() from build_channel_directory() for BlueBubbles adapters
  • Add BlueBubbles to _SKIP_SESSION_DISCOVERY since it has explicit enumeration

tests/tools/test_send_message_tool.py

  • Add TestParseTargetRefBlueBubbles test class with 7 test cases covering:
    • Email address recognition ([email protected])
    • Whitespace stripping
    • Email with + tags and dots
    • Phone number behavior (documenting current state before PR #21683 merge)
    • Invalid email rejection
    • Empty string handling
    • Non-email address rejection

Testing

Unit tests

python -m pytest tests/tools/test_send_message_tool.py::TestParseTargetRefBlueBubbles -v
# 7 passed in 1.55s

Manual verification steps (once deployed)

  1. Configure BlueBubbles platform (env vars set, gateway running)
  2. Call send_message(target="bluebubbles:[email protected]", message="hello")
  3. Should resolve to email address and send successfully (no "Could not resolve" error)
  4. Call send_message(action="list")
  5. Should show BlueBubbles chats in the directory listing

Related

  • Issue #23409: [Bug]: send_message cannot resolve BlueBubbles targets
  • PR #15947: fix(Slack): resolve Slack channels by raw ID and enumerate joined channels (precedent)
  • PR #21683: fix: guard BlueBubbles sends with contact book (adds BlueBubbles to _PHONE_PLATFORMS, currently OPEN)

Changed files

  • gateway/channel_directory.py (modified, +51/-175)
  • tests/tools/test_send_message_tool.py (modified, +51/-0)
  • tools/send_message_tool.py (modified, +8/-0)

PR #23434: fix(tools): resolve BlueBubbles send_message targets by email and phone

Description (problem / solution / changelog)

Resolves BlueBubbles email and phone-number targets in send_message, mirroring the Slack fix from #15947.

What changed and why

  • tools/send_message_tool.py:_parse_target_ref now has a bluebubbles branch that recognizes raw chat GUIDs (iMessage;-;handle / iMessage;+;groupId), email handles, and E.164 phone numbers as explicit targets. Before, none of these patterns matched, so calls like send_message(target="bluebubbles:[email protected]", ...) fell through to channel-name resolution against an empty directory and returned "Could not resolve".
  • gateway/channel_directory.py now has a _build_bluebubbles(adapter) enumerator that paginates the BlueBubbles server's /api/v1/chat/query endpoint, records each chat's GUID and display name (typing it as group or dm based on the ;+;/;-; GUID marker), and merges in session-discovered DMs as a backstop. build_channel_directory now calls it when a BlueBubbles adapter is connected, so send_message(action='list') reflects the server's real chat list.
  • The BlueBubblesAdapter.send() path already handled raw handles (_resolve_chat_guid_create_chat_for_handle); only the tool layer needed wiring.

How to test

  • pytest tests/tools/test_send_message_tool.py::TestParseTargetRefBlueBubbles tests/gateway/test_channel_directory.py::TestBuildBlueBubbles -v
  • Manual: with BlueBubbles configured and the gateway running, call send_message(target="bluebubbles:[email protected]", message="hi") and verify it resolves and sends; also send_message(action='list') should now show BlueBubbles chats.

What platforms tested on

  • macOS on darwin-arm64 (local pytest, 13 new tests + 150 in touched files passing)

Fixes #23409

<!-- autocontrib:worker-id=issue-new-a1faf18c kind=pr-open -->

Changed files

  • gateway/channel_directory.py (modified, +60/-0)
  • tests/gateway/test_channel_directory.py (modified, +120/-0)
  • tests/tools/test_send_message_tool.py (modified, +49/-0)
  • tools/send_message_tool.py (modified, +17/-0)

Code Example

# At the end of _parse_target_ref — returns (None, None, False)
return None, None, False

---

"bluebubbles": []
RAW_BUFFERClick to expand / collapse

Summary

The send_message tool cannot send to BlueBubbles targets by email or phone number. Attempting send_message(target="bluebubbles:[email protected]", message="hello") fails with "Could not resolve" even though the BlueBubbles adapter is connected and capable of sending.

Steps to Reproduce

  1. Configure BlueBubbles platform (env vars set, gateway running with BlueBubbles connected)
  2. Call send_message(target="bluebubbles:[email protected]", message="So cool!!!")
  3. Observe error: "Could not resolve 'whovianjay14@xxxxxxxxx' on bluebubbles"

Root Cause

Three compounding gaps in the send_messagechannel_directory path, structurally identical to the fixed Slack bug (#15927 → #15947):

Gap 1: _parse_target_ref — no BlueBubbles target pattern

tools/send_message_tool.py line 318: _parse_target_ref() has explicit-ID handlers for Telegram, Discord, Feishu, Weixin, Matrix, Yuanbao, and phone platforms (Signal/SMS/WhatsApp) — but no case for BlueBubbles. An email address or phone number fails all existing patterns and returns is_explicit=False:

# At the end of _parse_target_ref — returns (None, None, False)
return None, None, False

This causes _handle_send() to fall through to resolve_channel_name(), which looks up the target in the channel directory. Since the directory is empty for BlueBubbles (see Gap 2), resolution fails.

Gap 2: _build_channel_directory — no BlueBubbles contact enumeration

gateway/channel_directory.py line 60: build_channel_directory() has explicit enumerators for only Platform.DISCORD and Platform.SLACK. Every other platform (including BlueBubbles) falls through to _build_from_sessions() which only discovers contacts from past session history. For a fresh BlueBubbles setup, this means:

"bluebubbles": []

Gap 3: send_message(action=list) shows nothing

Because the channel directory is empty, send_message(action=list) lists no BlueBubbles targets — even though the adapter is connected and has hundreds of chats available on the server.

Why the adapter itself works

The BlueBubblesAdapter.send() method (line 404 of gateway/platforms/bluebubbles.py) correctly handles raw addresses — it calls _resolve_chat_guid(chat_id) which queries the server's chat list by email/phone, and falls back to _create_chat_for_handle() for new conversations. The problem is purely in the send_message tool layer that never passes the address through.

Suggested Fix

Following the same blueprint as the Slack fix (#15947):

  1. _parse_target_ref — add a BlueBubbles branch that accepts email addresses (containing @) and phone numbers (starting with + or digits) as explicit targets, similar to the _PHONE_PLATFORMS pattern for Signal/SMS/WhatsApp.

  2. _build_channel_directory — add a _build_bluebubbles(adapter) function that queries the BlueBubbles server's /api/v1/chat/query to populate the channel directory with known contacts/chats.

  3. send_message(action=list) — would then show BlueBubbles targets once the directory is populated.

Precedent

The exact same structural bug was fixed for Slack in:

  • Issue #15927: "Slack: Hermes fails send message to a channel different than current one"
  • PR #15947 (merged): "fix(Slack): resolve Slack channels by raw ID and enumerate joined channels" — added a regex to _parse_target_ref, fixed resolve_channel_name, and built proper _build_slack enumeration via users.conversations.

Related BlueBubbles Issues

  • #8514 — chatGuid is null in webhook payloads (DM replies misrouted)
  • #12439 (open PR) — standalone send path port bind conflict
  • #3892 (closed) — MCP send_imessage returns empty error (address resolution?)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: send_message cannot resolve BlueBubbles targets — missing target pattern in _parse_target_ref and no contact enumeration in channel directory [2 pull requests, 1 comments, 2 participants]