Skip to content

fix(tools): recognize email addresses as explicit send_message targets#35258

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-0482c70b
May 30, 2026
Merged

fix(tools): recognize email addresses as explicit send_message targets#35258
teknium1 merged 2 commits into
mainfrom
hermes/hermes-0482c70b

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

send_message can now proactively email a resolved address — email:user@example.com (and aliases that resolve to an address) route directly instead of failing with "No home channel set for email."

Root cause: _parse_target_ref() had branches for telegram/slack/discord/etc. but none for email, so any email address returned (None, None, False) and fell through to home-target resolution.

Changes

  • tools/send_message_tool.py: add _EMAIL_TARGET_RE + email branch in _parse_target_ref() so addresses are explicit targets (salvaged from fix(tools): recognize email addresses as explicit targets in send_message #34748, @liuhao1024). Follow-up: the no-home-channel error for email now points at EMAIL_HOME_ADDRESS (the var gateway/config.py actually reads) instead of the generic EMAIL_HOME_CHANNEL, via a per-platform override map.
  • tests/tools/test_send_message_tool.py: 6 parse tests (@liuhao1024) + 2 error-hint tests (email names EMAIL_HOME_ADDRESS, other platforms keep the generic hint).

Validation

Before After
_parse_target_ref("email", "user@example.com") (None, None, False) → home fallback ("user@example.com", None, True) → direct send
alias re-parse (resolve_channel_name → address) chat_id=None → home fallback explicit chat_id
no-home-channel error hint set EMAIL_HOME_CHANNEL (never read) set EMAIL_HOME_ADDRESS (correct)
cross-platform (telegram/slack with @) not explicit unchanged, not explicit

129 tests in test_send_message_tool.py pass; E2E-verified both the direct-email path and the corrected error string.

Salvages #34748. Fixes #34740.

Infographic

windows-launcher-shim-fix

Infographic

email-targets-fixed

liuhao1024 and others added 2 commits May 30, 2026 01:49
…sage

When using send_message with the email platform, valid email addresses
like user@example.com were not recognized as explicit targets by
_parse_target_ref(). This caused the function to return (None, None,
False), forcing the system into channel-name resolution which has no
way to resolve a raw email address, resulting in 'No home channel set
for email' errors.

Add _EMAIL_TARGET_RE pattern and email platform handler in
_parse_target_ref() so email addresses are treated as explicit targets
and routed directly without requiring a home target configuration.
The no-home-channel error for send_message derived the env var name
generically as <PLATFORM>_HOME_CHANNEL, producing EMAIL_HOME_CHANNEL for
the email platform. But gateway/config.py reads EMAIL_HOME_ADDRESS, so a
user following the error's guidance would set a variable that is never
consulted. Add a per-platform override map so the email hint names the
variable actually read; all other platforms keep the generic hint.
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-0482c70b vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9498 on HEAD, 9498 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4925 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets platform/email Email (IMAP/SMTP) adapter labels May 30, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Salvage of #34748 (@liuhao1024). Fixes #34740 (email addresses not recognized as explicit send_message targets). If this merges, #34748 should be closed as superseded.

@teknium1 teknium1 merged commit bfc4a26 into main May 30, 2026
23 checks passed
@teknium1 teknium1 deleted the hermes/hermes-0482c70b branch May 30, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists platform/email Email (IMAP/SMTP) adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: send_message does not recognize explicit email targets and incorrectly falls back to home target resolution

3 participants