Repository navigation
fix(session): preserve Unicode separators in JSONL records - #1017
Open
cangen185-sudo wants to merge 1 commit into
Open
cangen185-sudo wants to merge 1 commit into
cangen185-sudo wants to merge 1 commit into
Conversation
cangen185-sudo
marked this pull request as ready for review
October 15, 2026 13:39
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Persisting
{'role': 'user', 'content': 'before\u2028after'}and reopeningSessionLogreturns no message. The next append can also reuse sequence 0. The writer emits valid UTF-8 JSON withensure_ascii=False, butstr.splitlines()splits JSON strings at U+0085, U+2028, and U+2029; the resulting fragments are silently skipped as invalid JSON.Change
Split records on LF in the seven existing reading loops: message restoration, five event readers, and sequence recovery. Preserve the log format, source bytes, sidecar metadata, and existing malformed-record handling. Existing logs need no rewrite or migration.
Validation
python -m pytest tests/session tests/memory/test_unified_memory.py tests/config/test_model_settings.py tests/config/test_tool_settings.py tests/config/test_env_override.py tests/utils/test_retry_classification.py -q.git diff --check, and wheel/source distribution builds pass.JSONL uses LF record boundaries; Unicode separators inside a JSON string are content. This follows the JSON Lines format without adding a dependency or changing the serialized schema.
Related work: #982 introduces session forks and a separate replay reader. Its new physical-line reader partially avoids the message-side symptom, but the five existing event readers still use
splitlines(). This focused fix covers the currently shippedSessionLogread paths; it does not implement or duplicate session forking.Prepared with Codex assistance: local reproduction, implementation, tests, and a separate read-only final diff review. No account configuration or user session files were accessed or rewritten.