[BUG] chats.update / initial history sync discard the archived flag before it reaches webhooks or the database
维护者通常 5 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 67/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- postgresql, typescript
调研方向
Start in whatsapp.baileys.service.ts and compare the chats.update and messaging-history.set handlers with the compiled path cited in the issue. Then inspect the Prisma Chat model and the findChats flow. Done means archived state reaches webhook payloads, persists on Chat rows, and is returned by findChats, with the relevant migration and tests or reproduction checks passing.
由索引模型根据 Issue 内容生成。
描述
📋 Bug Description
When a chat is archived/unarchived on the phone (or any linked device), Baileys emits the change via chats.update with an archived: true/false field. Evolution's chats.update handler in whatsapp.baileys.service.ts (WHATSAPP-BAILEYS integration) discards every field except remoteJid before forwarding to the webhook or writing to the DB:
"chats.update": async (e) => {
const chatsRaw = e.map(chat => ({ remoteJid: chat.id, instanceId: this.instanceId }));
this.sendDataWebhook('chats.update', chatsRaw);
for (const chat of e)
await this.prismaRepository.chat.updateMany({
where: { instanceId: this.instanceId, remoteJid: chat.id, name: chat.name },
data: { remoteJid: chat.id },
});
}
(from compiled dist/api/integrations/channel/whatsapp/whatsapp.baileys.service.js, v2.3.7)
The messaging-history.set handler (emits chats.set) does the same trim, and additionally only forwards chats not already in the Chat table — so even a fresh reconnect can't backfill archive state for chats Evolution already knows about.
The Chat Postgres table also has no archived column at all:
Table "public.Chat"
id | remoteJid | labels | createdAt | updatedAt | instanceId | name | unreadMessages
So there is currently no way for an integrator to learn a chat's real archived state via webhook, DB, or GET /chat/findChats/:instance — it's dropped at the earliest point in Evolution's own pipeline.
🔄 Steps to Reproduce
- Connect an instance (WHATSAPP-BAILEYS) with the
chats.updatewebhook enabled. - Archive (or unarchive) any chat directly on the linked phone.
- Inspect the delivered
chats.updatewebhook payload. - Check the
Chatrow for thatremoteJidviaGET /chat/findChats/:instanceor Postgres directly.
✅ Expected Behavior
chats.update carries the chat's current archived boolean, it's persisted on the Chat row, and findChats returns it — so integrators can mirror the phone's real archived list instead of maintaining a local-only flag.
❌ Actual Behavior
chats.update/chats.set payloads only ever contain {remoteJid, instanceId[, name]}. archived is silently discarded.
🌍 Environment
- OS: Ubuntu (Docker host)
- Evolution API version: 2.3.7
- Integration: WHATSAPP-BAILEYS
- Database: PostgreSQL 13
📝 Additional Context / Proposed Fix
Sketch of a fix, for whoever picks this up:
- Add
archived Boolean @default(false)to theChatPrisma model (migration). - In
chats.update, forwardarchived: chat.archivedin the webhook payload and include it in thechat.updateManywrite. - In
messaging-history.set, same field addition; consider also letting already-known chats'archived/pinned/muteEndTimerefresh on reconnect, since today only brand-new chats get forwarded at all. - Confirm
findChatsselects/returns the new column once it exists.
Related: #2495 looks like a different symptom in the same area (write-side archiveChat endpoint erroring) — this is the read side: archive state never reaching the integrator in the first place.
- 主要语言
- TypeScript
- 星标
- 9.9k
- 派生
- 7.4k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
evolution-foundation/evolution-api 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
evolution-foundation/evolution-api#2723 ·
维护者通常 5 天内回复
-
难度 1/5 1-3 小时 新手友好度 88/100
evolution-foundation/evolution-api#2704 ·
维护者通常 5 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
evolution-foundation/evolution-api#2702 · 2 条评论 · 3 个 reaction ·
维护者通常 5 天内回复
-
[BUG] Cloud API: a single unknown wamid in a `statuses` batch silently drops the whole batch (`return` instead of `continue`)可能已有人在做 @vin1i 于 58 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
evolution-foundation/evolution-api#2700 · 1 条评论 ·
维护者通常 5 天内回复
-
[BUG] Chatwoot integration duplicates messages when a device re-delivers the same key.id — getExistingSourceIds exists but is never called on the live path可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
evolution-foundation/evolution-api#2675 ·
维护者通常 5 天内回复
查看 evolution-foundation/evolution-api 的全部 Issue
相似的 Issue
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 76/100
apex-dev-tools/apex-log-parser#199 ·
维护者通常 1 天内回复
-
area/frontend/library-panels automated-triage type/bug type/ux
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
PostHog/posthog.com#21607 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 73/100
ajv-validator/ajv#2689 ·
-
[Bug]: IME confirmation Enter can submit the SSH port-forward dialog可能已有人在做 @seijikohara 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复