mirror of
https://github.com/akitaonrails/ai-memory.git
synced 2026-10-02 03:24:46 +08:00
JSON forbids a raw control character (U+0000..U+001F) inside a string, but the escaper covered only backslash, quote, tab and CR. A replayed tool result carrying an ANSI colour escape (0x1b) reached stdout unescaped, so Claude Code rejected the whole managed-workstream SessionStart packet as invalid JSON and the session started with no context; any handoff summary with a control byte failed the same way. Escape every other control byte as \u00XX with a linear per-byte gsub pass, reusing #737's BusyBox replacement-doubling probe. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MDbhmszrjG9s5MrPrTuNtm