优化: AI Chat全栈多批审查修复与架构清理(risk_level清理/路由解耦/工具渲染/测试补测/死代码)
This commit is contained in:
@@ -135,13 +135,25 @@ impl DagExecutor {
|
||||
// 与 Err 分支 is_cancelled 短路对称:已取消节点保持 Cancelled 终态
|
||||
if !self.state_machine.is_cancelled(&node_id) {
|
||||
self.state_machine.set_completed(node_id.clone())?;
|
||||
// 未取消才 emit NodeCompleted,取消时 emit NodeCancelled(对齐 Err 分支语义):
|
||||
// 避免 状态机=Cancelled 但事件=NodeCompleted 的矛盾信号
|
||||
self.event_bus
|
||||
.send(WorkflowEvent::NodeCompleted {
|
||||
node_id: node_id.clone(),
|
||||
duration_ms: duration,
|
||||
})
|
||||
.await;
|
||||
} else {
|
||||
// 对齐 Err 分支:取消节点 emit NodeCancelled(非 NodeCompleted),
|
||||
// 前端按 type 归「取消」,与状态机 Cancelled 一致
|
||||
self.event_bus
|
||||
.send(WorkflowEvent::NodeCancelled {
|
||||
node_id: node_id.clone(),
|
||||
})
|
||||
.await;
|
||||
}
|
||||
self.event_bus
|
||||
.send(WorkflowEvent::NodeCompleted {
|
||||
node_id: node_id.clone(),
|
||||
duration_ms: duration,
|
||||
})
|
||||
.await;
|
||||
// outputs.insert 保留现状不动:取消时仍写入 output 供下游消费,
|
||||
// 当前测试锁定"取消不中止后续层",改 insert 会变行为致回归
|
||||
outputs.insert(node_id, output);
|
||||
}
|
||||
Err(e) => {
|
||||
|
||||
Reference in New Issue
Block a user