Commit 6689f50
committed
fix(memory): soft-delete orphaned messages with legacy-only tool content (#2529)
strip_mid_history_orphans only soft-deleted messages when content was
completely empty. Messages with legacy bracket strings (e.g.
[tool_use: memory_save(...)]) in content were never soft-deleted, causing
the orphan WARN to repeat on every session restart.
Add has_meaningful_content() helper that strips [tool_use:], [tool_result:],
and [tool output:] bracket markers before deciding whether content is
meaningful. The body-skip search uses PREFIXES-based lookup to avoid false
negatives when tool output contains JSON arrays or other bracket characters.
Update the three emptiness-check sites in strip_mid_history_orphans and
load_history. Add 20 unit tests and 3 integration tests covering the
regression scenario, idempotency across sessions, and the mixed
text+tool-tag preservation invariant.
Closes #25291 parent 775f676 commit 6689f50
2 files changed
+498
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
0 commit comments