Commit 6d37259
š”ļø fix: Strip null content parts on message load to prevent formatAgentMessages crash
The streaming content aggregator builds message content by index and yields a
sparse array; an interrupted/partial save persists a hole that serializes to
null in MongoDB. On replay, @librechat/agents formatAgentMessages reads
part.type with no null guard and crashes.
Sanitize content holes at getMessages, the single DB read chokepoint for
conversation history, so both already-corrupted and future rows are
neutralized for every consumer (formatAgentMessages, token counting, edit path).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 566e20b commit 6d37259
1 file changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
329 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
330 | 339 | | |
331 | | - | |
332 | | - | |
| 340 | + | |
333 | 341 | | |
334 | 342 | | |
335 | 343 | | |
| |||
0 commit comments