feat(whatsapp): real group @mentions and cleaner inbound text

Wire mention JIDs/names through scheduled delivery and immediate replies (including attachment captions), sanitize group message text for the model, and surface channel-derived sessions in admin Chat.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-07-13 20:05:43 +08:00
parent cbe68a54cd
commit ad5d1db3c6
19 changed files with 1507 additions and 58 deletions

View file

@ -1251,6 +1251,21 @@ class OclawGateway:
)
else:
reply = specialist_reply
if not str(reply or "").strip():
rs = getattr(core_out, "run_state", None)
if rs is not None and str(getattr(rs, "status", "") or "") == "failed":
reason = ""
attempts = getattr(rs, "attempts", ()) or ()
if attempts:
reason = str(getattr(attempts[-1], "reason", "") or "")
if not reason:
reason = str(getattr(rs, "last_error_code", "") or "unknown_error")
base = render_prompt(
"fallback/runtime_error.en.md" if str(lang or "").startswith("en") else "fallback/runtime_error.zh.md",
strict=True,
)
detail = str(reason or "").strip().replace("\n", " ")[:400]
reply = f"{base}\n(detail: {detail})" if detail else base
except Exception as exc:
base = render_prompt(
"fallback/runtime_error.en.md" if str(lang or "").startswith("en") else "fallback/runtime_error.zh.md",