From 907c6eff8c2db54da7287120af9c8c02cc1b5899 Mon Sep 17 00:00:00 2001 From: matevip Date: Mon, 20 Apr 2026 17:34:40 +0800 Subject: [PATCH] fix(memory): add success-path debug logs to MemoryLifecycleMediator beforeLlmCall / afterLlmCall / onSessionEnd only logged on failure, making flag on/off indistinguishable in logs. Add debug lines on the success path so lifecycle activation is observable. --- .../vip/mate/memory/lifecycle/MemoryLifecycleMediator.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mateclaw-server/src/main/java/vip/mate/memory/lifecycle/MemoryLifecycleMediator.java b/mateclaw-server/src/main/java/vip/mate/memory/lifecycle/MemoryLifecycleMediator.java index d19c4b48..eb5e1e30 100644 --- a/mateclaw-server/src/main/java/vip/mate/memory/lifecycle/MemoryLifecycleMediator.java +++ b/mateclaw-server/src/main/java/vip/mate/memory/lifecycle/MemoryLifecycleMediator.java @@ -44,6 +44,8 @@ public class MemoryLifecycleMediator { try { String context = memoryManager.prefetchAll(ctx.agentId(), ctx.userQuery()); events.publishEvent(new TurnStartedEvent(ctx)); + log.debug("[Memory] beforeLlmCall: agent={}, contextLen={}", ctx.agentId(), + context != null ? context.length() : 0); return context; } catch (Exception e) { log.debug("[Memory] beforeLlmCall failed (non-fatal): {}", e.getMessage()); @@ -61,6 +63,8 @@ public class MemoryLifecycleMediator { memoryManager.syncAll(ctx.agentId(), ctx.conversationId(), ctx.userQuery(), assistantReply); events.publishEvent(new TurnCompletedEvent(ctx, assistantReply)); + log.debug("[Memory] afterLlmCall: agent={}, conv={}, replyLen={}", ctx.agentId(), + ctx.conversationId(), assistantReply != null ? assistantReply.length() : 0); } catch (Exception e) { log.debug("[Memory] afterLlmCall failed (non-fatal): {}", e.getMessage()); } @@ -72,6 +76,7 @@ public class MemoryLifecycleMediator { public void onSessionEnd(Long agentId, String conversationId) { try { memoryManager.onSessionEnd(agentId, conversationId); + log.debug("[Memory] onSessionEnd: agent={}, conv={}", agentId, conversationId); } catch (Exception e) { log.debug("[Memory] onSessionEnd dispatch failed (non-fatal): {}", e.getMessage()); }