#9701: feat: handle Signal message edits with [edited] marker (#9656)
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
#23240: feat(telegram): Process inbound edited_message events
by GonzFC · 2026-02-22
77.8%
#8271: feat(signal): Add full quoted message context support
by ProofOfReach · 2026-02-03
77.6%
#9734: fix(telegram): correct sender identification for channel messages (...
by divol89 · 2026-02-05
76.5%
#7459: fix(signal): resolve mention placeholders to actual names
by gerigk-agent · 2026-02-02
76.0%
#15853: feat: add option to suppress media placeholder text
by MisterGuy420 · 2026-02-14
75.1%
#16483: feat(telegram): Process inbound edited_message events
by gabectl · 2026-02-14
74.7%
#21898: fix(telegram): auto-detect captionable messages for editMessageCaption
by ptrkstr · 2026-02-20
74.5%
#15914: feat: add messages.suppressMediaPlaceholders config option
by Shuai-DaiDai · 2026-02-14
74.2%
#14429: feat(bluebubbles): handle iMessage edit events in webhook
by westhechiang · 2026-02-12
73.9%
#9721: fix: heartbeat model override not working for per-agent config (#9556)
by divol89 · 2026-02-05
73.5%