From e6ee71a9b4c1afbda451339a6b72abf80f5ce2ad Mon Sep 17 00:00:00 2001 From: chenhaoli Date: Fri, 29 Aug 2025 00:43:20 +0800 Subject: [PATCH] fix(tarko): add safety check for agent.dispose in session cleanup --- multimodal/tarko/agent-server/src/core/AgentSession.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/multimodal/tarko/agent-server/src/core/AgentSession.ts b/multimodal/tarko/agent-server/src/core/AgentSession.ts index c101fe7768..a7a004be98 100644 --- a/multimodal/tarko/agent-server/src/core/AgentSession.ts +++ b/multimodal/tarko/agent-server/src/core/AgentSession.ts @@ -451,7 +451,9 @@ export class AgentSession { } // Clean up agent resources - await this.agent.dispose(); + if (this.agent && typeof this.agent.dispose === 'function') { + await this.agent.dispose(); + } if (this.agioProvider) { // This ensures that all buffered analytics events are sent before the session is terminated.