Skip to content

fix(signal): handle Note to Self messages with echo-back protection#2156

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6757a563
Mar 20, 2026
Merged

fix(signal): handle Note to Self messages with echo-back protection#2156
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6757a563

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Salvage of #2115 by @Stonelinks with added echo-back protection modeled after the WhatsApp bridge.

Problem

Signal's "Note to Self" messages (sent to your own account) arrive as syncMessage.sentMessage envelopes, which were unconditionally filtered out. In single-number setups where signal-cli is linked as a secondary device, this was the only way to interact with the bot.

What changed

Note to Self detection: syncMessage.sentMessage envelopes addressed to the bot's own account are now promoted to dataMessage for normal processing. Other sync events (read receipts, typing indicators) are still filtered.

Echo-back protection (new vs #2115): Mirrors the WhatsApp bridge's recentlySentIds pattern:

  • _recent_sent_timestamps — bounded set (50) tracks timestamps of messages the bot sends
  • _track_sent_timestamp() — called from send(), send_image(), send_document()
  • When a Note to Self sync arrives, its timestamp is checked against the set — matches are recognized as echo-backs of the bot's own replies and filtered

The original PR #2115 bypassed the self-message filter entirely for Note to Self with no echo-back prevention, creating a loop risk if signal-cli ever received a sync of its own sends.

Test plan

python -m pytest tests/gateway/ -n0 -q   # 1211 passed
python -m pytest tests/ -n0 -q           # 5524 passed

Attribution

Based on PR #2115 by @Stonelinks.

Test added 2 commits March 20, 2026 04:46
Support Signal 'Note to Self' messages in single-number setups where
signal-cli is linked as a secondary device on the user's own account.

syncMessage.sentMessage envelopes addressed to the bot's own account
are now promoted to dataMessage for normal processing, while other
sync events (read receipts, typing, etc.) are still filtered.

Echo-back prevention mirrors the WhatsApp bridge pattern:
- Track timestamps of recently sent messages (bounded set of 50)
- When a Note to Self sync arrives, check if its timestamp matches
  a recent outbound — skip if so (agent echo-back)
- Only process sync messages that are genuinely user-initiated

Based on PR #2115 by @Stonelinks with added echo-back protection.
@teknium1 teknium1 merged commit f8899af into main Mar 20, 2026
0 of 2 checks passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…6757a563

fix(signal): handle Note to Self messages with echo-back protection
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…6757a563

fix(signal): handle Note to Self messages with echo-back protection
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…6757a563

fix(signal): handle Note to Self messages with echo-back protection
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…6757a563

fix(signal): handle Note to Self messages with echo-back protection
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…6757a563

fix(signal): handle Note to Self messages with echo-back protection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant