Skip to content

Ignore invalid chat cache JSON - #786

Open
CodingFeng101 wants to merge 1 commit into
TheR1D:mainfrom
CodingFeng101:codex/ignore-invalid-chat-cache
Open

CodingFeng101 wants to merge 1 commit into
TheR1D:mainfrom
CodingFeng101:codex/ignore-invalid-chat-cache

Conversation

@CodingFeng101

Copy link
Copy Markdown

What changed

ChatSession._read() now treats invalid JSON cache files like an empty chat history instead of raising JSONDecodeError.

Why

Chat cache files are local recoverable state. If a cache file is truncated or manually edited into invalid JSON, commands that inspect or continue that chat should not crash before the user can recover.

Validation

  • OPENAI_API_KEY=test python -m pytest tests\test_chat_session.py -q
  • python -m black --check sgpt\handlers\chat_handler.py tests\test_chat_session.py

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant