Files
openclaw/extensions/imessage/src
Harjoth Khara 41051fe37c fix(imessage): keep fenced role-marker mapping keys out of the outbound stripper (#117159)
* fix(imessage): stop the outbound sanitizer deleting fenced role keys

sanitizeOutboundText strips standalone `user:`/`system:`/`assistant:`
lines (leaked turn boundaries), `#+#` separators and `assistant to=`
markers, but the three regexes had no code-fence awareness. A bare YAML
mapping key like `user:` on its own line inside a ```yaml block matched
ROLE_TURN_MARKER_RE and was silently deleted before iMessage delivery,
reparenting its children under the wrong node — still-valid YAML, wrong
meaning, and nothing signalling a line was removed.

Skip matches whose offset falls inside a markdown code region for all
three patterns, reusing findCodeRegions/isInsideCode already applied by
the sibling reflection-guard on this channel. Regions are recomputed per
pass because each strip shifts later offsets. Leaked markers in prose are
still stripped.

Refs: #116942

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(imessage): cover code-aware marker stripping

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-08-01 16:52:47 +08:00
..