From 014a46d3fc3695864fc7a34da6ff756f81ed77c1 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 17 Feb 2026 02:34:09 +0100 Subject: [PATCH] Revert "fix: session-memory hook finds previous session file after /new/reset" This reverts commit d6acd71576cda5a319abbcc244614eb5be91045d. --- src/hooks/bundled/session-memory/handler.ts | 25 +-------------------- 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/src/hooks/bundled/session-memory/handler.ts b/src/hooks/bundled/session-memory/handler.ts index ceb6d5775e1..5b606d37735 100644 --- a/src/hooks/bundled/session-memory/handler.ts +++ b/src/hooks/bundled/session-memory/handler.ts @@ -133,35 +133,12 @@ const saveSessionToMemory: HookHandler = async (event) => { const dateStr = now.toISOString().split("T")[0]; // YYYY-MM-DD // Generate descriptive slug from session using LLM - // Prefer previousSessionEntry (old session before /new) over current (which may be empty) const sessionEntry = (context.previousSessionEntry || context.sessionEntry || {}) as Record< string, unknown >; - let currentSessionFile = (sessionEntry.sessionFile as string) || undefined; - - // If sessionFile is empty or looks like a new/reset file, try to find the previous session file - if (!currentSessionFile || currentSessionFile.includes(".reset.")) { - // Look for previous session file in the sessions directory - const sessionsDir = path.dirname(currentSessionFile || ""); - if (sessionsDir) { - try { - const files = await fs.readdir(sessionsDir); - const sessionFiles = files - .filter((f) => f.endsWith(".jsonl") && !f.includes(".reset.")) - .toSorted() - .toReversed(); - if (sessionFiles.length > 0) { - currentSessionFile = path.join(sessionsDir, sessionFiles[0]); - log.debug("Found previous session file", { file: currentSessionFile }); - } - } catch { - // Ignore errors reading directory - } - } - } - const currentSessionId = sessionEntry.sessionId as string; + const currentSessionFile = sessionEntry.sessionFile as string; log.debug("Session context resolved", { sessionId: currentSessionId,