diff --git a/src/hooks/bundled/session-memory/handler.test.ts b/src/hooks/bundled/session-memory/handler.test.ts index b5b5ef3ce13..c2a7e07b79c 100644 --- a/src/hooks/bundled/session-memory/handler.test.ts +++ b/src/hooks/bundled/session-memory/handler.test.ts @@ -618,7 +618,7 @@ describe("session-memory hook", () => { const files = (await fs.readdir(memoryDir)).filter((f) => f.endsWith(".md")); expect(files.length).toBeGreaterThan(0); const content = await fs.readFile(path.join(memoryDir, files[0]), "utf-8"); - expect(content).toContain("Custom summary from upstream hook"); + expect(content).toBe("Custom summary from upstream hook"); expect(content).not.toContain("original"); }); diff --git a/src/hooks/bundled/session-memory/handler.ts b/src/hooks/bundled/session-memory/handler.ts index c6bfa6d0a9a..94cbf9791d7 100644 --- a/src/hooks/bundled/session-memory/handler.ts +++ b/src/hooks/bundled/session-memory/handler.ts @@ -353,6 +353,11 @@ const saveSessionToMemory: HookHandler = async (event) => { // An empty string is a valid redaction signal — hooks may intentionally // set it to persist a blank marker while avoiding transcript retention. const customContent = context.sessionSaveContent; + if (typeof customContent === "string") { + log.debug("Using custom session content from upstream hook", { + length: customContent.length, + }); + } const entry = typeof customContent === "string" ? customContent : entryParts.join("\n"); // Write under memory root with alias-safe file validation.