fix(session-memory): add debug log for custom content, tighten test assertion
- Add log.debug when sessionSaveContent override is used (symmetric with blockSessionSave) - Change override test assertion from toContain to toBe for precision
This commit is contained in:
parent
65fae19fc8
commit
7a81cc94d3
@ -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");
|
||||
});
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user