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.
This commit is contained in:
matevip 2026-04-20 17:34:40 +08:00
parent 74928d615d
commit 907c6eff8c

View File

@ -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());
}