coze-dev / coze-dev/coze-studio
executable_impl.GetNodeExecution是否逻辑错误
- Dominant language
- TypeScript
- Stars
- 21.6k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
版本:0.5.1
```
func (i *impl) GetNodeExecution(ctx context.Context, exeID int64, nodeID string) (*entity.NodeExecution, *entity.NodeExecution, error) {
nodeExe, found, err := i.repo.GetNodeExecution(ctx, exeID, nodeID)
if err != nil {
return nil, nil, err
}
if !found {
return nil, nil, fmt.Errorf("try getting node exe for exeID : %d, nodeID : %s, but not found", exeID, nodeID)
}
if nodeExe.NodeType != entity.NodeTypeBatch {
return nodeExe, nil, nil
}
wfExe, found, err := i.repo.GetWorkflowExecution(ctx, exeID)
if err != nil {
return nil, nil, err
}
if !found {
return nil, nil, fmt.Errorf("try getting workflow exe for exeID : %d, but not found", exeID)
}
if wfExe.Mode != workflowModel.ExecuteModeNodeDebug {
return nodeExe, nil, nil
}
// when node debugging a node with batch mode, we need to query the inner node executions and return it together
innerNodeExecs, err := i.repo.GetNodeExecutionByParent(ctx, exeID, nodeExe.NodeID)
if err != nil {
return nil, nil, err
}
for i := range innerNodeExecs {
innerNodeID := innerNodeExecs[i].NodeID
if !vo.IsGeneratedNodeForBatchMode(innerNodeID, nodeExe.NodeID) {
// inner node is not generated, means this is normal batch, not node in batch mode
return nodeExe, nil, nil
}
}
var (
maxIndex int
index2Exe = make(map[int]*entity.NodeExecution)
)
for i := range innerNodeExecs {
index2Exe[innerNodeExecs[i].Index] = innerNodeExecs[i]
if innerNodeExecs[i].Index > maxIndex {
maxIndex = innerNodeExecs[i].Index
}
}
return nodeExe, mergeCompositeInnerNodes(index2Exe, maxIndex), nil
}
```
判断节点类型若不是批处理节点,就直接返回节点的历史执行信息,
但后续的判断IsGeneratedNodeForBatchMode是针对于有批处理模式的节点的,比如大模型节点,而非批处理节点
Contributor guide
Research direction
Start at executable_impl.GetNodeExecution and trace the repository calls for node and workflow executions. Verify whether the node-type branch handles batch-mode nodes correctly, then confirm the behavior for ordinary batch nodes and node-debug executions; done means the returned execution data matches the applicable node mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100