diff --git a/src/auto-reply/reply/session.ts b/src/auto-reply/reply/session.ts index a70ff6909d6..36131932bb4 100644 --- a/src/auto-reply/reply/session.ts +++ b/src/auto-reply/reply/session.ts @@ -558,7 +558,6 @@ export async function initSessionState(params: { }, ); - // When a session is auto-reset (idle timeout or daily reset), emit a // When a session is auto-reset (idle timeout or daily reset), emit a // session:reset internal hook so the session-memory hook can persist // the outgoing session context — just as it does for manual /new and /reset. @@ -566,6 +565,17 @@ export async function initSessionState(params: { // the handler reads it, getRecentSessionContentWithResetFallback() will // locate it via the .reset.* sibling naming convention. if (isNewSession && !resetTriggered && previousSessionEntry) { + const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId); + const autoResetEvent = createInternalHookEvent("session", "reset", sessionKey, { + sessionEntry, + previousSessionEntry, + commandSource: "auto-reset", + workspaceDir, + cfg, + }); + void triggerInternalHook(autoResetEvent).catch((err) => { + log.debug("session:reset hook error (auto-reset)", { error: String(err) }); + }); } // Archive old transcript so it doesn't accumulate on disk (#14869).