diff --git a/openzero/brain/app.py b/openzero/brain/app.py index 83af9eb..efd406e 100644 --- a/openzero/brain/app.py +++ b/openzero/brain/app.py @@ -4931,8 +4931,8 @@ def browser_inspection_final_reply(result: str) -> str: visible = blocks[1] if len(blocks) == 2 else "" visible = visible.rsplit("\n```", 1)[0] visible = re.sub(r"\s+", " ", visible).strip(" `") - if len(visible) > 900: - visible = visible[:900].rsplit(" ", 1)[0].rstrip() + "..." + if len(visible) > 600: + visible = visible[:600].rsplit(" ", 1)[0].rstrip() + "..." url = str(url_match.group(1) if url_match else "").strip() title = str(title_match.group(1) if title_match else "").strip() lines = ["I inspected the live page with OpenZero's Moltbot browser."] @@ -5371,7 +5371,6 @@ def execute_autonomous_run( if action.get("retryable_model_error"): emit_agent_log("The local model requested an unknown tool, so OpenZero is retrying cleanly.", session_id) continue - emit_run_reply(session_id, action_result, "system") if completion_evidence is not None and tool_name == "moltbot_browse": completion_reason = required_operator_evidence_reason( @@ -5392,6 +5391,8 @@ def execute_autonomous_run( emit_run_reply(session_id, final_reply, agent_mode) break + emit_run_reply(session_id, action_result, "system") + if action.get("ambiguous_action"): final_status = "error" final_reply = action_result diff --git a/openzero/tests/test_autonomous_runtime.py b/openzero/tests/test_autonomous_runtime.py index bdd1979..13d4db5 100644 --- a/openzero/tests/test_autonomous_runtime.py +++ b/openzero/tests/test_autonomous_runtime.py @@ -1126,6 +1126,9 @@ def test_plain_conversation_and_model_format_recovery_are_guarded(self): self.assertIn("browser result compacted for local summary", self.source) self.assertIn("def browser_inspection_final_reply(", self.source) self.assertIn('"deterministic_browser_completion"', self.source) + completion = self.source.index('if completion_evidence is not None and tool_name == "moltbot_browse"') + raw_emit = self.source.index('emit_run_reply(session_id, action_result, "system")') + self.assertLess(completion, raw_emit) self.assertIn("required_operator_evidence_reason(", self.source) self.assertIn("max_predict=local_reply_token_budget(prompt, agent_mode)", self.source) self.assertIn('"think": False', self.source)