Isolate WhatsApp group turns by speaker and clarify SQL scope denials.

Always tag group senders, inject group-focus system hints, label queued follow-ups by speaker, and mark insufficient_scope failures as non-retryable with a user-facing hint.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-10 23:11:41 +08:00
parent d2693d1c63
commit e91e4fe773
9 changed files with 167 additions and 31 deletions

View file

@ -484,6 +484,15 @@ class OclawGateway:
return str(maybe_ops_short_intent_system_hint(text=str(msg.text or ""), lang=lang) or "").strip()
@staticmethod
def _group_focus_system_hint(msg: StandardMessage, lang: str) -> str:
md = msg.metadata if isinstance(msg.metadata, dict) else {}
if not bool(md.get("is_group")):
return ""
from runtime.orchestration.group_ingest import build_group_focus_instruction
return str(build_group_focus_instruction(lang=lang) or "").strip()
@staticmethod
def _tabular_query_system_hint(lang: str) -> str:
limits = OclawGateway._tabular_limits_from_config()
@ -1180,6 +1189,9 @@ class OclawGateway:
ch_hint = self._channel_file_delivery_system_hint(lang)
if ch_hint:
sys_prompt = f"{sys_prompt}\n\n{ch_hint}".strip()
focus_hint = self._group_focus_system_hint(msg, lang)
if focus_hint:
sys_prompt = f"{sys_prompt}\n\n{focus_hint}".strip()
if str(manager_specialist or requested_specialist or "").strip().lower() == "ops":
intent_hint = self._ops_short_intent_system_hint(msg, lang)
if intent_hint: