-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
iMessage: leading blank lines in streamed messages #5530
Copy link
Copy link
Closed as not planned
Labels
bugSomething isn't workingSomething isn't workingstaleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Bug
Messages sent via iMessage sometimes arrive with leading blank lines at the top.
Root Cause
In the block streaming path, emitBlockChunk (pi-embedded-subscribe.js) strips thinking tags and calls .trimEnd() but not .trim(). When Claude's response starts after a stripped thinking block, leading \n\n survives through the entire pipeline:
sanitizeUserFacingTextdoesn't trimnormalizeStreamingTextchecks.trim()for skip logic but returns untrimmed textdeliverReplies(iMessage monitor) never trimssendMessageIMessagepasses text straight through
Suggested Fix
Simplest targeted fix — in sendMessageIMessage (imessage/send.js), add .trim() after markdown table conversion:
message = convertMarkdownTables(message, tableMode);
message = message.trim(); // <-- add thisAlternatively, changing .trimEnd() to .trim() in emitBlockChunk would fix it for all channels.
Environment
- Clawdbot npm latest 2026.1.24-3
- iMessage channel via imsg-plus
- macOS 15.6 (arm64)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingstaleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Give feedbackNo fields configured for issues without a type.