docs: document known limitation for cleared sessionSaveContent

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.
This commit is contained in:
zeroaltitude 2026-03-07 13:06:20 -07:00
parent 71609fa108
commit 5a135d855c
No known key found for this signature in database
GPG Key ID: 77592FB1C703882E

View File

@ -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);