feat: Step 5 引擎接入 + H1-H3/S3 修复 + 审计 D1/D2/D5 修复
引擎接入(dispatcher/spawner/ticker → handler 统一路由): - dispatcher: guardrail/on_checks_passed/on_complete → handler 查询 - spawner: _build_prompt/_build_api_section → handler.build_prompt - ticker: 虚拟项目扫描/assignee/claimed/review/幻觉门控 → handler 判断 Handler 缺陷修复: - H1: _mark_task_status 加 3 次重试(防 DB 锁) - H2: review @mention 加 comment_type='review' - H3: review 非 approved 保持 review 状态(不标 working) - S3: 通知链接改 Gitea(PR/Issue/Commit) 审计修复: - D1: pre_spawn 返回值未检查 → 加 if not 抛 RuntimeError - D2: PromptContext 缺 from_agent/mail_type → 从 must_haves 解析 - D5: _check_reply 查错表 → 恢复查 tasks 表找 in_reply_to 旧方法保留未删(deprecated),确认稳定后再清理。
This commit is contained in:
@@ -93,23 +93,26 @@ class MailHandler(BaseTaskHandler):
|
||||
return "request"
|
||||
|
||||
def _check_reply(self, task_id: str, db_path: Path) -> bool:
|
||||
"""检查是否已回复(从 dispatcher._mail_check_reply 迁移)"""
|
||||
"""检查是否已回复(查 tasks 表找 in_reply_to 回复邮件)
|
||||
|
||||
从 dispatcher._mail_check_reply 迁移。
|
||||
Mail 回复机制:创建新 task,must_haves JSON 中包含 in_reply_to = original_task_id。
|
||||
不能查 comments 表——回复邮件是独立的 task,不是 comment。
|
||||
"""
|
||||
try:
|
||||
conn = get_connection(db_path)
|
||||
try:
|
||||
row = conn.execute(
|
||||
"SELECT COUNT(*) as cnt FROM comments "
|
||||
"WHERE task_id=? AND author != 'daemon' "
|
||||
"AND comment_type != 'system'",
|
||||
(task_id,)
|
||||
"SELECT id FROM tasks WHERE id != ? AND must_haves LIKE ? LIMIT 1",
|
||||
(task_id, f'%{task_id}%'),
|
||||
).fetchone()
|
||||
count = row["cnt"] if row else 0
|
||||
return count > 0
|
||||
return row is not None
|
||||
finally:
|
||||
conn.close()
|
||||
except Exception as e:
|
||||
logger.error("Mail %s: check reply error: %s", task_id, e)
|
||||
return False
|
||||
# 查询失败时保守处理:假设有回复(避免误标 failed)
|
||||
return True
|
||||
|
||||
def check_completion(self, task_id: str, db_path: Path) -> bool:
|
||||
"""ticker 级别的完成检查:检查是否已回复"""
|
||||
|
||||
Reference in New Issue
Block a user