sillytavern-character-memory/test/unit
bal-spec 572af212bd fix: don't reset the extraction pointer on branches under per-chat storage
SillyTavern copies chat_metadata into a new branch or checkpoint — saveChat
merges `{ ...chat_metadata, ...withMetadata }` (public/script.js:7347) — so
lastExtractedIndex arrives intact and the `lastIdx >= 0` guard on the
stale-metadata check holds.

But per-chat memory filenames embed the chat ID, and a freshly created branch
has a NEW chat ID, so it never has a memory file of its own. The check read
that as "no memories anywhere", concluded the metadata was stale, and reset
lastExtractedIndex to -1 — forcing a full re-extraction of every copied
message. Reported in #16.

Reproduced against SillyTavern 1.18.0 with a 1000-message chat: branching at
message 500 with perChat on reset the pointer 500 -> -1 and marked all 501
messages unextracted. With perChat off the pointer survived, which is what
made this look unreproducible — the shared file is found regardless of chat ID.

shouldSkipStaleMetadataReset() now also skips when the chat is a branch and
per-chat storage is on. Verified live: same branch now preserves the pointer,
and a genuinely stale non-branch chat still resets as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 23:56:26 -07:00
..
batchStateMigration.test.js feat: resolve ambiguous batchState records by chat ownership 2026-07-30 08:11:45 -07:00
chunkedConsolidation.test.js chore: final-review fixes for chunked consolidation 2026-04-23 15:16:01 -07:00
chunking.test.js chore: address code review for Task 1 chunking helpers 2026-04-23 12:55:37 -07:00
classification.test.js feat: add classifyBlocksForConsolidation pure function 2026-04-23 16:08:23 -07:00
editor.test.js v2.1.6 — UX redesign, injection viewer, unified editor, token breakdown 2026-03-07 15:20:14 -08:00
escaping.test.js Fix serialization and identity edge cases 2026-07-26 18:11:09 -04:00
extraction-gate.test.js feat(extraction): add pure shouldExtractNow decision function with lag + generation gate 2026-04-19 10:54:14 -07:00
findreplace.test.js v2.1.6 — UX redesign, injection viewer, unified editor, token breakdown 2026-03-07 15:20:14 -08:00
format-detection.test.js v2.1.6 — UX redesign, injection viewer, unified editor, token breakdown 2026-03-07 15:20:14 -08:00
memberResolution.test.js fix: don't reset the extraction pointer on branches under per-chat storage 2026-07-31 23:56:26 -07:00
parsing.test.js Fix serialization and identity edge cases 2026-07-26 18:11:09 -04:00
utils.test.js test: confirm formatChatMessages processes hidden named messages 2026-03-24 20:38:23 -07:00