fix(discord): mention user in approval/clarify prompts for notification ping - #47342
fix(discord): mention user in approval/clarify prompts for notification ping#47342nanobro wants to merge 1 commit into
Conversation
…on ping - Add user_mention parameter to Discord adapter send methods (send_exec_approval, send_slash_confirm, send_clarify, send_update_prompt) - Build <@user_id> mention in gateway callbacks for Discord platform only - Prepends mention to embed description so user gets native Discord ping - Adds howto doc for community sharing
teknium1
left a comment
There was a problem hiding this comment.
Thanks for targeting a real notification gap. Current main still defaults to no exec-approval mention and does not mention users for slash confirmations, clarify prompts, or update prompts.
Problems
- The new
user_mentionkeyword is passed from generic gateway paths ingateway/run.py:10713,:13986, and:14112, including non-Discord adapters. Current shared adapter contracts such asgateway/platforms/base.py:3076-3084do not accept it, so this can turn native prompt rendering into aTypeErrorfallback. - The adapter changes put mentions only in embed descriptions. Current main's accepted exec-mention implementation places the mention in plain message content and configures
AllowedMentions(plugins/platforms/discord/adapter.py:5609-5611,:5647-5657). The sibling prompts now also use content mirrors (:5691-5702,:5823-5827,:5864-5869), so the patch needs to target those paths. - No regression tests accompany the four changed send methods or the cross-platform gateway contract.
Suggested changes
- Keep the Discord-specific data out of generic adapter calls unless the common contract is intentionally extended and all implementations are covered.
- Build on the current content-mirror and opt-in mention mechanism, then add focused Discord and non-Discord dispatch tests.
Automated hermes-sweeper review.
| @@ -10708,6 +10713,7 @@ async def _request_slash_confirm( | |||
| session_key=session_key, | |||
There was a problem hiding this comment.
This call is generic: non-Discord adapters are invoked too, but their shared send_slash_confirm contract has no user_mention keyword (gateway/platforms/base.py:3076-3084). Passing it even as None can raise TypeError and discard the native-button path. Scope this argument to Discord or extend the contract consistently.
| # Embed description limit is 4096; message usually fits easily. | ||
| max_desc = 4088 | ||
| body = message if len(message) <= max_desc else message[: max_desc - 3] + "..." | ||
| if user_mention: |
There was a problem hiding this comment.
Current main sends interactive-prompt payloads in ordinary content as well as embeds, and its existing exec-approval mention path prepends the mention to that content with scoped AllowedMentions. Put the notification marker in the content mirror rather than only this embed description.
|
Thanks for identifying the exact four-prompt notification gap, @nanobro. I reproduced it in production and opened #82982 as a current-main successor after this branch remained conflicted and the July review feedback was unresolved. The new PR credits you as co-author, preserves this PR's scope, and builds on the merged opt-in content-mirror/AllowedMentions design from #60493. It also adds multiplex-profile isolation, exact owner-only AllowedMentions, a bounded large-allowlist path, focused regression coverage, and docs. Maintainers can use whichever contribution path they prefer. |
What
When Hermes needs user approval on Discord, it now mentions the user (
<@USER_ID>) so they get a native Discord notification ping instead of silently waiting in a thread.Problem
Approval/clarify prompts were sent into threads without any mention. Users would miss requests entirely because there was no notification.
Solution
Added
user_mentionparameter to 4 Discord adapter methods:send_exec_approval()— dangerous command approvalsend_slash_confirm()— expensive slash command confirmationsend_clarify()— agent clarification promptssend_update_prompt()— gateway update inputGateway builds
<@user_id>mention for Discord platform only (other platforms unaffected)Mention is prepended to embed description, triggering Discord's native ping
Files Changed
gateway/run.py_user_mentionin 3 callback functionsplugins/platforms/discord/adapter.pyuser_mentionin 4 send methodsdocs/howto-discord-approval-notify.mdTesting