fix(core): handle malformed Unicode when writing agent state files (#2255)
Fixes #2204. `JsonFileAgentStateStore` could throw an `UnmappableCharacterException` when serialized state contained malformed UTF-16 input, such as an unpaired surrogate (`\uD800`). This caused state persistence to fail and could interrupt `HarnessAgent.streamEvents()`. This PR: - Adds a UTF-8 writer configured to replace malformed or unmappable input with the Unicode replacement character (`\uFFFD`). - Applies the writer to single-state atomic writes, full list rewrites, and list appends. - Keeps the existing `JsonCodec.toPrettyJson()` and `JsonCodec.toJson()` serialization behavior unchanged. - Adds tests covering malformed Unicode in single-state and list-state persistence.
J
Joe Zou committed
9ac4c4c78d309842ab20851f3d55edec49c9c1bb
Parent: a0c147a
Committed by GitHub <noreply@github.com>
on 7/16/2026, 3:27:40 PM