Skip to content

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

fix(threads): handle missing thread in purge operation

Steven Enamakel02272cb00a14
diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rs
index 3591a3292c..88b78bc51d 100644
--- a/crates/openhuman-core/src/threads/ops/crud.rs
+++ b/crates/openhuman-core/src/threads/ops/crud.rs
@@ -16,7 +16,7 @@ use crate::memory::{
UpdateConversationMessageRequest, UpdateConversationThreadLabelsRequest,
UpdateConversationThreadTitleRequest, UpsertConversationThreadRequest,
};
-use crate::threads::turn_state;
+use tinyagents_session::turn_state;
use crate::threads::ThreadsError;
use crate::web_chat as web_channel;
use std::path::PathBuf;
diff --git a/crates/openhuman-core/src/threads/ops/purge.rs b/crates/openhuman-core/src/threads/ops/purge.rs
index fd9e4736e5..220f8111ba 100644
--- a/crates/openhuman-core/src/threads/ops/purge.rs
+++ b/crates/openhuman-core/src/threads/ops/purge.rs
@@ -4,7 +4,7 @@ use super::support::{envelope, run_to_completion, workspace_dir};
use crate::core::Outcome;
use crate::memory::conversations;
use crate::memory::{ApiEnvelope, EmptyRequest, PurgeConversationThreadsResponse};
-use crate::threads::turn_state;
+use tinyagents_session::turn_state;
use std::path::PathBuf;
/// Purges all conversation threads and messages.
diff --git a/crates/openhuman-core/src/threads/ops_conversion_tests.rs b/crates/openhuman-core/src/threads/ops_conversion_tests.rs
index d9b3d7c9a8..61eabaa435 100644
--- a/crates/openhuman-core/src/threads/ops_conversion_tests.rs
+++ b/crates/openhuman-core/src/threads/ops_conversion_tests.rs
@@ -467,8 +467,8 @@ async fn thread_delete_removes_persisted_turn_state_snapshot() {
.workspace_dir;
let snapshot = TurnState::started(thread_id, "req-1", 4, "2026-01-01T00:00:00Z");
- turn_state::store::put(dir.clone(), &snapshot).expect("put snapshot");
- assert!(turn_state::store::get(dir, thread_id).unwrap().is_some());
+ tinyagents_session::turn_state::store::put(dir.clone(), &snapshot).expect("put snapshot");
+ assert!(tinyagents_session::turn_state::store::get(dir, thread_id).unwrap().is_some());
// Queue a finished background sub-agent result for this thread; deleting the
// thread must discard it so it's never delivered into a dead thread.
@@ -518,7 +518,7 @@ async fn threads_purge_removes_valid_and_corrupted_turn_state_files() {
.workspace_dir;
let snapshot = TurnState::started("thread-a", "req-1", 4, "2026-01-01T00:00:00Z");
- turn_state::store::put(dir.clone(), &snapshot).expect("put snapshot");
+ tinyagents_session::turn_state::store::put(dir.clone(), &snapshot).expect("put snapshot");
let turn_state_dir = dir.join("memory").join("conversations").join("turn_states");
std::fs::create_dir_all(&turn_state_dir).unwrap();
diff --git a/crates/openhuman-core/src/threads/ops_tests.rs b/crates/openhuman-core/src/threads/ops_tests.rs
index 5df9dd96d0..ac7bda09ec 100644
--- a/crates/openhuman-core/src/threads/ops_tests.rs
+++ b/crates/openhuman-core/src/threads/ops_tests.rs
@@ -6,7 +6,8 @@ use super::*;
// Re-imported here rather than through `ops`: `ops` itself no longer names
// these, so importing them there would be an unused import in a non-test build.
use crate::memory::conversations as conversations_store;
-use crate::threads::turn_state::{self, ClearTurnStateRequest, GetTurnStateRequest, TurnState};
+use crate::threads::turn_state::{ClearTurnStateRequest, GetTurnStateRequest};
+use tinyagents_session::turn_state::{self, TurnState};
use crate::threads::ThreadsError;
use serde_json::{json, Value};
use std::ffi::OsString;
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rs
index 34855050bd..f47b56ffdc 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs
@@ -5,7 +5,8 @@
use serde_json::json;
-use crate::threads::turn_state::{TurnStateMirror, TurnStateStore};
+use crate::threads::turn_state::TurnStateMirror;
+use tinyagents_session::turn_state::TurnStateStore;
use crate::web_chat::{SubagentProgressDetail, WebChannelEvent};
use super::event_bus::publish_web_channel_event;