zeroclaw/src/memory
simianastronaut 0f4a878b7e
fix(agent): use char-boundary-safe slicing to prevent CJK text panic
Replace unsafe byte-index string slicing (`&text[..N]`) with
char-boundary-safe alternatives in memory consolidation and security
redaction to prevent panics when multi-byte UTF-8 characters (e.g.
Chinese/Japanese/Korean) span the slice boundary.

Fixes the same class of bug as the prior fix in `execute_one_tool`
(commit 8fcbb6eb), applied to two remaining instances:
- `src/memory/consolidation.rs`: truncation at byte 4000 and 200
- `src/security/mod.rs`: `redact()` prefix at byte 4

Adds regression tests with CJK input for both locations.

Closes #3533

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:16:04 +03:00
..
backend.rs fix(channels,memory): Docker workspace path remapping, vision support, and Qdrant backend restore (#1) 2026-02-24 16:03:01 +08:00
chunker.rs perf: eliminate unnecessary heap allocations across agent loop, memory, and channels 2026-02-19 07:06:27 -08:00
cli.rs chore(fmt): apply rustfmt after main rebase 2026-02-21 12:09:06 +08:00
consolidation.rs fix(agent): use char-boundary-safe slicing to prevent CJK text panic 2026-03-24 15:16:04 +03:00
embeddings.rs fix(memory): add openrouter as recognized embedding provider 2026-02-19 15:10:25 -05:00
hygiene.rs Addressed clippy lint issues 2026-03-10 01:48:19 -04:00
lucid.rs fix(tests): increase lucid memory test timeouts to prevent flakiness 2026-02-21 12:01:38 +08:00
markdown.rs chore: Remove blocking read strings 2026-02-19 14:52:29 +08:00
mod.rs feat(context): token-based compaction, persistent sessions, and LLM consolidation (#3574) 2026-03-24 15:16:03 +03:00
none.rs feat(memory): add session_id isolation to Memory trait (#530) 2026-02-17 07:44:05 -05:00
postgres.rs fix(memory): avoid tokio runtime panic when initializing postgres backend 2026-02-20 16:21:25 +08:00
qdrant.rs fix(channels,memory): Docker workspace path remapping, vision support, and Qdrant backend restore (#1) 2026-02-24 16:03:01 +08:00
response_cache.rs readd tests, remove markdown files 2026-02-18 14:42:39 +08:00
snapshot.rs fix(build): complete strict lint and test cleanup (replacement for #476) 2026-02-18 00:18:54 +08:00
sqlite.rs fix(security): prevent cleartext logging of sensitive data 2026-02-18 20:12:45 -08:00
traits.rs fix(security): remove sensitive fields from Debug impls 2026-02-20 22:06:21 -08:00
vector.rs fix: resolve all clippy --all-targets warnings across 15 files 2026-02-14 03:52:57 -05:00