From 64d52cf2ea73ca58b0dee15ca54618d729e0952f Mon Sep 17 00:00:00 2001 From: zeroaltitude Date: Sat, 7 Mar 2026 09:52:48 -0700 Subject: [PATCH] fix(session-memory): skip transcript loading and LLM call when blockSessionSave is pre-set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When blockSessionSave is already true, the handler was still loading session content and potentially calling generateSlugViaLLM — sending sensitive transcript text to a model provider despite an explicit block. Short-circuit before transcript loading when the flag is set. Credit: Codex review. --- src/hooks/bundled/session-memory/handler.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hooks/bundled/session-memory/handler.ts b/src/hooks/bundled/session-memory/handler.ts index e4b84218242..fa038880051 100644 --- a/src/hooks/bundled/session-memory/handler.ts +++ b/src/hooks/bundled/session-memory/handler.ts @@ -288,7 +288,12 @@ const saveSessionToMemory: HookHandler = async (event) => { let sessionContent: string | null = null; const hasCustomContent = typeof context.sessionSaveContent === "string"; - if (sessionFile && !hasCustomContent) { + // Short-circuit transcript loading and LLM slug generation when + // blockSessionSave is already set — no point loading sensitive content + // or sending it to a model provider when saving is explicitly blocked. + const blockPreSet = context.blockSessionSave === true; + + if (sessionFile && !hasCustomContent && !blockPreSet) { // Get recent conversation content, with fallback to rotated reset transcript. sessionContent = await getRecentSessionContentWithResetFallback(sessionFile, messageCount); log.debug("Session content loaded", {