fix: align session tests with jsonl persistence

This commit is contained in:
YeonGyu-Kim committed 2026-04-02 11:31:53 +09:00
1 parent ffb133851e
commit 12c364da34
4 files changed
+192 -109

No files matched your search

+8 -1
View File
@@ -161,8 +161,15 @@ impl Session {
let path = path.as_ref();
let contents = fs::read_to_string(path)?;
let session = match JsonValue::parse(&contents) {
Ok(value) => Self::from_json(&value)?,
Ok(value)
if value
.as_object()
.is_some_and(|object| object.contains_key("messages")) =>
{
Self::from_json(&value)?
}
Err(_) => Self::from_jsonl(&contents)?,
Ok(_) => Self::from_jsonl(&contents)?,
};
Ok(session.with_persistence_path(path.to_path_buf()))
}