refactor(dispatcher): T1.1 退役 graph.go —— 编排引擎收成单一 compose
compose 已默认数天、HITL/多智能体/评测全在其上真实跑过,soak 充分。删掉自研拓扑 解释器这第二套引擎,消灭"双实现 drift"税: - 删 runGraph(graph.go 的自研解释器)+ composeEnabled/EINO_COMPOSE 逃生舱开关 + runConversation(仅 runGraph 用的死代码)。 - executeGraph 直接走 runComposeGraph;compose 编译失败兜底改单轮对话(不再回退 graph.go);清掉仅 runGraph 用的 import(otel attribute/trace/otelx)。 - 保留 board / 各节点执行器(retriever/tool/agent/branch/approval/map/render/aggregate) / 工具函数 —— 它们是 compose 各节点 lambda 复用的,非 graph.go 专属。 - 测试:8 处 runGraph→runComposeGraph;等价测试(对照两引擎)转为 compose 正确性测试; runConversation 的开关测试转为「无 ChatModel 降级 runAgent」。 go test ./... 全绿 + vet 干净;冒烟 简单 agent/分支图 跑通。此后每个编排改动不再两边 对齐,成本减半。DEPTH_ROADMAP T1.1 ✅。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -50,10 +50,8 @@ func TestComposeGraphRuns(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestComposeConversationEquivalent 验证 EINO_COMPOSE=1 时对话主流程走 compose 路径,
|
||||
// 把模型输出流式回流到 sink 并累计成稿——与自研 runAgent 行为等价(都逐片转发模型输出)。
|
||||
func TestComposeConversationEquivalent(t *testing.T) {
|
||||
t.Setenv("EINO_COMPOSE", "1")
|
||||
// TestComposeConversation 验证对话主流程走 compose 路径:模型输出流式回流到 sink 并累计成稿。
|
||||
func TestComposeConversation(t *testing.T) {
|
||||
fs := &fakeSink{}
|
||||
o := &Orchestrator{
|
||||
pool: &fakeLLM{ready: true, cm: &stubModel{reply: "我是 compose 路径的回答"}},
|
||||
@@ -61,8 +59,7 @@ func TestComposeConversationEquivalent(t *testing.T) {
|
||||
sink: fs,
|
||||
}
|
||||
b := &board{query: "你好"}
|
||||
tr := &execTracer{} // sink 为 nil → 轨迹发射空操作
|
||||
o.runConversation(context.Background(), "task_compose", b, "", tr, "agent")
|
||||
o.runComposeConversation(context.Background(), "task_compose", b, "", &execTracer{}, "agent")
|
||||
|
||||
if !strings.Contains(b.answer, "compose 路径") {
|
||||
t.Fatalf("成稿未含模型输出: %q", b.answer)
|
||||
@@ -72,18 +69,18 @@ func TestComposeConversationEquivalent(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestComposeDisabledUsesRunAgent 验证开关关闭时仍走自研 runAgent(默认行为不变)。
|
||||
func TestComposeDisabledUsesRunAgent(t *testing.T) {
|
||||
t.Setenv("EINO_COMPOSE", "0")
|
||||
// TestComposeConversationDegradesToRunAgent 验证无 Eino ChatModel 时降级回 runAgent(流式回流不丢)。
|
||||
func TestComposeConversationDegradesToRunAgent(t *testing.T) {
|
||||
fs := &fakeSink{}
|
||||
o := &Orchestrator{
|
||||
pool: &fakeLLM{ready: true, stream: func([]llm.ChatMessage) string { return "自研路径回答" }},
|
||||
// cm 为 nil → ChatModel() 返回 nil → runComposeConversation 降级 runAgent(走 stream 桩)。
|
||||
pool: &fakeLLM{ready: true, stream: func([]llm.ChatMessage) string { return "降级路径回答" }},
|
||||
breaker: harness.NewCircuitBreaker(),
|
||||
sink: fs,
|
||||
}
|
||||
b := &board{query: "你好"}
|
||||
o.runConversation(context.Background(), "task_legacy", b, "", &execTracer{}, "agent")
|
||||
if !strings.Contains(b.answer, "自研路径") {
|
||||
t.Fatalf("未走自研路径: %q", b.answer)
|
||||
o.runComposeConversation(context.Background(), "task_degrade", b, "", &execTracer{}, "agent")
|
||||
if !strings.Contains(b.answer, "降级路径") {
|
||||
t.Fatalf("无 ChatModel 应降级 runAgent 出稿: %q", b.answer)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user