From 6173dbd6d73bc082e9fa757578a1ba1d4b582dc8 Mon Sep 17 00:00:00 2001 From: toki Date: Sat, 15 Aug 2026 15:34:33 +0900 Subject: [PATCH] =?UTF-8?q?fix(openai):=20cleanup=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=9D=B4=EC=A0=84=20tool=20result=EB=A5=BC=20=EB=AC=B4?= =?UTF-8?q?=EC=8B=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/edge/internal/openai/hot_path_cleanup.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/edge/internal/openai/hot_path_cleanup.go b/apps/edge/internal/openai/hot_path_cleanup.go index e82d68f3..d4bd7624 100644 --- a/apps/edge/internal/openai/hot_path_cleanup.go +++ b/apps/edge/internal/openai/hot_path_cleanup.go @@ -274,10 +274,20 @@ func (s *hotPathLightStore) consumeCleanupLocked( results []workspaceResult, coordinator *logicalRequestCoordinator, ) (logicalRequestSnapshot, hotPathLightDisposition, bool, error) { - if record.terminalIntent == nil || len(record.pending) != 1 || len(results) != 1 { + if record.terminalIntent == nil || len(record.pending) != 1 { + return logicalRequestSnapshot{}, hotPathLightDisposition{}, true, fmt.Errorf("cleanup result set mismatch") + } + var result workspaceResult + matchedResults := 0 + for _, candidate := range results { + if _, ok := record.pending[candidate.callID]; ok { + result = candidate + matchedResults++ + } + } + if matchedResults != 1 { return logicalRequestSnapshot{}, hotPathLightDisposition{}, true, fmt.Errorf("cleanup result set mismatch") } - result := results[0] pending, ok := record.pending[result.callID] if !ok || pending.payload == nil { return logicalRequestSnapshot{}, hotPathLightDisposition{}, true, fmt.Errorf("cleanup result id is not pending")