缺陷 / 高 / 工具系统
electron/harness/tools/registry.ts
ToolRegistry 使用 Promise.race([tool.execute(), timeout]) 实现超时控制。 超时触发后,timeout Promise resolve,但原 tool.execute() Promise 仍在后台运行,无法取消:
Promise.race([tool.execute(), timeout])
tool.execute()
Tool.execute
async executeWithTimeout(tool, input, timeoutMs) { const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), timeoutMs); try { return await Promise.race([ tool.execute(input, { signal: controller.signal }), new Promise((_, reject) => controller.signal.addEventListener('abort', () => reject(new Error('Tool timeout')) ) ), ]); } finally { clearTimeout(timer); } }
signal.aborted
No dependencies set.
The note is not visible to the blocked user.
问题类型
缺陷 / 高 / 工具系统
文件位置
electron/harness/tools/registry.ts问题描述
ToolRegistry 使用
Promise.race([tool.execute(), timeout])实现超时控制。超时触发后,timeout Promise resolve,但原
tool.execute()Promise 仍在后台运行,无法取消:影响
建议修复
Tool.execute签名中传入 AbortSignalsignal.aborted