Repository navigation
Conversation
) _try_read_session_file and the get_subagent_messages transcript read caught only OSError, so a single invalid byte in a stored JSONL file escaped as UnicodeDecodeError from get_session_messages / get_subagent_messages instead of degrading to [] / None the way missing or unreadable files do. Catch UnicodeDecodeError alongside OSError at both sites; the .meta.json sidecar reader already handled it via its existing ValueError catch.
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.
Summary
Fixes #1518.
_try_read_session_filereads session transcripts with strict UTF-8 but catches onlyOSError.UnicodeDecodeErrorinherits fromValueError, so a single invalid byte in a stored.jsonlfile escapedget_session_messagesas an uncaught exception instead of degrading to[]the way missing/unreadable files do. The subagent-messages transcript read had the same gap; the.meta.jsonsidecar reader already handles it via its existingValueErrorcatch.Changes
_try_read_session_file: catch(OSError, UnicodeDecodeError)→Noneget_subagent_messagestranscript read: catch(OSError, UnicodeDecodeError)→[]Tests
TestInvalidUtf8Transcriptsregression tests for both paths (fixtures write raw invalid-UTF-8 bytes into the transcript files).main(both raiseUnicodeDecodeError) and pass with the fix.ruffandmypyclean.Related
Sibling of #1521 (same file-robustness family; fixed in #1566).