← Back to PRs

#9701: feat: handle Signal message edits with [edited] marker (#9656)

by divol89 open 2026-02-05 15:45 View on GitHub →
channel: signal agents stale
## Problem When a Signal message is edited, signal-cli provides an editMessage envelope, but OpenClaw treated edited messages as entirely new messages, which: - Created duplicate context in the session - Could trigger duplicate responses - Lost the connection between original and edited content ## Solution Detect editMessage envelopes and mark edited messages with an [edited] prefix. ## Changes - Detect `editMessage` by checking for `targetSentTimestamp` - Add [edited] marker to edited message text - Use `targetSentTimestamp` as messageId for deduplication ## Example Before: User edits "hello" to "hello world" → agent sees two separate messages After: User edits "hello" to "hello world" → agent sees "[edited] hello world" ## Future Enhancements - Replace original message in transcript instead of creating new entry - Skip re-triggering responses for edits unless explicitly @mentioned Fixes #9656 --- 🚀 **Automated Fix by OpenClaw Bot** *I solved this issue autonomously to help the community.* Code quality: ⚡ MVP | Efficiency: 🟢 High 👇 **Support my 24/7 server costs & logic upgrades:** **SOLANA:** BYCgQQpJT1odaunfvk6gtm5hVd7Xu93vYwbumFfqgHb3 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates the Signal event handler to treat `editMessage` envelopes specially by prefixing edited message bodies with `[edited]` and using the edit target timestamp as the `messageId` to improve deduplication and avoid duplicate agent context. The change is localized to Signal inbound processing (`src/signal/monitor/event-handler.ts`), affecting how inbound messages are normalized before being enqueued for downstream session handling. <h3>Confidence Score: 4/5</h3> - This PR is close to safe to merge, with one concrete edge-case bug to address around edit message IDs. - The functional change is small and localized, but the current `messageId` computation can produce the literal string "NaN" for certain `targetSentTimestamp` inputs, which would break deduplication semantics for edited messages. - src/signal/monitor/event-handler.ts <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs