fix(mattermost): preserve markdown formatting and native tables#18655
Merged
mukhtharcm merged 7 commits intoopenclaw:mainfrom Mar 10, 2026
Merged
fix(mattermost): preserve markdown formatting and native tables#18655mukhtharcm merged 7 commits intoopenclaw:mainfrom
mukhtharcm merged 7 commits intoopenclaw:mainfrom
Conversation
added 3 commits
February 16, 2026 18:18
… natively Three related bugs in the Mattermost channel plugin: 1. normalizeMention() used \s+ replacement which collapsed newlines into spaces, destroying all block-level Markdown (headings, lists, blockquotes, task lists) in inbound messages. Fixed to only collapse horizontal whitespace (spaces/tabs) while preserving newlines. 2. DEFAULT_TABLE_MODES did not include mattermost, so it fell through to the "code" default which wraps tables in fenced code blocks. Mattermost clients render pipe tables natively, so the correct default is "off". 3. When tableMode was "code" and a message contained tables, the entire text was re-rendered through the IR pipeline which also stripped block formatting from non-table content. Also extracted normalizeMention to monitor-helpers.ts for testability and added unit tests for both fixes. Fixes: openclaw#12247, openclaw#12245, openclaw#12238
…eedback) Replaced blanket horizontal-whitespace collapse with a line-by-line approach that only collapses runs of multiple spaces after non-space characters, preserving leading indentation for nested lists and code blocks.
…of source text Address review feedback: replace brittle fs.readFileSync source inspection with direct import of the exported map.
Contributor
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
10 tasks
Member
|
Merged via squash.
Thanks @echo931! |
mrosmarin
added a commit
to mrosmarin/openclaw
that referenced
this pull request
Mar 10, 2026
* main: (43 commits) docs: add openclaw#42173 to CHANGELOG — strip leaked model control tokens (openclaw#42216) Agents: align onPayload callback and OAuth imports docs: add Tengji (George) Zhang to maintainer table (openclaw#42190) fix: strip leaked model control tokens from user-facing text (openclaw#42173) Changelog: add unreleased March 9 entries chore: add .dev-state to .gitignore (openclaw#41848) fix(agents): avoid duplicate same-provider cooldown probes in fallback runs (openclaw#41711) fix(mattermost): preserve markdown formatting and native tables (openclaw#18655) feat(acp): add resumeSessionId to sessions_spawn for ACP session resume (openclaw#41847) ACPX: bump bundled acpx to 0.1.16 (openclaw#41975) mattermost: fix DM media upload for unprefixed user IDs (openclaw#29925) fix(msteams): use General channel conversation ID as team key for Bot Framework compatibility (openclaw#41838) fix(mattermost): read replyTo param in plugin handleAction send (openclaw#41176) fix(sandbox): pass real workspace to sessions_spawn when workspaceAccess is ro (openclaw#40757) fix(ui): replace Manual RPC text input with sorted method dropdown (openclaw#14967) CI: select Swift 6.2 toolchain for CodeQL (openclaw#41787) fix(agents): forward memory flush write path (openclaw#41761) fix(telegram): move network fallback to resolver-scoped dispatchers (openclaw#40740) fix(security): harden replaceMarkers() to catch space/underscore boundary marker variants (openclaw#35983) fix(web-search): recover OpenRouter Perplexity citations from message annotations (openclaw#40881) ...
4 tasks
Moshiii
pushed a commit
to Moshiii/openclaw
that referenced
this pull request
Mar 11, 2026
…claw#18655) Merged via squash. Prepared head SHA: d30fff1 Co-authored-by: echo931 <259437483+echo931@users.noreply.github.com> Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com> Reviewed-by: @mukhtharcm
Moshiii
pushed a commit
to Moshiii/openclaw
that referenced
this pull request
Mar 11, 2026
…claw#18655) Merged via squash. Prepared head SHA: d30fff1 Co-authored-by: echo931 <259437483+echo931@users.noreply.github.com> Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com> Reviewed-by: @mukhtharcm
frankekn
pushed a commit
to MoerAI/openclaw
that referenced
this pull request
Mar 11, 2026
…claw#18655) Merged via squash. Prepared head SHA: d30fff1 Co-authored-by: echo931 <259437483+echo931@users.noreply.github.com> Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com> Reviewed-by: @mukhtharcm
frankekn
pushed a commit
to Effet/openclaw
that referenced
this pull request
Mar 11, 2026
…claw#18655) Merged via squash. Prepared head SHA: d30fff1 Co-authored-by: echo931 <259437483+echo931@users.noreply.github.com> Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com> Reviewed-by: @mukhtharcm
frankekn
pushed a commit
to ImLukeF/openclaw
that referenced
this pull request
Mar 11, 2026
…claw#18655) Merged via squash. Prepared head SHA: d30fff1 Co-authored-by: echo931 <259437483+echo931@users.noreply.github.com> Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com> Reviewed-by: @mukhtharcm
dominicnunez
pushed a commit
to dominicnunez/openclaw
that referenced
this pull request
Mar 11, 2026
…claw#18655) Merged via squash. Prepared head SHA: d30fff1 Co-authored-by: echo931 <259437483+echo931@users.noreply.github.com> Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com> Reviewed-by: @mukhtharcm
dhoman
pushed a commit
to dhoman/chrono-claw
that referenced
this pull request
Mar 11, 2026
…claw#18655) Merged via squash. Prepared head SHA: d30fff1 Co-authored-by: echo931 <259437483+echo931@users.noreply.github.com> Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com> Reviewed-by: @mukhtharcm
ahelpercn
pushed a commit
to ahelpercn/openclaw
that referenced
this pull request
Mar 12, 2026
…claw#18655) Merged via squash. Prepared head SHA: d30fff1 Co-authored-by: echo931 <259437483+echo931@users.noreply.github.com> Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com> Reviewed-by: @mukhtharcm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refresh of the old markdown/table work from stale PR #12809 onto current
main.This keeps Mattermost message formatting intact by preserving block-level markdown structure when removing mentions, and restores native table rendering behavior.
Changes
normalizeMention)DEFAULT_TABLE_MODESand assert runtime table-mode behavior via testsValidation
pnpm exec vitest run extensions/mattermost/src/mattermost/monitor-helpers.test.ts src/config/markdown-tables.test.tsCloses #12238
Refs #12245
Greptile Summary
Refreshed markdown formatting preservation work from stale PR #12809. The changes ensure Mattermost messages maintain block-level markdown structure when removing bot mentions, and restore native table rendering by setting the default table mode to
offfor Mattermost.Key Changes:
normalizeMentionto preserve leading indentation, newlines, and markdown formatting (headings, lists, blockquotes, code blocks) when stripping bot mentionsDEFAULT_TABLE_MODESconstant to enable testingDEFAULT_TABLE_MODESmap withoffmode to render tables nativelyThe implementation properly handles markdown structure preservation by replacing mentions with empty strings (avoiding space injection) and only collapsing multiple spaces within lines while preserving leading indentation.
Confidence Score: 5/5
normalizeMentionrefactor properly preserves markdown structure using a clear multi-step approach. The regex escaping is correct and matches existing patterns in the codebase. The table mode change is a simple configuration update with test coverage. The PR has excellent test coverage including edge cases for nested lists, code blocks, and various markdown formats.Last reviewed commit: ae2824f