2 Commits

Author SHA1 Message Date
Tu Naichao
c86071442c
fix(memory): truncate mem0 context injection on entry boundaries (#4600)
* fix(memory): truncate mem0 context injection on entry boundaries

Mem0Manager.get_context built the injection block and then hard-cut it
at max_injection_chars, which could sever the last memory mid-line and
leave a dangling partial entry in the agent prompt.

Accumulate whole entries against the remaining budget instead: a
memory that does not fit is skipped (a shorter later one may still
fit). When not even the first memory fits, fall back to the previous
hard-truncation behavior for that single entry rather than injecting
nothing.

Tests: entry-boundary truncation, skip-oversized-keep-later, and the
oversized-first-entry fallback.

* fix(memory): keep entry-boundary guarantee when no mem0 memory fits

Follow-up to PR #4600 review: remove the hard-truncation fallback that

could inject a partial memory when max_injection_chars is smaller than

every recalled entry. Instead return empty context and log a warning that

surfaced the undersized budget.
2026-07-31 22:16:56 +08:00
Vanzeren
352f247a81
feat(memory): add mem0 HTTP memory backend (#4528)
* feat(memory): add mem0 HTTP memory backend

* fix(memory): address mem0 review feedback

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-07-29 07:11:20 +08:00