[moz] fix(spawner): _get_task_info SELECT 补 must_haves 字段 #86
Reference in New Issue
Block a user
Delete Branch "fix/spawner-get-task-info-must-haves"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
根因:_get_task_info 只 SELECT id, title, status,漏查 must_haves。 续杯/retry 路径从返回 dict 中 .get('must_haves') 永远拿到空值, 导致 PromptContext.event_type 为空,toolchain 通知显示「事件类型: 未知」。 修复:SELECT 补 must_haves 字段。 发现方式:L1 自蒸馏端到端验证中识别到 Recurrence-Count=2 信号审查结论:Approve
风险级别:高(文件匹配
**/spawner*规则,自动升级为高。改动本身极小但 spawner 是核心模块)改动验证
改动内容:
_get_task_infoSELECT 从id, title, status补为id, title, status, must_haves调用链追踪(2 层)
_get_task_info(line 1255)→ 返回dict(row),含must_haves字段task_info = self._get_task_info(db_path, task_id) or {}must_haves = task_info.get("must_haves", "{}")→ 修复前永远拿到{},修复后拿到实际值meta = json.loads(must_haves)→ 从 must_haves 解析出event_type、from等 meta 字段MAIL_RETRY_PROMPT.format(from_agent=meta.get("from", "unknown"))→ 修复前from_agent永远是unknown确认:调用链完整,修复正确解决 retry 路径 must_haves 空值问题。
事实核查
conn.row_factory = sqlite3.Row,dict(row) 正确映射列名_build_spawn_prompt补 event_type/event_data 到 PromptContext(主路径);#86 修_get_task_infoSELECT(retry 路径)。同一根因(消费者/生产者字段同步),两个代码路径正确性
must_haves可能为 NULL,但下游 line 1149 有task_info.get("must_haves", "{}")默认值保护_get_task_info有 try/except 包裹,异常时返回 Nonemust_haves一个字段,不多不少安全性
task_id仍用占位符),无注入风险一致性
_get_task_info其他 SELECT 字段保持不变测试覆盖
✅ 确认项:
Approve