LibreChat/packages/api/src/memory
Marco Beretta 5440735bed
🧮 fix: Count Memory Tokens After the o200k Encoding Loads (#17892)
* fix: Count Memory Tokens After the o200k Encoding Loads

Memory create and update routes, the by-id handler, and the memory agent's
set_memory tool persisted Tokenizer.getTokenCount, which returns the UTF-8
byte length for long text while o200k_base is still loading. Await
countTokens instead so the stored tokenCount is the real count.

Related to #17842

* test: Cover Memory Token Counts Saved Before the Tokenizer Loads

* test: Mock countTokens in Memory Tool and Route Specs
2026-11-08 15:23:40 +01:00
..
authorization.spec.ts 🧲 fix: Anchor Memory Partitions to Accessible Agents (#15475) 2026-09-01 18:37:52 -04:00
authorization.ts 🧲 fix: Anchor Memory Partitions to Accessible Agents (#15475) 2026-09-01 18:37:52 -04:00
config.spec.ts 🧠 fix: Bound Memory Agent Input (#13606) 2026-06-09 14:38:21 -04:00
config.ts
handlers.spec.ts 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00
handlers.ts 🧮 fix: Count Memory Tokens After the o200k Encoding Loads (#17892) 2026-11-08 15:23:40 +01:00
index.ts 🧲 fix: Anchor Memory Partitions to Accessible Agents (#15475) 2026-09-01 18:37:52 -04:00
protection.spec.ts 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00
protection.ts 🛂 feat: Filter Model-Bound Content by Source (#14425) 2026-08-21 22:43:32 -04:00