Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

Merge dev-stable (29ac88058) into PR #6710 trace branch

guozirui1b1ad1c944562
diff --cc jiuwenswarm/gateway/message_handler/message_handler.py
index 35de5fed3a,1bef9618e2..d17d1f016d
--- a/jiuwenswarm/gateway/message_handler/message_handler.py
+++ b/jiuwenswarm/gateway/message_handler/message_handler.py
@@@ -2941,27 -2941,23 +2941,43 @@@ class MessageHandler(FileTransferMixin
chunk = parse_agent_server_wire_chunk(wire)
except Exception as e:
logger.exception("[MessageHandler] server_push 解析失败: %s", e)
+ try:
+ from jiuwenswarm.common.audit_emit import emit_audit_evt
+
+ emit_audit_evt(
+ SUBMDL="gateway",
+ PROC="agent_push_handle",
+ MSG=str(e),
+ EVT="agent_push_parse_failed",
+ request_id=str(wire.get("request_id") or ""),
+ session_id=str(wire.get("session_id") or ""),
+ )
+ except Exception: # noqa: BLE001
+ logger.debug(
+ "[MessageHandler] agent_push_handle audit skipped",
+ exc_info=True,
+ )
return
+ payload = chunk.payload
+ if isinstance(payload, dict) and payload.get("event_type") == "trace.updated":
+ from jiuwenswarm.observability.models import CommittedTraceUpdate
+
+ try:
+ update = CommittedTraceUpdate(
+ session_id=str(payload["session_id"]),
+ trace_id=str(payload["trace_id"]),
+ revision=int(payload["revision"]),
+ store_epoch=payload.get("store_epoch"),
+ lifecycle=str(payload.get("lifecycle") or "final"),
+ )
+ except (KeyError, TypeError, ValueError):
+ logger.warning("[MessageHandler] ignored invalid trace update push")
+ return
+ web_channel = self._resolve_web_channel()
+ schedule = getattr(web_channel, "schedule_trajectory_updates", None)
+ if callable(schedule):
+ schedule((update,))
+ return
rid = str(chunk.request_id or "")
sid_raw = wire.get("session_id")
if sid_raw is not None and str(sid_raw).strip():