fix(tools): recognize email addresses as explicit send_message targets#35258
Merged
Conversation
…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.
Contributor
🔎 Lint report:
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
send_messagecan 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 atEMAIL_HOME_ADDRESS(the vargateway/config.pyactually reads) instead of the genericEMAIL_HOME_CHANNEL, via a per-platform override map.tests/tools/test_send_message_tool.py: 6 parse tests (@liuhao1024) + 2 error-hint tests (email namesEMAIL_HOME_ADDRESS, other platforms keep the generic hint).Validation
_parse_target_ref("email", "user@example.com")(None, None, False)→ home fallback("user@example.com", None, True)→ direct sendresolve_channel_name→ address)chat_id=None→ home fallbackchat_idset EMAIL_HOME_CHANNEL(never read)set EMAIL_HOME_ADDRESS(correct)telegram/slackwith@)129 tests in
test_send_message_tool.pypass; E2E-verified both the direct-email path and the corrected error string.Salvages #34748. Fixes #34740.
Infographic
Infographic