fix(imessage): only strip standalone role-turn markers, not prose ending in a role word#96392
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 25, 2026, 3:59 AM ET / 07:59 UTC. Summary PR surface: Source +2, Tests +9. Total +11 across 2 files. Reproducibility: yes. Source inspection plus a read-only regex probe show current main truncates prose ending in Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the narrow regex anchoring fix after ordinary maintainer review and required checks; no broader sanitizer refactor is needed for this bug. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection plus a read-only regex probe show current main truncates prose ending in Is this the best way to solve the issue? Yes. Anchoring the role marker to a standalone line is the narrowest maintainable fix; removing the stripper would regress the existing internal-scaffolding guard, and moving this into the shared SDK sanitizer would be broader than the iMessage-only false positive requires. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 793b604b2377. Label changesLabel justifications:
Evidence reviewedPR surface: Source +2, Tests +9. Total +11 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
…ing in a role word ROLE_TURN_MARKER_RE anchored only the end of the line (\b...:\s*$), so any outbound line that merely ended with 'user:'/'system:'/'assistant:' was truncated — e.g. 'Please send this reply to the user:' lost its last word. Anchor the marker to the whole line so only a standalone leaked turn marker (its own line) is stripped; standalone-marker behavior is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
24002d5 to
fef7f3b
Compare
|
Merged via squash.
|
…ing in a role word (openclaw#96392) ROLE_TURN_MARKER_RE anchored only the end of the line (\b...:\s*$), so any outbound line that merely ended with 'user:'/'system:'/'assistant:' was truncated — e.g. 'Please send this reply to the user:' lost its last word. Anchor the marker to the whole line so only a standalone leaked turn marker (its own line) is stripped; standalone-marker behavior is unchanged. Co-authored-by: ly-wang19 <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
…ing in a role word (openclaw#96392) ROLE_TURN_MARKER_RE anchored only the end of the line (\b...:\s*$), so any outbound line that merely ended with 'user:'/'system:'/'assistant:' was truncated — e.g. 'Please send this reply to the user:' lost its last word. Anchor the marker to the whole line so only a standalone leaked turn marker (its own line) is stripped; standalone-marker behavior is unchanged. Co-authored-by: ly-wang19 <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
What Problem This Solves
sanitizeOutboundText(extensions/imessage/src/monitor/sanitize-outbound.ts) strips leaked assistant turn-boundary markers (a standaloneassistant:/user:/system:on its own line). ButROLE_TURN_MARKER_REonly anchored the end of the line:So any ordinary outbound line that merely ends with one of those words + a colon was truncated before delivery to iMessage:
sanitizeOutboundTextis on the live iMessage delivery path (channel.ts:339sanitizeText,monitor/deliver.ts), so this silently drops words from real replies.Fix
Anchor the marker to the whole line so only a standalone leaked marker is stripped, never a word inside prose:
The intended behavior (stripping a standalone
assistant:/user:line) is unchanged.Evidence
Added a regression test; verified by running the regex pipeline:
Standalone-marker stripping is preserved (existing test stays green); only prose lines that happen to end with the marker word are now left intact.