hermes - 💡(How to fix) Fix feat: add "edit" action to send_message tool for in-place message updates

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…

Error Message

  • For unsupported platforms: return {"success": False, "error": "Platform 'xxx' does not support message editing"} — agent can then fall back to sending a new message

Fix Action

Fix / Workaround

Dispatch logic

  • New dedicated edit_message tool: More explicit, but adds tool count and schema size. Since send_message already handles cross-platform messaging, extending it with an edit action is more cohesive.
  • Agent-side workaround via terminal/curl: Possible but fragile — requires platform-specific API knowledge and credentials handling that the adapter already abstracts away.

Code Example

send_message(action="edit", target="feishu:oc_xxx", message_id="om_xxx", message="updated content")

---

# In the action enum, add "edit":
"action": {"enum": ["send", "list", "edit"], "default": "send"}

# Add message_id parameter (required when action="edit", ignored otherwise):
"message_id": {"type": "string", "description": "Message ID to edit (required for action='edit')"}

---

def send_message_tool(args, **kw):
    action = args.get("action", "send")
    if action == "list":
        return _handle_list()
    if action == "edit":
        return _handle_edit(args)  # new
    return _handle_send(args)

---

# Step 1: send initial message
   result = send_message(action="send", target="feishu:oc_xxx", message="⏳ Processing...")
   msg_id = result["message_id"]

   # Step 2: update in place when done
   send_message(action="edit", target="feishu:oc_xxx", message_id=msg_id, message="✅ Done! Results: ...")
RAW_BUFFERClick to expand / collapse

Problem / Use Case

Currently, the send_message tool only supports two actions: send and list. When the agent needs to update information it previously sent (e.g., progress tracking, live status, iterative results), it must send a new message each time, which floods the chat and degrades UX — especially on platforms like Feishu, Telegram, and Discord where editing messages in place is natively supported.

Users on Feishu have specifically requested this: the platform supports message editing natively, and other bots (e.g., CI/CD notifications, task trackers) commonly use in-place updates to keep chats clean.

Current State

The infrastructure is already in place:

  • Base class defines a unified interface: BasePlatformAdapter.edit_message(chat_id, message_id, content, *, finalize=False) -> SendResult
  • 8 major platforms already implement it: Telegram, Discord, Slack, Feishu, Matrix, WhatsApp, Mattermost, DingTalk
  • Gateway internals already use edit_message for streaming/tool-progress updates on these platforms
  • Platforms that don't support editing (Signal, SMS, Email, etc.) return success=False by default — graceful degradation is built in

The only missing piece is exposing this capability through the send_message tool.

Proposed Design

Add an edit action to the send_message tool:

send_message(action="edit", target="feishu:oc_xxx", message_id="om_xxx", message="updated content")

Tool schema changes

# In the action enum, add "edit":
"action": {"enum": ["send", "list", "edit"], "default": "send"}

# Add message_id parameter (required when action="edit", ignored otherwise):
"message_id": {"type": "string", "description": "Message ID to edit (required for action='edit')"}

Dispatch logic

def send_message_tool(args, **kw):
    action = args.get("action", "send")
    if action == "list":
        return _handle_list()
    if action == "edit":
        return _handle_edit(args)  # new
    return _handle_send(args)

_handle_edit implementation

  • Parse targetplatform_name, chat_id
  • Parse message_id
  • Load gateway config + platform adapter
  • Call adapter.edit_message(chat_id, message_id, content)
  • For unsupported platforms: return {"success": False, "error": "Platform 'xxx' does not support message editing"} — agent can then fall back to sending a new message

Considerations

  1. message_id availability: send_message(action="send") already returns message_id in its response. The agent can capture and reuse it for subsequent edits. No changes needed on the send side.

  2. Cross-platform consistency: The base class already handles the success=False fallback for unsupported platforms. The tool just needs to surface this to the agent.

  3. Streaming/progress pattern: This enables a common pattern — send an initial message, then edit it as work progresses. Example:

    # Step 1: send initial message
    result = send_message(action="send", target="feishu:oc_xxx", message="⏳ Processing...")
    msg_id = result["message_id"]
    
    # Step 2: update in place when done
    send_message(action="edit", target="feishu:oc_xxx", message_id=msg_id, message="✅ Done! Results: ...")
  4. No breaking changes: Existing send and list behavior is untouched. The edit action is purely additive.

Alternatives Considered

  • New dedicated edit_message tool: More explicit, but adds tool count and schema size. Since send_message already handles cross-platform messaging, extending it with an edit action is more cohesive.
  • Agent-side workaround via terminal/curl: Possible but fragile — requires platform-specific API knowledge and credentials handling that the adapter already abstracts away.

Related Issues

  • #5016 — In-session user progress updates (complementary; this is the editing primitive that enables clean progress UX)
  • #15311 — Generic action buttons / inline keyboard (mentions editing original message to reflect button selection)

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