fix: preserve participant JID server in extractDeviceJids for LID support#8
Open
99ecarvalho wants to merge 1 commit into
Open
fix: preserve participant JID server in extractDeviceJids for LID support#899ecarvalho wants to merge 1 commit into
99ecarvalho wants to merge 1 commit into
Conversation
…port After WhatsApp's LID migration, group messages fail with 'SessionError: No sessions' because participant JIDs from extractDeviceJids lose their original @lid domain and are incorrectly re-encoded as @s.whatsapp.net. - Add optional 'server' field to JidWithDevice type - Extract and propagate 'server' from jidDecode in extractDeviceJids - Use per-device server in patchMessageBeforeSending and sender key distribution instead of blanket isLid flag
Reviewer's guide (collapsed on small PRs)Reviewer's GuidePropagates the JID server component through device extraction and message sending so that device JIDs preserve their original @lid vs @s.whatsapp.net domains, fixing mixed-domain group messaging after WhatsApp LID migration. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The fallback logic
d.server || (isLid ? 'lid' : 's.whatsapp.net')is now duplicated in two places inmessages-send.ts; consider extracting a small helper to derive the effective server from aJidWithDeviceto avoid divergence in future changes. - Now that
JidWithDevicecarries an optionalserver, it might be worth scanning other producers/consumers of this type to ensure they either populate or intentionally ignoreserver, so behavior is consistent across all send paths (not justextractDeviceJids).
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The fallback logic `d.server || (isLid ? 'lid' : 's.whatsapp.net')` is now duplicated in two places in `messages-send.ts`; consider extracting a small helper to derive the effective server from a `JidWithDevice` to avoid divergence in future changes.
- Now that `JidWithDevice` carries an optional `server`, it might be worth scanning other producers/consumers of this type to ensure they either populate or intentionally ignore `server`, so behavior is consistent across all send paths (not just `extractDeviceJids`).Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After WhatsApp's LID (Linked Identity) migration, group messages fail with
SessionError: No sessionsbecause participant JIDs returned byextractDeviceJidslose their original@liddomain and are incorrectly re-encoded as@s.whatsapp.net.This happens because
extractDeviceJidsonly destructuresuserfromjidDecode(), discarding theserverfield. Whenmessages-send.tslater callsjidEncode(), it uses a blanketisLidflag to decide the domain — but in mixed groups (where some participants are@lidand others are@s.whatsapp.net), this produces wrong JIDs for some participants.Fix
src/WABinary/jid-utils.ts: Add optionalserverfield toJidWithDevicetypesrc/Utils/signal.ts: Extract and propagateserverfromjidDecode()inextractDeviceJidssrc/Socket/messages-send.ts: Use each device's actualserver(falling back to the existingisLidlogic) in bothpatchMessageBeforeSendingand the sender key distribution loopTesting
Tested against Evolution API v2.2.3 with WhatsApp accounts that have undergone the LID migration. Group messages and DMs to
@lidcontacts now succeed without session errors.Summary by Sourcery
Preserve and propagate the original JID server for participant device JIDs so that group message sending works correctly for both LID and non-LID accounts.
Bug Fixes:
Enhancements: