fix(agent): handle UnicodeDecodeError in _read_last_entry
history.jsonl may contain non-UTF-8 bytes (e.g. from email channel binary content), causing auto compact to fail when reading the last entry for summary generation. Catch UnicodeDecodeError alongside FileNotFoundError and JSONDecodeError.
This commit is contained in:
@@ -290,7 +290,7 @@ class MemoryStore:
|
|||||||
if not lines:
|
if not lines:
|
||||||
return None
|
return None
|
||||||
return json.loads(lines[-1])
|
return json.loads(lines[-1])
|
||||||
except (FileNotFoundError, json.JSONDecodeError):
|
except (FileNotFoundError, json.JSONDecodeError, UnicodeDecodeError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _write_entries(self, entries: list[dict[str, Any]]) -> None:
|
def _write_entries(self, entries: list[dict[str, Any]]) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user