fix(session): persist auto-reset state across gateway restarts#2550
Closed
teyrebaz33 wants to merge 1 commit into
Closed
fix(session): persist auto-reset state across gateway restarts#2550teyrebaz33 wants to merge 1 commit into
teyrebaz33 wants to merge 1 commit into
Conversation
was_auto_reset, auto_reset_reason, and reset_had_activity were not included in SessionEntry.to_dict() / from_dict(), so a gateway restart between session expiry and the user's next message would silently drop the auto-reset notification and context note. Add the three fields to the serialization roundtrip with safe defaults (False / None / False) so existing sessions.json files load cleanly. Add three roundtrip tests to test_session_reset_notify.py.
Contributor
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
SessionEntry.to_dict()did not includewas_auto_reset,auto_reset_reason, orreset_had_activity. These fields were added in #2519 but left out of the serialization roundtrip.Impact: If the gateway restarts between a session expiry and the user's next message, the new
SessionEntryis reloaded fromsessions.jsonwith all three fields reset to their defaults (False/None/False). The result:◐ Session automatically reset…) is never sentFix
Add the three fields to
to_dict()and restore them infrom_dict()with safe defaults so existingsessions.jsonfiles load cleanly.Tests
Three new roundtrip tests added to
tests/gateway/test_session_reset_notify.py:test_was_auto_reset_persists_across_roundtriptest_reset_had_activity_persists_across_roundtriptest_auto_reset_reason_none_roundtripAll 16 tests in the file pass.