From 81ff6f7a3c6f5491bd5a2186f3675cf0ff79006e Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 3 Mar 2025 12:47:10 -0500 Subject: [PATCH] assistant2: Persist threads using `serde_json` instead of `bincode` (#25938) This PR changes how we persist threads in Assistant2 to use `serde_json` instead of `bincode` for the representation. This makes the format more flexible to work with (and will allow for using things like `#[serde(default)]`) if the schema changes over time. Note: We have to bump the LMDB database version for this, so any threads created before now will be gone. Release Notes: - N/A --- crates/assistant2/src/thread_store.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/assistant2/src/thread_store.rs b/crates/assistant2/src/thread_store.rs index 58caad37b6..b9ef30cb56 100644 --- a/crates/assistant2/src/thread_store.rs +++ b/crates/assistant2/src/thread_store.rs @@ -12,7 +12,7 @@ use futures::FutureExt as _; use gpui::{ prelude::*, App, BackgroundExecutor, Context, Entity, Global, ReadGlobal, SharedString, Task, }; -use heed::types::SerdeBincode; +use heed::types::{SerdeBincode, SerdeJson}; use heed::Database; use language_model::Role; use project::Project; @@ -255,7 +255,7 @@ impl Global for GlobalThreadsDatabase {} pub(crate) struct ThreadsDatabase { executor: BackgroundExecutor, env: heed::Env, - threads: Database, SerdeBincode>, + threads: Database, SerdeJson>, } impl ThreadsDatabase { @@ -270,7 +270,7 @@ impl ThreadsDatabase { let database_future = executor .spawn({ let executor = executor.clone(); - let database_path = paths::support_dir().join("threads/threads-db.0.mdb"); + let database_path = paths::support_dir().join("threads/threads-db.1.mdb"); async move { ThreadsDatabase::new(database_path, executor) } }) .then(|result| future::ready(result.map(Arc::new).map_err(Arc::new)))