Skip to content

fix(mattermost): edit_message rejects finalize kwarg after DingTalk AI Cards merge #12290

@imapotato123

Description

@imapotato123

Bug

After #10991 / commit 4459913f (DingTalk AI Cards), BasePlatformAdapter.edit_message() gained a finalize: bool = False keyword-only parameter, plumbed through stream_consumer.py. The DingTalk adapter was updated, but MattermostAdapter.edit_message() still has the old signature:

async def edit_message(self, chat_id: str, message_id: str, content: str) -> SendResult:

Python raises TypeError: edit_message() got an unexpected keyword argument 'finalize' on every streaming chunk, completely breaking progressive message editing for Mattermost. The error log fills with hundreds of identical lines per response.

Impact

  • All streaming edits fail, forcing fallback to new messages
  • Error log noise (hundreds of lines per response)
  • Potential threading/delivery issues from the fallback path

Fix

One-liner — accept and ignore the kwarg:

async def edit_message(self, chat_id: str, message_id: str, content: str, **kwargs: Any) -> SendResult:

Other adapters that override edit_message should be audited for the same issue.

Affected version

Current main (post-4459913f)

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp/gatewayGateway runner, session dispatch, deliveryplatform/dingtalkDingTalk adaptertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions