修复综合模式历史会话泄漏内部指令。

将综合模式执行文本与用户落库文本彻底解耦,确保只持久化用户真实输入;同时在消息读取接口增加旧脏数据过滤,并补充回归测试,避免内部派单指令再次作为用户消息展示。

Made-with: Cursor
This commit is contained in:
oliver 2026-04-29 00:02:30 +08:00
parent 048e8ec1c1
commit 8b8265eb46
7 changed files with 254 additions and 12 deletions

View file

@ -920,6 +920,7 @@ def run_oclaw_direct_loop(
workspace_dir: str | None = None,
memory_context: OclawMemoryContext | None = None,
persist_user_message: bool = True,
persisted_user_text: str | None = None,
tool_signature_budget: int = 2,
skill_binding_role: str | None = None,
wire_policy_role: str | None = None,
@ -929,11 +930,12 @@ def run_oclaw_direct_loop(
"""A minimal oclaw-style loop: model -> tool_uses -> execute -> tool_results -> continue."""
_check_stop(should_stop)
turn_uuid = str(turn_uuid or "").strip() or str(uuid.uuid4())
persisted_text = str(user_text if persisted_user_text is None else persisted_user_text or "")
if persist_user_message:
store.add_message(
session_id=session_id,
role="user",
content=str(user_text or ""),
content=persisted_text,
attachments=attachments,
turn_uuid=turn_uuid,
event_type="user_text",