Summary
Daily/scheduled session reset (when evaluateSessionFreshness() detects a stale session) does not trigger the session-memory hook to save conversation context to ~/.openclaw/workspace/memory/. Only manual /new or /reset commands trigger the hook.
Root Cause
In src/auto-reply/reply/session.ts, when a daily reset occurs (!freshEntry), a new session is created silently without firing any internal hooks:
// Line 378-379
} else {
sessionId = crypto.randomUUID(); // Silent reset, no hook triggered
isNewSession = true;
}
The session-memory hook only triggers on command:new or command:reset events:
// src/hooks/bundled/session-memory/handler.ts:199-204
const isResetCommand = event.action === "new" || event.action === "reset";
if (event.type !== "command" || !isResetCommand) {
return;
}
Manual /new goes through commands-core.ts:281 → emitResetCommandHooks(), which triggers the hook. Daily reset bypasses this entirely.
Impact
Users lose conversation context summaries when sessions reset automatically at the configured session.reset.atHour (default 4am). The transcript is archived to .reset. files, but the LLM-generated summary in workspace/memory/ is never created.
Reproduction Steps
- Configure daily reset:
openclaw config set session.reset.mode daily
- Chat in a session (e.g., Feishu DM) at 2am
- Wait until after 4am (or adjust system time)
- Send another message at 6am
- Observe: session resets automatically (new sessionId), but no new file in
workspace/memory/
- Compare: Send
/new manually → session-memory hook fires, memory file created
Expected Behavior
Daily/scheduled reset should also trigger session-memory hook (or equivalent flush mechanism) to save conversation context before rotating the session.
References
- Related fix: commit 709dc67 (fixed transcript archival on daily reset, but not memory flush)
- Hook handler:
src/hooks/bundled/session-memory/handler.ts
- Session init:
src/auto-reply/reply/session.ts:354-379
Summary
Daily/scheduled session reset (when
evaluateSessionFreshness()detects a stale session) does not trigger thesession-memoryhook to save conversation context to~/.openclaw/workspace/memory/. Only manual/newor/resetcommands trigger the hook.Root Cause
In
src/auto-reply/reply/session.ts, when a daily reset occurs (!freshEntry), a new session is created silently without firing any internal hooks:The
session-memoryhook only triggers oncommand:neworcommand:resetevents:Manual
/newgoes throughcommands-core.ts:281→emitResetCommandHooks(), which triggers the hook. Daily reset bypasses this entirely.Impact
Users lose conversation context summaries when sessions reset automatically at the configured
session.reset.atHour(default 4am). The transcript is archived to.reset.files, but the LLM-generated summary inworkspace/memory/is never created.Reproduction Steps
openclaw config set session.reset.mode dailyworkspace/memory//newmanually →session-memoryhook fires, memory file createdExpected Behavior
Daily/scheduled reset should also trigger
session-memoryhook (or equivalent flush mechanism) to save conversation context before rotating the session.References
src/hooks/bundled/session-memory/handler.tssrc/auto-reply/reply/session.ts:354-379