Skip to content

fix: URL-encode Signal phone numbers and correct attachment RPC parameter#3670

Merged
teknium1 merged 2 commits intoNousResearch:mainfrom
kshitijk4poor:fix/signal_encoding
Mar 29, 2026
Merged

fix: URL-encode Signal phone numbers and correct attachment RPC parameter#3670
teknium1 merged 2 commits intoNousResearch:mainfrom
kshitijk4poor:fix/signal_encoding

Conversation

@kshitijk4poor
Copy link
Copy Markdown
Contributor

Summary

  • SSE connection fix: Phone numbers containing + (E.164 format like +31612345678) were passed raw into the SSE query string. The + was interpreted as a space by the HTTP server, causing 400 Bad Request errors and breaking all inbound message reception. Fix: quote(self.account, safe='') encodes + as %2B.
  • Attachment download fix: The getAttachment JSON-RPC call used parameter name attachmentId, but signal-cli expects id. This caused a NullPointerException in signal-cli, silently failing all attachment downloads (images, documents, audio). Fix: rename parameter to id.

Both bugs were reported by a user whose Signal interactions were broken on every upstream update because the fixes kept getting overwritten.

Test plan

  • Added TestSignalSSEUrlEncoding — verifies + is percent-encoded as %2B in SSE URLs
  • Added TestSignalAttachmentFetch — verifies RPC uses id (not attachmentId), handles empty responses, and correctly unwraps dict responses
  • All 39 Signal tests pass (python -m pytest tests/gateway/test_signal.py -q)
…eter

Two bugs in the Signal adapter caused failures for users:

1. SSE connection: Phone numbers with + (e.g. +31612345678) were not
   URL-encoded in the SSE query string, causing the + to be interpreted
   as a space and resulting in 400 Bad Request errors.

2. Attachment download: The getAttachment RPC used parameter name
   "attachmentId" but signal-cli expects "id", causing a
   NullPointerException and failing all attachment downloads.
- Extract shared _make_signal_adapter() and _stub_rpc() helpers
- Remove duplicated _make_adapter/_make_config across 3 test classes
- Remove brittle inspect.getsource test (tested impl text, not behavior)
- Remove unused adapter creation and redundant assertions
- Use captured call list instead of mutating dict for RPC mock
@teknium1 teknium1 merged commit 4c532c1 into NousResearch:main Mar 29, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants