Skip to content

Agent Zero AI framework

remove redundant streaming callback, fix duplicate analysis, add progress bar

keyboardstaffe0f7ef829e25
diff --git a/plugins/_infection_check/helpers/checker.py b/plugins/_infection_check/helpers/checker.py
index 7c1bb175f..a85845c5e 100644
--- a/plugins/_infection_check/helpers/checker.py
+++ b/plugins/_infection_check/helpers/checker.py
@@ -120,6 +120,10 @@ class InfectionChecker:
PrintStyle(font_color="red", padding=True).print(
f"Infection check error (non-fatal): {e}"
)
+ try:
+ agent.context.log.set_progress("Infection check: error (non-fatal)")
+ except Exception:
+ pass
async def _gate_inner(self, agent: "Agent", tool_name: str, tool_args: dict | None):
if agent.get_data(DATA_KEY_PASSED):
@@ -127,6 +131,9 @@ class InfectionChecker:
if not self.reasoning_log and not self.response_log:
return
+ _log = agent.context.log
+ _log.set_progress("Infection check: analyzing...")
+
# Attach tool context for _build_log()
if tool_name:
self._tool_name = tool_name
@@ -144,11 +151,13 @@ class InfectionChecker:
if self._task is not None and self._task.done():
try:
action, detail, cot = self._task.result()
+ _log.set_progress("Infection check: evaluating result...")
except Exception:
pass
# Slow path: rebuild with full tool context.
if action is None:
+ _log.set_progress("Infection check: analyzing with tool context...")
if self._task is not None:
self._task.cancel()
try:
@@ -170,6 +179,7 @@ class InfectionChecker:
return
if action == "ok":
+ _log.set_progress("Infection check: passed")
agent.set_data(DATA_KEY_PASSED, True)
return
@@ -235,16 +245,9 @@ class InfectionChecker:
HumanMessage(content=user_msg),
]
- cot = ""
-
- async def _cb(chunk: str, full: str):
- nonlocal cot
- cot = full
-
model = self._get_model(agent)
response, _ = await model.unified_call(
messages=list(self._check_msgs),
- response_callback=_cb,
)
self._check_msgs.append(AIMessage(content=response))