From e6a3ee8f9528ded090797bd331e8c26f325262c2 Mon Sep 17 00:00:00 2001 From: ThearchyHelios Date: Mon, 19 Oct 2026 12:30:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E5=8F=91=E8=BF=90=E8=A1=8C=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E8=B7=B3=E8=BF=87=E4=B8=8D=E8=AE=A4=E8=AF=86?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E4=BB=B6=E7=A7=8D=E7=B1=BB=EF=BC=88=E5=9B=9E?= =?UTF-8?q?=E6=94=BE=E7=85=A7=E6=A0=B7=E8=AF=BB=E5=BE=97=E5=88=B0=EF=BC=89?= =?UTF-8?q?=EF=BC=9Btest-multiprocess.sh=20=E4=B8=8D=E5=B8=A6=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=97=B6=20macOS=20=E7=9A=84=20bash=203.2=20=E6=8A=A5?= =?UTF-8?q?=20args=20=E6=9C=AA=E5=AE=9A=E4=B9=89=EF=BC=8C=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=9B=B4=E6=8E=A5=E5=8E=9F=E6=A0=B7=E4=BA=A4=E7=BB=99?= =?UTF-8?q?=20pytest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/cluster/relay.py | 9 ++++++--- scripts/test-multiprocess.sh | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/app/cluster/relay.py b/backend/app/cluster/relay.py index c5d14ac5..df0873f8 100644 --- a/backend/app/cluster/relay.py +++ b/backend/app/cluster/relay.py @@ -159,11 +159,14 @@ class Relay: .order_by(RunEvent.seq))).scalars()) last_log = None for row in rows: - event = RunEventModel(id=row.id, run_id=run_id, seq=row.seq, type=EventType(row.type), - node_id=row.node_id, ts=row.ts, data=row.data or {}) - await bus.publish(event, relayed=True) self._cursor[run_id] = max(self._cursor.get(run_id, 0), int(row.seq or 0)) last_log = row + try: + event = RunEventModel(id=row.id, run_id=run_id, seq=row.seq, type=EventType(row.type), + node_id=row.node_id, ts=row.ts, data=row.data or {}) + except ValueError: + continue # 不认识的事件种类(更新的版本写的):回放时照样读得到,这里不转 + await bus.publish(event, relayed=True) ended = status is None or status in _TERMINAL or ( status == "interrupted" and last_log is not None and last_log.type == EventType.LOG and (last_log.data or {}).get("code") == "server_shutdown") diff --git a/scripts/test-multiprocess.sh b/scripts/test-multiprocess.sh index 1e5652f4..f16c42db 100755 --- a/scripts/test-multiprocess.sh +++ b/scripts/test-multiprocess.sh @@ -45,7 +45,6 @@ export AGENTLAB_MULTIPROCESS_E2E=1 echo "测试库:127.0.0.1:${PORT}/${DB}(容器 ${NAME},结束后删除)" cd "$ROOT/backend" -args=("$@") # 不并行(-p no:xdist):工作进程、端口、库都是这一组共用的;-s 让工作进程的日志在失败时看得到 env -u ANTHROPIC_API_KEY -u ANTHROPIC_BASE_URL -u ANTHROPIC_AUTH_TOKEN -u OPENAI_API_KEY \ - "$PY" -m pytest tests/test_multiprocess_e2e.py -p no:xdist -p no:randomly -rA "${args[@]}" + "$PY" -m pytest tests/test_multiprocess_e2e.py -p no:xdist -p no:randomly -rA "$@"