Intent Session + 短 SQLAlchemy Session 实施计划
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: 修复 Broken pipe 根因(长生命周期 SQLAlchemy session)并新增 intent_session 列持久化 MessageGate 分类上下文
Architecture: ActiveSessionService 持有 db_factory 替代 db 实例,save_to_db 内部用 with 短 session;MessageGate._classify_and_rewrite 重构为存/取 intent_session(KV + DB),history 拼成原生多轮 messages 对
Tech Stack: Python 3.12+ / SQLAlchemy 2.0 / PyMySQL / FastAPI / AgentScope
关联设计文档: ai-workflow/Vibe coding for SQ/docs/superpowers/specs/2026-06-04-intent-session-design.md
Task 0: 确认 SQL 与 ORM 模型
Files:
Modify:
app/model/session.py:5-14Step 1: 读取当前 ORM 模型确认字段
cd ai-workflow/workspace/agent-admin/backend
grep -A 10 "class Session" app/model/session.py
- Step 2: 添加 intent_session 列
在 conversation_history 行之后、created_at 行之前插入:
intent_session = Column(Text, nullable=False, default="")
sed -i '' '/conversation_history = Column(Text, nullable=False, default="\[\]")/a\
intent_session = Column(Text, nullable=False, default="")
' app/model/session.py
- Step 3: 验证列已加入
grep -A 3 "conversation_history" app/model/session.py
期望输出包含 intent_session = Column(Text, nullable=False, default="")
- Step 4: Commit
git add app/model/session.py
git commit -m "$(cat <<'EOF'
feat: add intent_session column to Session ORM model
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
Task 1: ActiveSessionService — __init__ 改为工厂模式
Files:
Modify:
app/service/active_session_service.py:1-32Step 1: 更新文件顶部 import
在 from typing import Optional(line 8)改为:
from typing import Callable, Optional
from sqlalchemy.orm import Session as SASession
(Callable 用于类型标注,SASession 避免与 app 自己的 Session ORM 模型冲突)
- Step 2: 修改 init 签名
替换 line 30-32:
class ActiveSessionService:
def __init__(self, store: Optional[SessionStore] = None, db_factory: Optional[Callable[[], SASession]] = None) -> None:
self.store = store or SessionStore()
self._db_factory = db_factory
- Step 3: Commit
git add app/service/active_session_service.py
git commit -m "$(cat <<'EOF'
refactor: ActiveSessionService uses db_factory instead of db instance
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
Task 2: ActiveSessionService — save_to_db 用短 session + intent_session
Files:
Modify:
app/service/active_session_service.py:100-142Step 1: 替换 save_to_db 整体实现
替换 line 100-142 为:
def save_to_db(self, session_id: str) -> None:
if not self._db_factory:
logger.warning("[save_to_db] session=%s db_factory 为 None,跳过持久化", session_id)
return
data = self.store.get(session_id)
if not data:
logger.warning("[save_to_db] session=%s KV 中无数据,跳过持久化", session_id)
return
history = data.get("conversation_history") or []
intent_session = data.get("intent_session", "")
intent_session_str = (
intent_session
if isinstance(intent_session, str)
else json.dumps(intent_session, ensure_ascii=False)
)
logger.info(
"[save_to_db] session=%s intent_session 长度=%d, conversation_history 长度=%d",
session_id, len(intent_session_str), len(history),
)
try:
with self._db_factory() as db:
existing = db.query(Session).filter(
Session.session_id == session_id
).first()
if existing:
existing.room_id = data.get("room_id", "")
existing.channel = data.get("channel", "wechat_group")
existing.conversation_history = json.dumps(
data.get("conversation_history", []), ensure_ascii=False
)
existing.intent_session = intent_session_str
else:
db_sess = Session(
session_id=session_id,
room_id=data.get("room_id", ""),
channel=data.get("channel", "wechat_group"),
conversation_history=json.dumps(
data.get("conversation_history", []), ensure_ascii=False
),
intent_session=intent_session_str,
)
db.add(db_sess)
db.commit()
except Exception:
logger.exception("Failed to persist session %s to DB", session_id)
-
Step 2: 确认不再有
self._db引用
grep -n "self._db" app/service/active_session_service.py
期望:无输出(或只有 self._db_factory)
- Step 3: Commit
git add app/service/active_session_service.py
git commit -m "$(cat <<'EOF'
fix: save_to_db uses short-lived SQLAlchemy session to prevent Broken pipe
Also writes intent_session field to DB. The with db_factory() as db pattern
ensures pool_pre_ping fires on every write, preventing stale connections.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
Task 3: ActiveSessionService — get_or_create_session 冷恢复加 intent_session
Files:
Modify:
app/service/active_session_service.py:54-98Step 1: 替换冷恢复分支(line 54-80)为短 session + intent_session
替换:
# 2. 查 DB(冷恢复)
if self._db:
db_sess = self._db.query(Session).filter(
Session.session_id == session_id
).first()
为:
# 2. 查 DB(冷恢复)
if self._db_factory:
try:
with self._db_factory() as db:
db_sess = db.query(Session).filter(
Session.session_id == session_id
).first()
# with 块结束 → db 关闭、连接归还池
except Exception:
logger.exception("Failed to cold-recover session %s from DB, 降级新建", session_id)
db_sess = None
- Step 2: 替换 DB 命中分支,添加 intent_session 解析
在 if db_sess: 块内,将现有的 payload 构造替换为(注意缩进与 if self._db_factory: 对齐):
if db_sess:
intent_session_raw = (db_sess.intent_session or "").strip()
try:
intent_session = json.loads(intent_session_raw) if intent_session_raw else []
except (json.JSONDecodeError, TypeError, ValueError) as e:
logger.warning(
"session=%s intent_session 解析失败: %s, 降级为空",
session_id, e,
)
intent_session = []
payload = {
"session_id": db_sess.session_id,
"channel": db_sess.channel,
"room_id": db_sess.room_id,
"conversation_history": json.loads(
db_sess.conversation_history or "[]"
),
"intent_session": intent_session,
"context_entities": {},
"created_at": (
db_sess.created_at.isoformat()
if db_sess.created_at else _utcnow_iso()
),
"updated_at": _utcnow_iso(),
}
self.store.set(session_id, payload)
return ActiveSessionInfo(
id=session_id,
session_id=session_id,
channel=db_sess.channel,
room_id=db_sess.room_id,
)
-
Step 3: 替换新建分支(line 82-90)的 payload,加
intent_session: ""
# 3. 都没有,创建新 session
payload = {
"session_id": session_id,
"channel": channel,
"room_id": room_id,
"conversation_history": [],
"intent_session": "",
"context_entities": {},
"created_at": _utcnow_iso(),
"updated_at": _utcnow_iso(),
}
- Step 4: Commit
git add app/service/active_session_service.py
git commit -m "$(cat <<'EOF'
feat: get_or_create_session cold recovery includes intent_session
DB cold recovery now parses and restores intent_session to KV.
New sessions include intent_session: "" in payload for consistency.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
Task 4: MessageGate — _classify_and_rewrite + _build_classify_prompt 重构
注意:两处改动必须在同一个 commit 中完成。单独改
_build_classify_prompt签名会导致调用方_classify_and_rewrite传history=参数报 TypeError。
Files:
Modify:
app/service/message_gate.py:180-269Step 1: 替换
_classify_and_rewrite整体实现
将 line 180-225 替换为:
async def _classify_and_rewrite(
self,
session_id: str,
pending: List[Dict[str, Any]],
agent_codes: Optional[List[str]] = None,
) -> "GateDecision":
from app.infrastructure.session_store import SessionStore
store = SessionStore()
# 合并 pending 消息文本(逻辑不变)
parts = []
for m in pending:
mt = m.get("msg_type", "")
mc = m.get("msg_content", "")
if mt in ("text", "other", "file") and mc:
if mt == "file":
parts.append(f"[文件: {mc}]")
elif mt == "other":
parts.append(f"[其他: {mc}]")
else:
parts.append(mc)
merged_text = "\n".join(parts) if parts else "(空消息)"
# 加载 KV data
data = store.get(session_id) or {}
history = (data.get("conversation_history") or [])[-10:]
# 取 base_messages(intent_session 字段,冷恢复或上次写入)
base_messages = data.get("intent_session")
if not isinstance(base_messages, list) or not base_messages:
base_messages = self._build_default_classify_messages(agent_codes or [])
# 抽 system(不含 history)
system_msg = next(
(m for m in base_messages if m.get("role") == "system"),
None,
)
if not system_msg:
system_msg = {
"role": "system",
"content": self._build_classify_prompt(agent_codes=agent_codes or []),
}
# 拼 history 成多轮 messages 对
messages = [system_msg]
for h in history:
if h.get("role") in ("user", "assistant"):
messages.append({"role": h["role"], "content": h.get("content", "")})
# 加 user current
user_prompt = f"## 当前用户消息\n{merged_text}\n\n请按 system 指令输出 JSON。"
messages.append({"role": "user", "content": user_prompt})
# 调 LLM
response = await self.model(messages=messages)
# 解析 JSON
text = self._extract_text(response)
logger.debug(
"[MessageGate] LLM raw response type=%s, extracted text=%s",
type(response).__name__, text[:300],
)
# 写回 intent_session(不含 history,下次再拼)
# 注意:SessionStore.get() 返回反序列化后新 dict,必须显式 set() 写回 KV
data["intent_session"] = [system_msg, {"role": "user", "content": user_prompt}]
store.set(session_id, data)
self.session_service.save_to_db(session_id)
return self._parse_decision_json(text)
-
Step 2: 替换
_build_classify_prompt+ 新增_build_default_classify_messages
将 line 227-269 替换为:
def _build_classify_prompt(self, agent_codes: List[str]) -> str:
"""构造不含 history 段的 system prompt。"""
agent_text = ", ".join(agent_codes) if agent_codes else "(未指定)"
return f"""你是 MessageGate 助手,负责:
1. 识别用户消息的意图(actionable / casual / incomplete / ignore)
2. 将用户消息重写为完整、明确的指令
## 风格指南
- 保持自然、说人话,不官方
- 简洁,不超过 50 字
- emoji 适度
## 意图分类
- actionable: 有明确任务意图 + 信息充足
- casual: 打招呼、感谢、确认、闲聊
- incomplete: 有资源(文件/URL)但无意图说明,或有意图但缺少关键信息
- ignore: 纯表情、无意义字符、系统通知
## 当前会话可用的 Agent
{agent_text}
## 输出格式(严格 JSON)
{{
"intent": "actionable|casual|incomplete|ignore",
"rewritten_query": "完整指令(actionable 时必填)",
"reply": "回复文本(casual/incomplete 时必填)"
}}
"""
def _build_default_classify_messages(
self,
agent_codes: List[str],
) -> List[Dict[str, Any]]:
"""默认 messages(KV 完全空 / 损坏时用)。"""
return [
{"role": "system", "content": self._build_classify_prompt(agent_codes=agent_codes)},
{"role": "user", "content": ""},
]
- Step 3: 验证一致性
# 确认 _build_classify_prompt 只接受 agent_codes,不再有 history 参数
grep -n "def _build_classify_prompt" app/service/message_gate.py
# 期望: def _build_classify_prompt(self, agent_codes: List[str]) -> str:
# 确认调用方不传 history
grep -n "_build_classify_prompt.*history" app/service/message_gate.py
# 期望: 0 match
# 确认两个调用点
grep -n "_build_classify_prompt(" app/service/message_gate.py
# 期望: _classify_and_rewrite 内 1 处 + _build_default_classify_messages 内 1 处
- Step 4: Commit
git add app/service/message_gate.py
git commit -m "$(cat <<'EOF'
feat: _classify_and_rewrite uses intent_session + history as native messages
- _build_classify_prompt removes history param (no more text concatenation)
- _build_default_classify_messages added for degradation fallback
- history injected as user/assistant message pairs for native chat structure
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
Task 5: MessageGate — evaluate 分支清空(ignore / actionable / casual)
Files:
- Modify:
app/service/message_gate.py:138-178(evaluate 分支区域) - Modify:
app/service/message_gate.py:305-334(_handle_casual 区域) Modify:
app/service/message_gate.py:367-380(_handle_actionable 区域)Step 1: ignore 分支加清空 + 写库
替换 line 138-143:
if decision.intent == "ignore":
# 按 msg_id 移除本批次
ids = [m["msg_id"] for m in pending if "msg_id" in m]
buffer.remove_by_msg_ids(ids)
# 清空 intent_session 并持久化
data = store.get(session_id) or {}
data["intent_session"] = ""
store.set(session_id, data)
self.session_service.save_to_db(session_id)
return
- Step 2: casual 分支(_handle_casual)加清空
在 _handle_casual 方法中,mem.add("assistant", ...) 行之后、self.session_service.save_to_db(session_id) 行之前,插入清空逻辑。
具体位置:line 326-327 之间。修改为:
mem.add("assistant", decision.reply, agent_code=self.main_agent_key)
# 清空 intent_session
data = store.get(session_id) or {}
data["intent_session"] = ""
store.set(session_id, data)
self.session_service.save_to_db(session_id)
- Step 3: actionable 分支(_handle_actionable)加清空
在 _handle_actionable 方法中,构造 query 之后、调用 agent_hub.process_message 之前,插入清空逻辑:
query = decision.rewritten_query or ""
if not query:
logger.warning("[MessageGate] session=%s actionable 但无 query,跳过", session_id)
# 清空 intent_session(AgentHub 内部的 save_to_db 会顺带写库)
from app.infrastructure.session_store import SessionStore
store = SessionStore()
data = store.get(session_id) or {}
data["intent_session"] = ""
store.set(session_id, data)
await self.agent_hub.process_message(...)
注意:只写 KV 不调 save_to_db;AgentHub.process_message() 末尾已有的 save_to_db 会顺带把清空的 intent_session 写库。
- Step 4: 确认 incomplete 分支不动 intent_session
grep -A 30 "def _handle_incomplete" app/service/message_gate.py | grep -c "intent_session"
期望:0(incomplete 不新增任何 intent_session 操作)
- Step 5: Commit
git add app/service/message_gate.py
git commit -m "$(cat <<'EOF'
feat: clear intent_session on actionable/casual/ignore; keep on incomplete
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
Task 6: main.py — lifespan 改用 db_factory
Files:
Modify:
app/main.py:66-121Step 1: 替换 lifespan 中的 db 使用
修改 line 66-78:
config_loader = ConfigLoader()
settings = config_loader.load_settings()
- db = SessionLocal()
+ db_factory = SessionLocal
# 从数据库加载 Agent 配置
- agents = config_loader.load_agents_from_db(db)
+ with db_factory() as db:
+ agents = config_loader.load_agents_from_db(db)
logger.info(...)
- session_service = ActiveSessionService(db=db)
+ session_service = ActiveSessionService(db=db_factory)
修改 line 121:
if message_gate_instance:
await message_gate_instance.close()
- db.close()
+ # db_factory 是 class,不需要 close;短 session 由 with 自动管理
- Step 2: 确认不再有长生命周期 db 实例
grep -n "db = SessionLocal\|db\.close()" app/main.py
期望:0 match(除了 db_factory = SessionLocal)
- Step 3: Commit
git add app/main.py
git commit -m "$(cat <<'EOF'
fix: lifespan no longer holds long-lived SQLAlchemy session
Inject SessionLocal as factory into ActiveSessionService.
Short-lived sessions via with db_factory() as db: prevent
Broken pipe from stale connections.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
Task 7: 现有测试适配
Files:
Modify:
tests/test_session_persistence.pyStep 1: 查找需要改的测试文件
grep -rn "ActiveSessionService(db=" tests/ | grep -v __pycache__
grep -rn "session_service = ActiveSessionService" tests/ | grep -v __pycache__
grep -rn "ActiveSessionService()" tests/ | grep -v __pycache__
-
Step 2: 适配测试 — 把
db=mock改为db_factory=lambda: mock
对所有 ActiveSessionService(db=mock_session) 调用,改为:
ActiveSessionService(db_factory=lambda: mock_session)
对所有 ActiveSessionService(db=db) 调用,改为:
ActiveSessionService(db_factory=lambda: db)
-
Step 3: 确认旧测试不再断言
_db属性(已经改为_db_factory)
grep -rn "\._db\b" tests/ | grep -v __pycache__ | grep -v "\._db_factory"
如果只有 ORM model 引用(如 Model._db),跳过。如果测试直接访问 session_service._db,需改为 session_service._db_factory。
- Step 4: Commit
git add tests/
git commit -m "$(cat <<'EOF'
test: adapt test mocks to db_factory parameter
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
Task 8: 新增测试 — test_intent_session_lifecycle.py
Files:
Create:
tests/test_intent_session_lifecycle.pyStep 1: 写测试文件
"""intent_session 生命周期测试 — 写/读/拼接/清空/降级。"""
from __future__ import annotations
import json
from unittest.mock import MagicMock
from app.service.active_session_service import ActiveSessionService
class TestIntentSessionPersistence:
"""验证 save_to_db 正确写入 intent_session 列。"""
def test_save_to_db_writes_intent_session_as_list(self):
"""intent_session 为 list 时 → JSON 字符串写库。"""
mock_db = MagicMock()
mock_db.query.return_value.filter.return_value.first.return_value = None
session_service = ActiveSessionService(db_factory=lambda: mock_db)
session_id = "test-001"
session_service.store.set(session_id, {
"session_id": session_id,
"room_id": "",
"channel": "wechat_group",
"conversation_history": [],
"intent_session": [
{"role": "system", "content": "分类指令"},
{"role": "user", "content": "当前消息"},
],
})
session_service.save_to_db(session_id)
call_args = mock_db.add.call_args[0][0]
assert call_args.intent_session == json.dumps(
[
{"role": "system", "content": "分类指令"},
{"role": "user", "content": "当前消息"},
],
ensure_ascii=False,
)
def test_save_to_db_writes_empty_string_for_empty_intent_session(self):
"""intent_session 为 '' 时(清空后)→ '' 写库。"""
mock_db = MagicMock()
mock_db.query.return_value.filter.return_value.first.return_value = None
session_service = ActiveSessionService(db_factory=lambda: mock_db)
session_id = "test-002"
session_service.store.set(session_id, {
"session_id": session_id,
"room_id": "",
"channel": "wechat_group",
"conversation_history": [],
"intent_session": "",
})
session_service.save_to_db(session_id)
call_args = mock_db.add.call_args[0][0]
assert call_args.intent_session == ""
class TestIntentSessionColdRecovery:
"""验证冷恢复正确回填 intent_session 到 KV。"""
def test_cold_recovery_restores_intent_session(self):
"""DB 命中 → KV 中 intent_session 被恢复为解析后的 list。"""
mock_db = MagicMock()
mock_db_session = MagicMock()
mock_session = MagicMock()
mock_session.session_id = "test-003"
mock_session.room_id = "room-1"
mock_session.channel = "wechat_group"
mock_session.conversation_history = "[]"
mock_session.intent_session = json.dumps(
[{"role": "system", "content": "分类指令"}, {"role": "user", "content": "当前消息"}],
ensure_ascii=False,
)
mock_session.created_at = None # 触发 _utcnow_iso fallback
mock_db_session.query.return_value.filter.return_value.first.return_value = mock_session
mock_db.__enter__ = MagicMock(return_value=mock_db_session)
mock_db.__exit__ = MagicMock(return_value=None)
session_service = ActiveSessionService(db_factory=lambda: mock_db)
info = session_service.get_or_create_session("test-003", room_id="room-1")
kv_data = session_service.store.get("test-003")
assert kv_data is not None
assert kv_data["intent_session"] == [
{"role": "system", "content": "分类指令"},
{"role": "user", "content": "当前消息"},
]
assert info.session_id == "test-003"
def test_cold_recovery_degraded_on_corrupt_json(self):
"""intent_session JSON 损坏 → 降级为 []。"""
mock_db = MagicMock()
mock_db_session = MagicMock()
mock_session = MagicMock()
mock_session.session_id = "test-004"
mock_session.room_id = "room-1"
mock_session.channel = "wechat_group"
mock_session.conversation_history = "[]"
mock_session.intent_session = "not-valid-json{{{"
mock_session.created_at = None
mock_db_session.query.return_value.filter.return_value.first.return_value = mock_session
mock_db.__enter__ = MagicMock(return_value=mock_db_session)
mock_db.__exit__ = MagicMock(return_value=None)
session_service = ActiveSessionService(db_factory=lambda: mock_db)
info = session_service.get_or_create_session("test-004", room_id="room-1")
kv_data = session_service.store.get("test-004")
assert kv_data is not None
assert kv_data["intent_session"] == [] # 降级为空 list
def test_new_session_has_empty_intent_session(self):
"""新建 session → intent_session 为 ""。"""
session_service = ActiveSessionService()
info = session_service.get_or_create_session("test-005")
kv_data = session_service.store.get("test-005")
assert kv_data is not None
assert kv_data.get("intent_session") == ""
assert info.session_id == "test-005"
class TestShortSession:
"""验证 save_to_db 使用 with db_factory() as db: 短 session。"""
def test_save_to_db_enters_and_exits_context_manager(self):
"""save_to_db 应该调用 __enter__ 和 __exit__。"""
mock_db = MagicMock()
mock_db.__enter__ = MagicMock(return_value=mock_db)
mock_db.__exit__ = MagicMock(return_value=None)
mock_db.query.return_value.filter.return_value.first.return_value = None
session_service = ActiveSessionService(db_factory=lambda: mock_db)
session_id = "test-006"
session_service.store.set(session_id, {
"session_id": session_id,
"room_id": "",
"channel": "wechat_group",
"conversation_history": [],
"intent_session": "",
})
session_service.save_to_db(session_id)
mock_db.__enter__.assert_called_once()
mock_db.__exit__.assert_called_once()
- Step 2: 运行新测试
PYTHONPATH=. python -m pytest tests/test_intent_session_lifecycle.py -v --tb=short
期望:7 passed(如果没有 env 相关 import 问题)
- Step 3: 修复任何 mock 缺口
检查失败原因并修复。常见问题:
-
mock_db.__enter__返回类型不匹配 → 调整 mock 返回 ORM Session 创建参数校验 → 确保
mock_db.add.call_args[0][0]是Session实例Step 4: Commit
git add tests/test_intent_session_lifecycle.py
git commit -m "$(cat <<'EOF'
test: add intent_session lifecycle tests (write/read/degradation/short-session)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
Task 9: 运行全部核心测试
- Step 1: 运行核心测试套件
PYTHONPATH=. python -m pytest tests/test_session_persistence.py tests/test_session_buffer.py tests/test_intent_session_lifecycle.py -v --tb=short
期望:全部 pass
- Step 2: 运行 AgentHub 测试(确认没有回归)
PYTHONPATH=. python -m pytest tests/test_agent_hub.py -v --tb=short
期望:37/37 pass(与当前基线一致)
- Step 3: 运行 MessageGate 测试(如存在)
find tests/ -name "*message_gate*" -o -name "*routing*" | xargs PYTHONPATH=. python -m pytest -v --tb=short
- Step 4: 运行全量测试
PYTHONPATH=. python -m pytest tests/ -v --tb=short 2>&1 | grep -E "passed|failed|error"
期望:与当前基线一致(无新增失败)
- Step 5: Commit
git commit -m "$(cat <<'EOF'
test: all core tests pass with intent_session changes
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)"
完工检查清单
- 所有 Task 0-9 的 commit 均已完成
-
grep -rn "self._db\b" app/除了self._db_factory无self._db独立引用 -
grep -rn "\._db\.query\|\._db\.commit\|\._db\.rollback\|\._db\.add\|\._db\.close" app/期望 0 match -
grep -rn "ActiveSessionService(db=" app/期望 0 match -
grep -rn "ActiveSessionService(db_factory=" app/期望 1 match(main.py:78) - 核心测试 37/37 pass
- 全量测试 221 total / 24 pre-existing failures(无新增)