fix(dispatcher): 多智能体专家超时 —— 卡死专家不再拖垮协调(T4.E)

- specialistTool 加 timeout 字段(默认 specialistTimeout=3min,专家可多轮 react+工具故给宽)
- InvokableRun 用 WithTimeout 包裹专家派发;超时(DeadlineExceeded)作为"观察"
  跳过该专家(err=nil),lead 据其余专家继续综合,不中断整个协调
- 2 单测:卡死专家 ~50ms 跳过并返回超时观察 / 正常专家不受影响
- timeout=0 时不包裹(向后兼容既有 specialistTool 构造)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-07-02 10:03:29 +08:00
parent de36ed4cb3
commit f9c849b14b
4 changed files with 82 additions and 8 deletions
@@ -92,6 +92,10 @@ const taskExecTimeout = 10 * time.Minute
// approvalTimeout 是单个审批节点等待人工决定的上限;超时安全默认拒绝(fail-safe)。
const approvalTimeout = 5 * time.Minute
// specialistTimeout 是多智能体单个专家派发的执行上限;超时即作为"观察"跳过该专家
// (不中断整个协调),避免单专家卡死拖垮 lead 无限等待。专家可能多轮 react+工具调用,故给较宽。
const specialistTimeout = 3 * time.Minute
// Orchestrator 把每个 DSL 任务动态编译为 Eino 图并执行(记忆召回 → 工具节点 → 注入 → 流式)。
type Orchestrator struct {
pool LLM