fix(session): critical bug fixes in SessionStore#3561
Open
Kewe63 wants to merge 1 commit intoNousResearch:mainfrom
Open
fix(session): critical bug fixes in SessionStore#3561Kewe63 wants to merge 1 commit intoNousResearch:mainfrom
Kewe63 wants to merge 1 commit intoNousResearch:mainfrom
Conversation
- Fix incorrect type annotations: last_prompt_tokens and model parameters in update_session() were annotated as int/str with None defaults; corrected to Optional[int] and Optional[str] - Add OSError handling in append_to_transcript() JSONL write path; previously an unhandled IOError would propagate and break the caller's flow - Make rewrite_transcript() JSONL write atomic using tempfile + os.fsync + os.replace to prevent data loss if the write fails mid-way (file was previously truncated before new content landed)
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.
🐛 Bug Fixes
gateway/session.pylast_prompt_tokensandmodelparams inupdate_session()were typed asint = Nonestr = None— corrected toOptional[int]/Optional[str]gateway/session.pyappend_to_transcript()JSONL write had no exception handling — anIOError(disktry/except OSErrorwith warning loggateway/session.pyrewrite_transcript()usedopen("w")which truncates the file before writing — aos.fsync+os.replace)🧪 Test Results
📋 Change Summary
gateway/session.py)✅ Checklist