Repository navigation
fix(mattermost): let buttons with Chinese, spaced or agent-callback values be clicked - #206228
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesThis PR derives alphanumeric Mattermost button action IDs while preserving original callback values in signed context. Example: An agent sends an Approve button with callback value approve.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR repairs a current Mattermost routing bug with a focused change and no introduced defects found; required hosted CI has not run. Reviewed head: Before merge
FindingsNone. Agent review detailsHow this fits togetherThe Mattermost plugin converts presentation buttons into posted attachments, then verifies incoming callbacks and dispatches the original values to the conversation. flowchart LR
A[Message action] --> B[Mattermost presentation]
B --> C[Attachment builder]
C --> D[Mattermost post]
D --> E[Action route]
E --> F[Verified callback]
F --> G[Agent conversation]
Technical reviewBest possible solution: Land the focused attachment-builder repair after required hosted checks pass, preserving signed callback values and existing-post handling. Do we have a high-confidence way to reproduce the issue? The current-main sanitizer and Mattermost's verified route establish the failure path, supported by supplied before/after transport logs; this read-only review did not execute the reproduction. Is this the best way to solve the issue? The change repairs the existing producer at the Mattermost encoding boundary, removes the old sanitizer, and preserves the original value independently of the routing ID. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eb0faf79a5be. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +22, Docs 0. Total +27 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 26, 2026, 6:43 PM ET / 23:43 UTC. |
Non-alphanumeric ids become <alphanumerics>x<index>, unique per post by construction. A raw alphanumeric id equal to a derived id fails the send instead of misrouting the click.
|
Live proof on throwaway Mattermost 11.7.15 (team edition) with an isolated Gateway built in Docker. Base:
|
|
Chromium as alice, clicking the Chinese-value button. Base (main): Mattermost shows "Sorry, we could not find the page." Fix: the click is accepted, the post shows "✓ B1 … selected by @alice", and the agent replies. |
A raw alphanumeric id equal to a derived id in one post is an accepted, unobserved edge case; name it in the doc comment instead.
|
Landed in be5d9a0. Mattermost buttons with Chinese text, spaces, punctuation or agent callback values can be clicked again: Mattermost gets a letters-and-digits action id, and the agent receives the exact original value. Signing, the click authorization and already-alphanumeric ids like the model picker are unchanged. Thanks @hannnnn-l for the report and the fix; we simplified the id scheme in one commit on top and kept yours. |
…alues be clicked (openclaw#206228) Root cause: extensions/mattermost/src/mattermost/interactions.ts:205 (on main) `sanitizeActionId` stripped only `-` and `_` from the button value it used as the Mattermost action id. Mattermost routes clicks only through `/posts/{post_id}/actions/{action_id:[A-Za-z0-9]+}`, so any other character returned 404 before OpenClaw saw the click. Fixes openclaw#206226 Thanks @hannnnn-l for the report and the fix. ## What Problem This Solves Clicking a Mattermost button opens "Page not found." when the button's value contains anything other than `[A-Za-z0-9]`, for example a Chinese value like `删掉说明和备注两条帖子,只留表` or one with spaces or punctuation. The click never reaches OpenClaw. Since openclaw#201764, every button the agent sends with the `message` tool breaks this way, even `approve`, because agent callback values carry the `::` mark and that mark ended up in the action id. The mark first shipped in v2026.11.10-beta.3 and v2026.11.10 (current `latest`). v2026.10.34 (`extended-stable`) and v2026.11.9 and earlier don't have it, so there only non-alphanumeric values break. Mattermost keeps the action id the post was created with (`server/channels/api4/integration_action.go`, v11.7.15). ## Why This Change Was Made `buildButtonAttachments` is the one place that turns a button id into the Mattermost action `id` and the signed `context.action_id`. - An id that is already `[A-Za-z0-9]+` is used unchanged, so the model picker and raw callers produce byte-identical posts. - Any other id becomes `<its alphanumerics, max 16>x<button index>`. The index after the last `x` makes derived ids unique within a post by construction, including two values that clean to the same text (`yes?` / `yes!`). - Accepted edge case, not observed: a raw alphanumeric id that equals a derived id in the same post would clash (Mattermost sends the click to the first action with that id). Agent, question and picker ids can't produce it. - The value itself still travels unchanged in the HMAC-signed `context.callback_data`, which is what the click delivers to the agent. Signing, the post-action match and the click authorization check are unchanged. The docs no longer say the value is used as the action id, and the 404 troubleshooting entry names the real cause. ## User Impact Buttons with any value work again, and the agent receives the exact original value. Posts already sent with broken ids stay broken and have to be re-sent. No config or migration is needed. ## Evidence - Regression test (`interactions.test.ts`): red on main (`expected '::删掉说明和备注两条帖子,只留表' to match /^[A-Za-z0-9]+$/`), green with the fix. - Live run against Mattermost 11.7.15 with an isolated Gateway built from main and from this head. A scripted model sends a buttons block through the real `message` tool, and user alice clicks through Mattermost's action route, twice per side: openclaw#206228 (comment) - Chromium screenshots: openclaw#206228 (comment) | Case | main | this PR | | --- | --- | --- | | Chinese value | 404 "Page not found", no Gateway log, no agent turn | 200, agent gets `删掉说明和备注两条帖子,只留表` | | Spaces/punctuation `yes, do it! (now)` | 404 | 200, agent gets the exact value | | Agent value `approve` (`::approve`) | 404 | 200, agent gets `approve` | | Model picker (`/oc_models`) | 200, id `mdllistb735d7f3f8da` | same id, 200 | | Tampered `callback_data` or `action_id` | 403 Invalid token | 403 Invalid token | Merge danger: two-way door. A revert restores the old ids. Nothing is stored and no config changes. Blast radius is Mattermost button posts. Co-authored-by: Ayaan Zaidi <[email protected]>
…alues be clicked (#206228) Root cause: extensions/mattermost/src/mattermost/interactions.ts:205 (on main) `sanitizeActionId` stripped only `-` and `_` from the button value it used as the Mattermost action id. Mattermost routes clicks only through `/posts/{post_id}/actions/{action_id:[A-Za-z0-9]+}`, so any other character returned 404 before OpenClaw saw the click. Fixes #206226 Thanks @hannnnn-l for the report and the fix. ## What Problem This Solves Clicking a Mattermost button opens "Page not found." when the button's value contains anything other than `[A-Za-z0-9]`, for example a Chinese value like `删掉说明和备注两条帖子,只留表` or one with spaces or punctuation. The click never reaches OpenClaw. Since #201764, every button the agent sends with the `message` tool breaks this way, even `approve`, because agent callback values carry the `::` mark and that mark ended up in the action id. The mark first shipped in v2026.11.10-beta.3 and v2026.11.10 (current `latest`). v2026.10.34 (`extended-stable`) and v2026.11.9 and earlier don't have it, so there only non-alphanumeric values break. Mattermost keeps the action id the post was created with (`server/channels/api4/integration_action.go`, v11.7.15). ## Why This Change Was Made `buildButtonAttachments` is the one place that turns a button id into the Mattermost action `id` and the signed `context.action_id`. - An id that is already `[A-Za-z0-9]+` is used unchanged, so the model picker and raw callers produce byte-identical posts. - Any other id becomes `<its alphanumerics, max 16>x<button index>`. The index after the last `x` makes derived ids unique within a post by construction, including two values that clean to the same text (`yes?` / `yes!`). - Accepted edge case, not observed: a raw alphanumeric id that equals a derived id in the same post would clash (Mattermost sends the click to the first action with that id). Agent, question and picker ids can't produce it. - The value itself still travels unchanged in the HMAC-signed `context.callback_data`, which is what the click delivers to the agent. Signing, the post-action match and the click authorization check are unchanged. The docs no longer say the value is used as the action id, and the 404 troubleshooting entry names the real cause. ## User Impact Buttons with any value work again, and the agent receives the exact original value. Posts already sent with broken ids stay broken and have to be re-sent. No config or migration is needed. ## Evidence - Regression test (`interactions.test.ts`): red on main (`expected '::删掉说明和备注两条帖子,只留表' to match /^[A-Za-z0-9]+$/`), green with the fix. - Live run against Mattermost 11.7.15 with an isolated Gateway built from main and from this head. A scripted model sends a buttons block through the real `message` tool, and user alice clicks through Mattermost's action route, twice per side: #206228 (comment) - Chromium screenshots: #206228 (comment) | Case | main | this PR | | --- | --- | --- | | Chinese value | 404 "Page not found", no Gateway log, no agent turn | 200, agent gets `删掉说明和备注两条帖子,只留表` | | Spaces/punctuation `yes, do it! (now)` | 404 | 200, agent gets the exact value | | Agent value `approve` (`::approve`) | 404 | 200, agent gets `approve` | | Model picker (`/oc_models`) | 200, id `mdllistb735d7f3f8da` | same id, 200 | | Tampered `callback_data` or `action_id` | 403 Invalid token | 403 Invalid token | Merge danger: two-way door. A revert restores the old ids. Nothing is stored and no config changes. Blast radius is Mattermost button posts. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit be5d9a0)
…alues be clicked (#206228) Root cause: extensions/mattermost/src/mattermost/interactions.ts:205 (on main) `sanitizeActionId` stripped only `-` and `_` from the button value it used as the Mattermost action id. Mattermost routes clicks only through `/posts/{post_id}/actions/{action_id:[A-Za-z0-9]+}`, so any other character returned 404 before OpenClaw saw the click. Fixes #206226 Thanks @hannnnn-l for the report and the fix. ## What Problem This Solves Clicking a Mattermost button opens "Page not found." when the button's value contains anything other than `[A-Za-z0-9]`, for example a Chinese value like `删掉说明和备注两条帖子,只留表` or one with spaces or punctuation. The click never reaches OpenClaw. Since #201764, every button the agent sends with the `message` tool breaks this way, even `approve`, because agent callback values carry the `::` mark and that mark ended up in the action id. The mark first shipped in v2026.11.10-beta.3 and v2026.11.10 (current `latest`). v2026.10.34 (`extended-stable`) and v2026.11.9 and earlier don't have it, so there only non-alphanumeric values break. Mattermost keeps the action id the post was created with (`server/channels/api4/integration_action.go`, v11.7.15). ## Why This Change Was Made `buildButtonAttachments` is the one place that turns a button id into the Mattermost action `id` and the signed `context.action_id`. - An id that is already `[A-Za-z0-9]+` is used unchanged, so the model picker and raw callers produce byte-identical posts. - Any other id becomes `<its alphanumerics, max 16>x<button index>`. The index after the last `x` makes derived ids unique within a post by construction, including two values that clean to the same text (`yes?` / `yes!`). - Accepted edge case, not observed: a raw alphanumeric id that equals a derived id in the same post would clash (Mattermost sends the click to the first action with that id). Agent, question and picker ids can't produce it. - The value itself still travels unchanged in the HMAC-signed `context.callback_data`, which is what the click delivers to the agent. Signing, the post-action match and the click authorization check are unchanged. The docs no longer say the value is used as the action id, and the 404 troubleshooting entry names the real cause. ## User Impact Buttons with any value work again, and the agent receives the exact original value. Posts already sent with broken ids stay broken and have to be re-sent. No config or migration is needed. ## Evidence - Regression test (`interactions.test.ts`): red on main (`expected '::删掉说明和备注两条帖子,只留表' to match /^[A-Za-z0-9]+$/`), green with the fix. - Live run against Mattermost 11.7.15 with an isolated Gateway built from main and from this head. A scripted model sends a buttons block through the real `message` tool, and user alice clicks through Mattermost's action route, twice per side: #206228 (comment) - Chromium screenshots: #206228 (comment) | Case | main | this PR | | --- | --- | --- | | Chinese value | 404 "Page not found", no Gateway log, no agent turn | 200, agent gets `删掉说明和备注两条帖子,只留表` | | Spaces/punctuation `yes, do it! (now)` | 404 | 200, agent gets the exact value | | Agent value `approve` (`::approve`) | 404 | 200, agent gets `approve` | | Model picker (`/oc_models`) | 200, id `mdllistb735d7f3f8da` | same id, 200 | | Tampered `callback_data` or `action_id` | 403 Invalid token | 403 Invalid token | Merge danger: two-way door. A revert restores the old ids. Nothing is stored and no config changes. Blast radius is Mattermost button posts. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit be5d9a0) Co-authored-by: RomneyDa <[email protected]>


Root cause: extensions/mattermost/src/mattermost/interactions.ts:205 (on main)
sanitizeActionIdstripped only-and_from the button value it used as the Mattermost action id. Mattermost routes clicks only through/posts/{post_id}/actions/{action_id:[A-Za-z0-9]+}, so any other character returned 404 before OpenClaw saw the click.Fixes #206226
Thanks @hannnnn-l for the report and the fix.
What Problem This Solves
Clicking a Mattermost button opens "Page not found." when the button's value contains anything other than
[A-Za-z0-9], for example a Chinese value like删掉说明和备注两条帖子,只留表or one with spaces or punctuation. The click never reaches OpenClaw. Since #201764, every button the agent sends with themessagetool breaks this way, evenapprove, because agent callback values carry the::mark and that mark ended up in the action id. The mark first shipped in v2026.11.10-beta.3 and v2026.11.10 (currentlatest). v2026.10.34 (extended-stable) and v2026.11.9 and earlier don't have it, so there only non-alphanumeric values break.Mattermost keeps the action id the post was created with (
server/channels/api4/integration_action.go, v11.7.15).Why This Change Was Made
buildButtonAttachmentsis the one place that turns a button id into the Mattermost actionidand the signedcontext.action_id.[A-Za-z0-9]+is used unchanged, so the model picker and raw callers produce byte-identical posts.<its alphanumerics, max 16>x<button index>. The index after the lastxmakes derived ids unique within a post by construction, including two values that clean to the same text (yes?/yes!).context.callback_data, which is what the click delivers to the agent. Signing, the post-action match and the click authorization check are unchanged.The docs no longer say the value is used as the action id, and the 404 troubleshooting entry names the real cause.
User Impact
Buttons with any value work again, and the agent receives the exact original value. Posts already sent with broken ids stay broken and have to be re-sent. No config or migration is needed.
Evidence
interactions.test.ts): red on main (expected '::删掉说明和备注两条帖子,只留表' to match /^[A-Za-z0-9]+$/), green with the fix.messagetool, and user alice clicks through Mattermost's action route, twice per side: fix(mattermost): let buttons with Chinese, spaced or agent-callback values be clicked #206228 (comment)删掉说明和备注两条帖子,只留表yes, do it! (now)approve(::approve)approve/oc_models)mdllistb735d7f3f8dacallback_dataoraction_idMerge danger: two-way door. A revert restores the old ids. Nothing is stored and no config changes. Blast radius is Mattermost button posts.