mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-10 04:08:28 +08:00
fix: escape command content in Telegram exec approval prompt
Switch from fragile Markdown V1 to HTML parse mode with html.escape() for exec approval messages. Add fallback to text-based approval when the formatted send fails. Cherry-picked from #10999 by @danieldoderlein.
This commit is contained in:
@@ -8816,7 +8816,7 @@ class GatewayRunner:
|
||||
# false positives from MagicMock auto-attribute creation in tests.
|
||||
if getattr(type(_status_adapter), "send_exec_approval", None) is not None:
|
||||
try:
|
||||
asyncio.run_coroutine_threadsafe(
|
||||
_approval_result = asyncio.run_coroutine_threadsafe(
|
||||
_status_adapter.send_exec_approval(
|
||||
chat_id=_status_chat_id,
|
||||
command=cmd,
|
||||
@@ -8826,7 +8826,12 @@ class GatewayRunner:
|
||||
),
|
||||
_loop_for_step,
|
||||
).result(timeout=15)
|
||||
return
|
||||
if _approval_result.success:
|
||||
return
|
||||
logger.warning(
|
||||
"Button-based approval failed (send returned error), falling back to text: %s",
|
||||
_approval_result.error,
|
||||
)
|
||||
except Exception as _e:
|
||||
logger.warning(
|
||||
"Button-based approval failed, falling back to text: %s", _e
|
||||
|
||||
Reference in New Issue
Block a user