fix(baileys): enable initial sync + dialect-agnostic chatId filter + debug logging#375
Merged
rmyndharis merged 1 commit intoJun 20, 2026
Conversation
…debug logging Downstream Baileys-engine hardening, stacked on the typed-WaId work (rmyndharis#349). - Initial sync: pass shouldSyncHistoryMessage: () => true. Baileys defaults it to () => !!syncFullHistory, so with syncFullHistory unset it silently disabled the entire initial sync - no contacts, chat list, recent messages, or lid->phone mappings ever arrived. The full-archive download stays opt-in via BAILEYS_SYNC_FULL_HISTORY. - Message history chatId filter resolves across dialects (reuses the from-filter's resolveJidCandidates), so a chat keyed @c.us also matches messages stored under @s.whatsapp.net - fixes the empty conversation view after contact/chat canonicalization. - BAILEYS_LOG_LEVEL surfaces the Baileys library's own logs (trace dumps the decoded WA wire frames), plus contacts/chats/history-set receipt instrumentation, for diagnosing sync issues. Silent by default.
50ccff7 to
b5961fa
Compare
Owner
|
Rebased onto
Approving and merging. Thanks for chasing these down on a real session. |
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.
Depends on #349 - stacks on
feat/typed-waid-349; that PR's commit appears in this diff until #349 merges. Review/merge #349 first.Three independent Baileys-engine fixes that surfaced while testing #349 on a real session.
Initial sync was silently disabled
Baileys defaults
shouldSyncHistoryMessageto() => !!syncFullHistory, so withsyncFullHistoryunset the entire initial sync (address-book / app-state) never ran - no contacts, chat list, recent messages, orlid -> phonemappings ever arrived (Socket/index.js+Socket/chats.jsgo straight toOnline). The adapter now passesshouldSyncHistoryMessage: () => true, enabling the sync while keeping the full-archive download opt-in viaBAILEYS_SYNC_FULL_HISTORY(WhatsApp then sends the recent window + contact/app-state snapshot, not the entire message history).Verified against
@whiskeysockets/baileys@6.7.23source and corroborated by upstream issues (e.g. WhiskeySockets/Baileys#2077, NousResearch/hermes-agent#11951).Dialect-agnostic
chatIdfilter on message historyA chat addressed as
<phone>@c.us(the neutral list id) now also returns messages stored under<phone>@s.whatsapp.net(e.g. an outbound send addressed by a raw engine id), so the conversation view is no longer empty when the stored and queried dialects differ. Reuses the #349from-filter resolution.BAILEYS_LOG_LEVEL+ receipt instrumentationBAILEYS_LOG_LEVEL(trace|debug|info|warn|error, silent by default) surfaces the Baileys library's own diagnostics;tracedumps the decoded WhatsApp wire frames to stdout (contextbaileys-wire). Plus contacts/chats/history-set receipt logging, for diagnosing sync issues.