Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed crates/openhuman-core/src/threads/ops/crud.rs

Steven Enamakel16410411690f
diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rs
index deae33ae15..60de66efa3 100644
--- a/crates/openhuman-core/src/threads/ops/crud.rs
+++ b/crates/openhuman-core/src/threads/ops/crud.rs
@@ -395,37 +395,17 @@ pub async fn delete_after(
pub async fn thread_delete(
request: DeleteConversationThreadRequest,
) -> Result<Outcome<ApiEnvelope<DeleteConversationThreadResponse>>, String> {
- let dir = workspace_dir().await?;
- run_to_completion("thread_delete", thread_delete_inner(dir, request)).await
-}
-
-/// Forgets the deleted thread's conversation memory, for good. Memory off
-/// (signed out) or a failed forget queues the deletion for the next sign-in
-/// (`memory::deletion`) instead of failing the delete: the thread itself is
-/// already gone.
-async fn forget_thread_memory(dir: &std::path::Path, thread_id: &str) {
- let config = match Config::load_or_init().await {
- Ok(config) => config,
- Err(error) => {
- log::warn!("[threads] thread_delete: config unavailable for memory forget: {error}");
- // Still queued against the workspace the thread lived in.
- crate::memory::deletion::enqueue(
- dir,
- crate::memory::deletion::PendingDeletion::Thread {
- thread_id: thread_id.to_string(),
- },
- );
- return;
- }
- };
- let forgotten = crate::memory::deletion::forget_thread(&config, thread_id).await;
- log::debug!("[threads] thread_delete thread_id={thread_id} memory_items_forgotten={forgotten}");
+ let config = crate::config::Config::load_or_init()
+ .await
+ .map_err(|e| format!("load config: {e}"))?;
+ run_to_completion("thread_delete", thread_delete_inner(config, request)).await
}
async fn thread_delete_inner(
- dir: PathBuf,
+ config: crate::config::Config,
request: DeleteConversationThreadRequest,
) -> Result<Outcome<ApiEnvelope<DeleteConversationThreadResponse>>, String> {
+ let dir: PathBuf = config.workspace_dir.clone();
let deleted = conversations::blocking::delete_thread(
dir.clone(),
request.thread_id.clone(),
@@ -467,7 +447,16 @@ async fn thread_delete_inner(
request.thread_id
)
})?;
- forget_thread_memory(&dir, &request.thread_id).await;
+ // The thread's conversation memory goes too, for good (by `memory_ids`).
+ // Memory off (signed out) or a failed forget queues the deletion for the
+ // next sign-in (`memory::deletion`) rather than failing the delete: the
+ // thread itself is already gone.
+ let forgotten = crate::memory::deletion::forget_thread(&config, &request.thread_id).await;
+ log::debug!(
+ "[threads] thread_delete thread_id={} memory_items_forgotten={}",
+ request.thread_id,
+ forgotten
+ );
Ok(envelope(
DeleteConversationThreadResponse { deleted },
None,