fix(engine): resolve parallel execution races and improve max steps semantics
- Fix data race in runParallelBranches where first error could be masked - Improve MaxSteps to allow exactly N steps - Consolidate Resume validation logic and fix silent overwrite in Graph AddNode/AddEdge - Add sync.RWMutex to Engine for thread-safe configuration - Fix P2 issues: Add immediate check for router output, add mutex to hooks example, add context timeout to translation example, and update docs for Checkpointer.Delete
This commit is contained in:
1 parent
d2d8eb5a3a
commit
5782504351
10 files changed
+287
-47
No files matched your search
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
GopherGraph "github.com/unclesam-ly/GopherGraph"
|
||||
)
|
||||
@@ -122,7 +123,8 @@ func main() {
|
||||
// 包含敏感词“秘密”,会触发人工审核中断:
|
||||
inputText := "这是一个秘密你好"
|
||||
fmt.Printf("🚀 启动工作流,输入原文: %q\n", inputText)
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
|
||||
defer cancel()
|
||||
thread, err := cg.Start(ctx, "translator", TranslationState{InputText: inputText})
|
||||
if err != nil {
|
||||
fmt.Printf("运行失败: %v\n", err)
|
||||
|
||||
Reference in new issue
Block a user