From 5a135d855cf0ef073c9ba6458103f1724de38de6 Mon Sep 17 00:00:00 2001 From: zeroaltitude Date: Sat, 7 Mar 2026 13:06:20 -0700 Subject: [PATCH] docs: document known limitation for cleared sessionSaveContent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When an earlier hook pre-sets sessionSaveContent and a later hook clears it, the transcript is not available for fallback — it was never loaded. Hooks wanting to override should set their own content, not clear it. --- src/hooks/bundled/session-memory/handler.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hooks/bundled/session-memory/handler.ts b/src/hooks/bundled/session-memory/handler.ts index 56321d26b1d..fe4736c5bbc 100644 --- a/src/hooks/bundled/session-memory/handler.ts +++ b/src/hooks/bundled/session-memory/handler.ts @@ -293,6 +293,14 @@ const saveSessionToMemory: HookHandler = async (event) => { // or sending it to a model provider when saving is explicitly blocked. const blockPreSet = context.blockSessionSave === true; + // Known limitation: if an earlier hook pre-sets sessionSaveContent and + // a later hook *clears* it (expecting a revert to the default + // transcript), the transcript is not available — it was never loaded + // because hasCustomContent was true at this point. The post-hook + // cannot fall back to the default entry without re-reading the session + // file and re-running slug generation. In practice, hooks that want + // to override earlier custom content should set their own + // sessionSaveContent rather than clearing it. if (sessionFile && !hasCustomContent && !blockPreSet) { // Get recent conversation content, with fallback to rotated reset transcript. sessionContent = await getRecentSessionContentWithResetFallback(sessionFile, messageCount);