Fix WhatsApp overlap by serial queue, typing, and outbound delivery.

Serialize per-session inbound turns and merge follow-ups after the active run; show composing while busy and enqueue final replies so long agent runs still reach the group.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-07-22 10:04:25 +08:00
parent f1ed86537c
commit 2446993b11
6 changed files with 801 additions and 79 deletions

View file

@ -16,8 +16,15 @@ def encode_whatsapp_outbound_source(
mention_text_ready: bool = False,
attachments: list[dict[str, Any]] | None = None,
media_path: str | None = None,
extra: dict[str, Any] | None = None,
) -> str:
payload: dict[str, Any] = {"kind": str(kind or "scheduled_job")}
if isinstance(extra, dict):
for key, value in extra.items():
k = str(key or "").strip()
if not k or k in payload:
continue
payload[k] = value
jids = normalize_whatsapp_mention_jids(mention_jids)
if jids:
payload["mention_jids"] = jids