fix: 无start节点时第一个节点收不到初始input_data导致执行失败

定时任务触发的工作流中,如果只有 agent 节点而没有 start 节点,
get_node_input 返回空 {},且 fallback 仅对 type=='start' 生效,
导致 run_agent_node 收不到 query 而返回错误。

修复:无入边且 input 为空时,所有节点类型均可获取初始 input_data。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
renjianbo
2026-05-08 23:03:30 +08:00
parent a75c509847
commit f79dc0b3c6

View File

@@ -5742,8 +5742,11 @@ class WorkflowEngine:
for nid in ready_nodes:
node = self.nodes[nid]
node_input = self.get_node_input(nid, self.node_outputs, active_edges)
if node.get('type') == 'start' and not node_input:
node_input = input_data
# start 节点无条件获取初始输入;非 start 节点无入边时同样需要
if not node_input:
incoming = [e for e in active_edges if e["target"] == nid]
if not incoming:
node_input = input_data
node_inputs[nid] = node_input
# 预算检查(整批节点)