Repository navigation
Conversation
WhatsApp is rolling out delivery of contacts' statuses as a top-level <status> stanza instead of <message from="status@broadcast">. Baileys 7.0.0-rc13 has no handler for it, so it is never acked: the server ends the stream ~50 min later (stream:error ack class="status", code 500) and holds back new inbound messages for that session, which then stays "open" but receives nothing. Backport WhiskeySockets/Baileys#2883 via patch-package until it ships in a Baileys release. Fixes evolution-foundation#2778 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewer's GuideConfigurationAdd a patch-package patch to Baileys that acknowledges top-level status stanzas, including those processed offline.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
O WhatsApp está passando a entregar os status dos contatos como stanza <status> de nível superior, em vez de <message from="status@broadcast">. O Baileys 7.0.0-rc14 não tem handler para ela, então nunca envia o ack: o servidor encerra o stream ~50 min depois (stream:error ack class="status", código 500) e retém as novas mensagens recebidas, com a instância "open" mas sem receber nada. Porta o PR evolution-foundation/evolution-api#2785 (backport de WhiskeySockets/Baileys#2883) para o patch do rc14, junto do patch já existente de decifrar edições. Pode ser removido quando uma release do Baileys incluir o #2883. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Confirming this approach in production on v2.3.7 (Baileys rc.9, applied as a startup patch): 24 h with 0 One small suggestion: in rc.9 the offline queue loop awaits Could a maintainer take a look at this PR? It would be great to have it in a 2.3.8 release so people can drop the local patches. Thanks! |
|
Confirming this fix in production, plus a no-fork way to apply it on Easypanel. Environment: Evolution API v2.3.7 ( Symptoms before the patch (last 24h):
How we applied it without forking: in Easypanel, Source > Dockerfile, with this content. The build fails if any anchor is missing or duplicated, so it will not silently break on a different Baileys version: FROM evoapicloud/evolution-api:v2.3.7
RUN node -e 'const fs=require("fs");const f="/evolution/node_modules/baileys/lib/Socket/messages-recv.js";let s=fs.readFileSync(f,"utf8");const r=(a,b)=>{if(s.split(a).length!==2)throw new Error("anchor not found or duplicated: "+a);s=s.replace(a,b)};r("const makeOfflineNodeProcessor = () => {","const handleStatus = async (node) => {\n await sendMessageAck(node);\n };\n const makeOfflineNodeProcessor = () => {");r("[\x27notification\x27, handleNotification]","[\x27notification\x27, handleNotification],\n [\x27status\x27, handleStatus]");r("ws.on(\x27CB:ack,class:message\x27","ws.on(\x27CB:status\x27, async (node) => {\n await processNode(\x27status\x27, node, \x27acking status\x27, handleStatus);\n });\n ws.on(\x27CB:ack,class:message\x27");fs.writeFileSync(f,s);console.log("STATUS_ACK_PATCH_APPLIED")'Rollback is just switching back to the Docker Image source with the official tag. Sessions are stored in Postgres, so all instances reconnected on their own after the redeploy, no QR code needed. Result so far: messages held during the stall were delivered right after the redeploy, and new inbound messages reach our webhook within seconds. It would be great to get this merged and released, since every Baileys-based instance seems to be affected as WhatsApp rolls out top-level |
|
48h follow-up after applying the patch:
The patch fully resolved it for us. +1 for merging and releasing. |
Summary
Fixes #2778.
WhatsApp is gradually rolling out a change that delivers contacts' statuses as a top-level
<status>stanza instead of<message from="status@broadcast">. Baileys7.0.0-rc13(andrc.9, used by 2.3.7 / 2.4.0-rc2) only registers handlers formessage,call,receiptandnotification, so a<status>is never acked.Effects seen in production:
{"tag":"stream:error","content":[{"tag":"ack","attrs":{"class":"status","type":"media",...}}]}(Stream Errored (ack), statusCode 500). Every instance reconnects every ~50 min.<status>waits for its ack, the server holds back new inbound messages for that session. The instance staysopen, sending works, but nothing is received — noMessagerow, nomessages.upsertwebhook. Instance restart and container restart do not fix it; a new QR only helps for a few hours.Fix
Backport of the upstream fix WhiskeySockets/Baileys#2883 through
patch-package(thepatches/directory andpostinstallhook already exist for this):handleStatus, which acks the node via the existingsendMessageAck(the stanza is not decoded);CB:statusthroughprocessNode, and register['status', handleStatus]in the offline node processor so offline<status>nodes are acked in order;onUnexpectedErrorinstead of breaking the offline queue.The patch can be dropped once a Baileys release includes #2883.
Testing
patch-packageapplies cleanly on a fresh install ofbaileys@7.0.0-rc13; the module imports fine.rc.9shipped inevoapicloud/evolution-api:2.4.0-rc2) has been running in production on a server with 6 QR instances + Chatwoot:<status>frames logged asunhandledin 5 minutes and no ack;<status>stanzas acked in the first 3 minutes, 0 unhandled, 0 errors; the server released the held-back inbound messages within ~1 minute and the instance kept receiving — no QR re-scan needed.🤖 Generated with Claude Code
Summary by Sourcery
Restore reliable Baileys message reception by acknowledging top-level status stanzas.
Bug Fixes:
Build: