fix(tools): avoid retaining result executions

This commit is contained in:
Yichen Jiang
2026-07-19 20:14:32 +08:00
parent 55a66024fa
commit d49808c6dd
+2 -1
View File
@@ -958,8 +958,9 @@ export class ToolRegistry extends Service {
// Freeze the remaining mutable signal slot before observers receive the
// shared WeakMap-keyable execution object.
Object.freeze(exec)
const { name: toolName, callId } = exec
const reportFailure = (error: unknown): void => {
this.ctx.logger.warn(`tool "${exec.name}" (${exec.callId}): tools/result observer failed: ${errorMessage(error)}`)
this.ctx.logger.warn(`tool "${toolName}" (${callId}): tools/result observer failed: ${errorMessage(error)}`)
}
const callbacks = this.ctx.events.dispatch('emit', [
scopeTarget(this, exec.agent), 'tools/result', exec, result,