-
-
Notifications
You must be signed in to change notification settings - Fork 53k
Description
Summary
stripInlineStatus() in src/auto-reply/reply/inline-status.ts unconditionally collapses all whitespace — including newlines — in every incoming message from authorized senders. This destroys paragraph structure before the message reaches the LLM.
Reproduction
- Send a multi-line Discord message (using Shift+Enter for line breaks) to an OpenClaw agent
- Check the session log — the message content has all
\ncharacters replaced with single spaces
Root Cause
function stripInlineStatus(body) {
const trimmed = body.trim();
if (!trimmed) return { cleaned: "", didStrip: false };
const cleaned = trimmed.replace(INLINE_STATUS_RE, " ").replace(/\s+/g, " ").trim();
return { cleaned, didStrip: cleaned !== trimmed };
}The .replace(/\s+/g, " ") matches \n, \r, \t, and all other whitespace characters, collapsing them into a single space. This runs unconditionally — even when the message contains no /status directive.
Impact
Any agent that needs to preserve the user's text formatting (journaling, note-taking, content recording) receives a wall of text instead of the user's intended paragraphs.
Suggested Fix
Replace /\s+/g with /[^\S\n]+/g to only collapse horizontal whitespace while preserving newlines:
const cleaned = trimmed.replace(INLINE_STATUS_RE, " ").replace(/[^\S\n]+/g, " ").trim();Alternatively, only apply the whitespace normalization when the status regex actually matched.
Environment
- OpenClaw version:
2026.2.19-2 - Platform: Discord
- Source file:
src/auto-reply/reply/inline-status.ts