From d0f96723ea5f50ced1b9d93916c984b15539c746 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Wed, 25 Mar 2026 20:20:19 +0800 Subject: [PATCH] fix: plugin catch (#6643) --- document/content/docs/self-host/upgrading/4-14/4149.mdx | 1 + document/data/doc-last-modified.json | 4 ++-- packages/service/core/workflow/dispatch/index.ts | 8 +++++--- packages/service/core/workflow/dispatch/plugin/run.ts | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/document/content/docs/self-host/upgrading/4-14/4149.mdx b/document/content/docs/self-host/upgrading/4-14/4149.mdx index 9d73eaa7d0..7b5fba009e 100644 --- a/document/content/docs/self-host/upgrading/4-14/4149.mdx +++ b/document/content/docs/self-host/upgrading/4-14/4149.mdx @@ -68,6 +68,7 @@ CODE_SANDBOX_TOKEN=代码运行沙盒的凭证 14. 用户输入框消息不转义成 markdown 格式 15. 修复 AgentV2 部分上下文拼接错误。 16. login 接口安全风险。 +17. 工作流工具未按预期连接到结束节点时,嵌套调用工作流工具会导致父工作流无法停止。 ## 代码优化 diff --git a/document/data/doc-last-modified.json b/document/data/doc-last-modified.json index d76ec3a567..e3e3fbfd51 100644 --- a/document/data/doc-last-modified.json +++ b/document/data/doc-last-modified.json @@ -220,7 +220,7 @@ "document/content/docs/self-host/upgrading/4-14/4140.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4141.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4141.mdx": "2026-03-03T17:39:47+08:00", - "document/content/docs/self-host/upgrading/4-14/41410.mdx": "2026-03-24T18:02:38+08:00", + "document/content/docs/self-host/upgrading/4-14/41410.mdx": "2026-03-25T14:45:38+08:00", "document/content/docs/self-host/upgrading/4-14/4142.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4142.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4143.en.mdx": "2026-03-03T17:39:47+08:00", @@ -240,7 +240,7 @@ "document/content/docs/self-host/upgrading/4-14/41481.en.mdx": "2026-03-09T12:02:02+08:00", "document/content/docs/self-host/upgrading/4-14/41481.mdx": "2026-03-09T17:39:53+08:00", "document/content/docs/self-host/upgrading/4-14/4149.en.mdx": "2026-03-23T12:17:04+08:00", - "document/content/docs/self-host/upgrading/4-14/4149.mdx": "2026-03-25T13:54:15+08:00", + "document/content/docs/self-host/upgrading/4-14/4149.mdx": "2026-03-25T14:45:38+08:00", "document/content/docs/self-host/upgrading/outdated/40.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/outdated/40.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/outdated/41.en.mdx": "2026-03-03T17:39:47+08:00", diff --git a/packages/service/core/workflow/dispatch/index.ts b/packages/service/core/workflow/dispatch/index.ts index d86b7de94a..adcfd8a3ff 100644 --- a/packages/service/core/workflow/dispatch/index.ts +++ b/packages/service/core/workflow/dispatch/index.ts @@ -669,7 +669,6 @@ export class WorkflowQueue { await this.processSkipNodes(); continue; } else { - this.resolve(this); break; } } @@ -679,7 +678,6 @@ export class WorkflowQueue { await this.processSkipNodes(); continue; } else { - this.resolve(this); break; } } @@ -688,7 +686,9 @@ export class WorkflowQueue { if (this.activeRunQueue.size === 0 || runningNodePromises.size >= this.maxConcurrency) { if (runningNodePromises.size > 0) { // 当上一个节点运行结束时,立即运行下一轮 - await Promise.race(runningNodePromises); + await Promise.race(runningNodePromises).catch((error) => { + logger.error('Workflow race error', { error }); + }); } else { // 理论上不应出现此情况,防御性退回到让出进程 await surrenderProcess(); @@ -713,6 +713,7 @@ export class WorkflowQueue { } } } finally { + this.resolve(this); this.processingActive = false; } } @@ -1100,6 +1101,7 @@ export class WorkflowQueue { (Array.isArray(toolResponses) && toolResponses.length > 0) || (!Array.isArray(toolResponses) && typeof toolResponses === 'object' && + toolResponses !== null && Object.keys(toolResponses).length > 0) ) { this.toolRunResponse = toolResponses; diff --git a/packages/service/core/workflow/dispatch/plugin/run.ts b/packages/service/core/workflow/dispatch/plugin/run.ts index 2534297f04..beef59c6ad 100644 --- a/packages/service/core/workflow/dispatch/plugin/run.ts +++ b/packages/service/core/workflow/dispatch/plugin/run.ts @@ -229,7 +229,7 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise