feat(mattermost): add edit and delete message actions#25295
feat(mattermost): add edit and delete message actions#25295Luna2026-a11y wants to merge 10 commits intoopenclaw:mainfrom
Conversation
| const message = | ||
| typeof (params as any)?.message === "string" | ||
| ? (params as any).message | ||
| : typeof (params as any)?.text === "string" | ||
| ? (params as any).text | ||
| : ""; | ||
| if (!message) { |
There was a problem hiding this comment.
empty message is allowed but might cause API errors
The code allows empty strings for the message parameter, but Mattermost API typically requires non-empty message text. If params.message or params.text is an empty string, it will pass the empty string check but could fail at the API level.
Compare with Discord (line 171 in src/channels/plugins/actions/discord/handle-action.ts): requires message with required: true
Compare with Telegram (line 161 in src/channels/plugins/actions/telegram.ts): requires message with required: true, allowEmpty: false
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/mattermost/src/channel.ts
Line: 74-80
Comment:
empty message is allowed but might cause API errors
The code allows empty strings for the `message` parameter, but Mattermost API typically requires non-empty message text. If `params.message` or `params.text` is an empty string, it will pass the empty string check but could fail at the API level.
Compare with Discord (line 171 in `src/channels/plugins/actions/discord/handle-action.ts`): requires message with `required: true`
Compare with Telegram (line 161 in `src/channels/plugins/actions/telegram.ts`): requires message with `required: true, allowEmpty: false`
How can I resolve this? If you propose a fix, please make it concise.|
This pull request has been automatically marked as stale due to inactivity. |
6350dbd to
b5650e4
Compare
b5650e4 to
3e7598c
Compare
54075f1 to
4ec6fb5
Compare
4ec6fb5 to
bb067c0
Compare
Add patchMattermostPost() and deleteMattermostPost() to the Mattermost
client, and wire them as 'edit' and 'delete' actions in the channel
plugin's message action adapter.
This enables:
- Editing bot messages via the message tool (action=edit)
- Deleting bot messages via the message tool (action=delete)
- Foundation for block-streaming edit-in-place (progressive message
rendering like Telegram/Discord)
Uses PATCH /api/v4/posts/{post_id}/patch for edits and
DELETE /api/v4/posts/{post_id} for deletions.
Tested against a live Mattermost 10.x instance.
bb067c0 to
69b8aef
Compare
|
Codex review: needs maintainer review before merge. What this changes: The PR branch adds Mattermost edit/delete message action support and client helpers, plus tests/docs/changelog, while also carrying unrelated provider-usage, plugin-loader, and bonjour test/infra changes. Maintainer follow-up before merge: Maintainer should decide whether to ask for a narrowed branch or replacement PR because this open implementation adds destructive message deletion and carries unrelated infra/test changes; it is not a safe autonomous fix lane as submitted. Best possible solution: Land a narrowed Mattermost-only implementation that exposes edit/delete via the channel message action adapter, uses plugin-SDK or local Mattermost helpers, validates account/target/post id and non-empty edit text, updates public CLI and Mattermost docs, and adds focused Mattermost client/action tests without unrelated infra changes. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 2d53b49b20e1. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Codex review: found issues before merge. Summary Reproducibility: yes. for the PR defects by source inspection: the new action paths import a core internal and create Mattermost clients without forwarding the account private-network opt-in. Current main inspection also confirms the requested edit/delete action surface is still absent. Next step before merge Security Review findings
Review detailsBest possible solution: Land a narrowed Mattermost-only implementation that exposes edit/delete through the channel action adapter, reuses the current helper/runtime surface, preserves private-network opt-in, uses SDK exports, and updates focused tests/docs/changelog only. Do we have a high-confidence way to reproduce the issue? Yes, for the PR defects by source inspection: the new action paths import a core internal and create Mattermost clients without forwarding the account private-network opt-in. Current main inspection also confirms the requested edit/delete action surface is still absent. Is this the best way to solve the issue? No. The feature direction is plausible, but the submitted patch is not the best implementation because it should be narrowed, rebased onto the current Mattermost helpers, preserve SSRF policy config, and stay within plugin SDK boundaries. Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 58c4f9e190bc. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
Summary
Adds
patchMattermostPost()anddeleteMattermostPost()to the Mattermost client, and wires them aseditanddeleteactions in the channel plugin message action adapter.What this enables
action=edit) — foundation for block-streaming edit-in-place (progressive message rendering like Telegram/Discord)action=delete)API endpoints used
PUT /api/v4/posts/{post_id}/patch(partial update)DELETE /api/v4/posts/{post_id}Files changed
extensions/mattermost/src/mattermost/client.ts— addpatchMattermostPost()anddeleteMattermostPost()extensions/mattermost/src/channel.ts— registereditanddeleteinlistActions,supportsAction, andhandleActionTesting
edit_post/delete_postpermissions (standard bot permissions)Notes
This is a stepping stone toward full block-streaming support on Mattermost, bringing it closer to feature parity with the Telegram and Discord plugins.
Greptile Summary
Added edit and delete message functionality to the Mattermost plugin by implementing
patchMattermostPost()anddeleteMattermostPost()in the client, and wiring them through the channel message action adapter.Changes:
patchMattermostPost()function supporting partial updates (message, props, fileIds)deleteMattermostPost()function for post deletioneditanddeleteactions inlistActions()andsupportsAction()PUT /posts/{id}/patch,DELETE /posts/{id})Architecture:
reactaction handler (account resolution, validation, error handling)messageIdandpostIdparameter names for flexibilityThe implementation is straightforward and brings Mattermost closer to feature parity with Telegram and Discord plugins.
Confidence Score: 4/5
Last reviewed commit: e3df5fa
(2/5) Greptile learns from your feedback when you react with thumbs up/down!