From 24d7722ef94c180aad568184eba3247e504d2bbe Mon Sep 17 00:00:00 2001 From: AskaEth Date: Sun, 28 Jun 2026 16:16:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20storeThought=20orphaned=20lock=20?= =?UTF-8?q?=E2=86=92=20defer=20unlock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/ai-core/internal/background/thinker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/ai-core/internal/background/thinker.go b/backend/ai-core/internal/background/thinker.go index ddf4e3a..62df366 100644 --- a/backend/ai-core/internal/background/thinker.go +++ b/backend/ai-core/internal/background/thinker.go @@ -1895,6 +1895,7 @@ func (t *Thinker) buildOpenAITools() []llm.OpenAITool { // storeThought 存储思考结果到待推送队列,并异步持久化到 memory-service func (t *Thinker) storeThought(content string, toolCallsJSON string, toolCallCount int) { t.muLock() + defer t.muUnlock() t.pendingThoughts = append(t.pendingThoughts, &PendingThought{ Content: content, CreatedAt: time.Now(), @@ -1951,7 +1952,6 @@ func (t *Thinker) storeThought(content string, toolCallsJSON string, toolCallCou copy := *proactiveTarget targetCopy = © } - t.muUnlock() log.Printf("[后台思考] 思考已存储 (当前累积 %d 条待推送思考)", len(t.pendingThoughts))