fix(session-memory): skip transcript loading and LLM call when blockSessionSave is pre-set
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.
This commit is contained in:
parent
0621de4773
commit
64d52cf2ea
@ -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", {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user