edit_message missing finalize kwarg across platform adapters

NousResearch/hermes-agent · cluster 12290 · gateway

Data as of

Nothing open on GitHub. Fix merged in #12854. Check it covers your case.

The short answer

0open issues
0open PRs
6items grouped
Known?
Yes. 6 related items grouped here, 3 issues already closed.
Fix event
A fix was merged to main in PR #12854. Check it covers your case. No release data is tracked.
Tracker
The maintainers' tracker marks this partially resolved, deciding PR #12854. That is separate from the fix event.
Still open
Nothing open on GitHub.

Multiple platform adapters (WhatsApp, Telegram, Discord, Slack, Matrix, Mattermost) do not accept a 'finalize' keyword argument in their edit_message implementations. Issues and fixes address adding this missing parameter consistently across all adapters.

Open issues0

No open issues.

Open PRs0

No open pull requests.

Fixes on record

Merged to main. A stamp counts the issues a fix is linked to.

  • #12854 fix(gateway): accept finalize kwarg in all platform edit_message overrides

    merged to main

    files: gateway/platforms/discord.py, gateway/platforms/feishu.py, gateway/platforms/matrix.py, gateway/platforms/mattermost.py, gateway/platforms/slack.py, gateway/platforms/telegram.py, gateway/platforms/whatsapp.py, scripts/release.py, tests/gateway/test_stream_consumer.py

    Show the diff
    • gateway/platforms/discord.py
      @@ -1081,6 +1081,8 @@ async def edit_message(
               chat_id: str,
               message_id: str,
               content: str,
      +        *,
      +        finalize: bool = False,
           ) -> SendResult:
               """Edit a previously sent Discord message."""
               if not self._client:
    • gateway/platforms/feishu.py
      @@ -1468,6 +1468,8 @@ async def edit_message(
               chat_id: str,
               message_id: str,
               content: str,
      +        *,
      +        finalize: bool = False,
           ) -> SendResult:
               """Edit a previously sent Feishu text/post message."""
               if not self._client:
    • gateway/platforms/matrix.py
      @@ -825,7 +825,7 @@ async def stop_typing(self, chat_id: str) -> None:
       
       
           async def edit_message(
      -        self, chat_id: str, message_id: str, content: str
      +        self, chat_id: str, message_id: str, content: str, *, finalize: bool = False
           ) -> SendResult:
               """Edit an existing message (via m.replace)."""
       
    • gateway/platforms/mattermost.py
      @@ -304,7 +304,7 @@ async def send_typing(
               )
       
           async def edit_message(
      -        self, chat_id: str, message_id: str, content: str
      +        self, chat_id: str, message_id: str, content: str, *, finalize: bool = False
           ) -> SendResult:
               """Edit an existing post."""
               formatted = self.format_message(content)
    • gateway/platforms/slack.py
      @@ -316,6 +316,8 @@ async def edit_message(
               chat_id: str,
               message_id: str,
               content: str,
      +        *,
      +        finalize: bool = False,
           ) -> SendResult:
               """Edit a previously sent Slack message."""
               if not self._app:
    • gateway/platforms/telegram.py
      @@ -1081,6 +1081,8 @@ async def edit_message(
               chat_id: str,
               message_id: str,
               content: str,
      +        *,
      +        finalize: bool = False,
           ) -> SendResult:
               """Edit a previously sent Telegram message."""
               if not self._bot:
    • gateway/platforms/whatsapp.py
      @@ -655,6 +655,8 @@ async def edit_message(
               chat_id: str,
               message_id: str,
               content: str,
      +        *,
      +        finalize: bool = False,
           ) -> SendResult:
               """Edit a previously sent message via the WhatsApp bridge."""
               if not self._running or not self._http_session:
    • scripts/release.py
      @@ -219,6 +219,7 @@
           "[redacted:email]": "iacker",
           "[redacted:email]": "sontianye",
           "[redacted:email]": "jackjin1997",
      +    "[redacted:email]": "jackjin1997",
           "[redacted:email]": "danieldoderlein",
           "[redacted:email]": "lrawnsley",
           "[redacted:email]": "taeuk178",
    • tests/gateway/test_stream_consumer.py
      @@ -133,6 +133,43 @@ async def test_identical_text_skip_respects_adapter_flag(self):
               assert picky.edit_message.call_args[1]["finalize"] is True
       
       
      +class TestEditMessageFinalizeSignature:
      +    """Every concrete platform adapter must accept the ``finalize`` kwarg.
      +
      +    stream_consumer._send_or_edit always passes ``finalize=`` to
      +    ``adapter.edit_message(...)`` (see gateway/stream_consumer.py).  An
      +    adapter that overrides edit_message without accepting finalize raises
      +    TypeError the first time streaming hits a segment break or final edit.
      +    Guard the contract with an explicit signature check so it cannot
      +    silently regress — existing tests use MagicMock which swallows any
      +    kwarg and cannot catch this.
      +    """
      +
      +    @pytest.mark.parametrize(
      +        "module_path,class_name",
      +        [
      +            ("gateway.platforms.telegram", "TelegramAdapter"),
      +            ("gateway.platforms.discord", "DiscordAdapter"),
      +            ("gateway.platforms.slack", "SlackAdapter"),
      +            ("gateway.platforms.matrix", "MatrixAdapter"),
      +            ("gateway.platforms.mattermost", "MattermostAdapter"),
      +            ("gateway.platforms.feishu", "FeishuAdapter"),
      +            ("gateway.platforms.whatsapp", "WhatsAppAdapter"),
      +            ("gateway.platforms.dingtalk", "DingTalkAdapter"),
      +        ],
      +    )
      +    def test_edit_message_accepts_finalize(self, module_path, class_name):
      +        import inspect
      +
      +        module = pytest.importorskip(module_path)
      +        cls = getattr(module, class_name)
      +        params = inspect.signature(cls.edit_message).parameters
      +        assert "finalize" in params, (
      +            f"{class_name}.edit_message must accept 'finalize' kwarg; "
      +            f"stream_consumer._send_or_edit passes it unconditionally"
      +        )
      +
      +
       class TestSendOrEditMediaStripping:
           """Verify _send_or_edit strips MEDIA: before sending to the platform."""
       

2 PRs closed without merging

From the close comments: merged via another change 1 · superseded by another PR 1

  • #12601 fix(gateway): accept finalize kwarg in all platform edit_message overrides · merged via another change → #12854
  • #12828 fix(gateway): add missing finalize parameter to edit_message in all platform adapters · superseded by another PR → #12854, #12601
Closed issues · 3
  • Closed#12290fix(mattermost): edit_message rejects finalize kwarg after DingTalk AI Cards merge
  • Closed#12579edit_message missing finalize parameter in Telegram/Discord/Slack/Matrix adapters
  • Closed#12925WhatsApp streaming broken in v0.10.0: edit_message() rejects 'finalize' kwarg
How this cluster was grouped
  • Link evidence (partly structural links): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
  • Members outside that structural core may belong to a different underlying problem.
  • Pairwise link density 0.27: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. 1.00 means every pair is linked.

Pick up a Lab task

Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.

Open the Lab

At a glance

Subsystem
gateway
Merged PRs
#12854
Closed issues
3
Attempts
2 PRs closed without merging
Fix link checked
20 Apr 2026. This confirmation is old and may be out of date (a revert or reopen would not have invalidated it here); re-verify.

For your agent

The same facts, typed.