转发运行事件时跳过不认识的事件种类(回放照样读得到);test-multiprocess.sh 不带参数时 macOS 的 bash 3.2 报 args 未定义,参数直接原样交给 pytest

This commit is contained in:
ThearchyHelios
2026-10-19 12:30:30 +08:00
parent 09907b21f1
commit e6a3ee8f95
2 changed files with 7 additions and 5 deletions
+6 -3
View File
@@ -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")
+1 -2
View File
@@ -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 "$@"