fix(session): coerce null session metadata to empty dict

This commit is contained in:
santhreal
2026-07-26 17:47:16 +08:00
committed by chengyongru
parent 745757cc37
commit 7c94ba9643
2 changed files with 31 additions and 0 deletions
+2
View File
@@ -138,6 +138,8 @@ class Session:
last_consolidated: int = 0 # Number of messages already consolidated to files
def __post_init__(self) -> None:
if not isinstance(self.metadata, dict):
self.metadata = {}
# An out-of-range offset (corrupt metadata) would hide all history; reset it.
if (
isinstance(self.last_consolidated, bool)