Skip to content

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

fix(threads): correct thread state handling for edit and purge operations

Steven Enamakel40b1dcce5aae
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs
index 944af3c675..58f4a3eee7 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs
@@ -11,7 +11,7 @@
use crate::agent::harness::definition::AgentDefinitionRegistry;
use crate::agent::subagent_host::{run_subagent_with_parent, SubagentRunOptions};
-use crate::threads::store;
+use crate::threads::store as conversations;
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
index e85da043b6..c553d888bb 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
@@ -2,7 +2,7 @@ use super::{ArchetypeDelegationTool, DelegationTarget, SpawnSubagentTool, SpawnW
use crate::agent::harness::definition::AgentDefinitionRegistry;
use crate::agent::harness::{with_parent_context, ParentExecutionContext};
use crate::agent::prompts::{ConnectedIntegration, ToolCallFormat};
-use crate::threads::store;
+use crate::threads::store as conversations;
use crate::memory::test_support::NoopMemory;
use async_trait::async_trait;
use parking_lot::Mutex;
diff --git a/crates/openhuman-core/src/security/credentials/ops/user_scope.rs b/crates/openhuman-core/src/security/credentials/ops/user_scope.rs
index d13ce39e71..4623700437 100644
--- a/crates/openhuman-core/src/security/credentials/ops/user_scope.rs
+++ b/crates/openhuman-core/src/security/credentials/ops/user_scope.rs
@@ -11,7 +11,7 @@ use crate::config::{
default_root_openhuman_dir, pre_login_user_dir, read_active_user_id, user_openhuman_dir,
write_active_user_id, Config,
};
-use crate::threads::store;
+use crate::threads::store as conversations;
use super::gated_services::is_embedder_host;
diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rs
index 90d1fa5399..88037de58d 100644
--- a/crates/openhuman-core/src/threads/ops/crud.rs
+++ b/crates/openhuman-core/src/threads/ops/crud.rs
@@ -6,7 +6,7 @@ use super::support::{
workspace_dir,
};
use crate::core::Outcome;
-use crate::threads::store;
+use crate::threads::store as conversations;
use crate::threads::store::{ConversationMessagePatch, CrossThreadHit};
use crate::memory::{
ApiEnvelope, AppendConversationMessageRequest, ConversationMessageRecord,
diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rs
index 524489badd..13427a9099 100644
--- a/crates/openhuman-core/src/threads/ops/edit.rs
+++ b/crates/openhuman-core/src/threads/ops/edit.rs
@@ -47,7 +47,7 @@ use tinyagents_session::transcript::{
};
use crate::core::Outcome;
-use crate::threads::store::{self, reply_run_id, run_reply_message_id};
+use crate::threads::store::{self as conversations, reply_run_id, run_reply_message_id};
use crate::threads::ThreadsError;
use super::support::workspace_dir;
diff --git a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
index 49b828ae82..a11f29c640 100644
--- a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
@@ -6,7 +6,7 @@
//! truncation tests do.
use super::*;
-use crate::threads::store::{self, run_reply_message_id, ConversationMessage};
+use crate::threads::store::{self as conversations, run_reply_message_id, ConversationMessage};
use serde_json::json;
use tempfile::TempDir;
use tinyagents_session::turn_state::store as turn_state_store;
diff --git a/crates/openhuman-core/src/threads/ops/purge.rs b/crates/openhuman-core/src/threads/ops/purge.rs
index b65fe7e22e..8583b237cb 100644
--- a/crates/openhuman-core/src/threads/ops/purge.rs
+++ b/crates/openhuman-core/src/threads/ops/purge.rs
@@ -2,7 +2,7 @@
use super::support::{envelope, run_to_completion, workspace_dir};
use crate::core::Outcome;
-use crate::threads::store;
+use crate::threads::store as conversations;
use crate::memory::{ApiEnvelope, EmptyRequest, PurgeConversationThreadsResponse};
use std::path::PathBuf;
use tinyagents_session::turn_state;
diff --git a/crates/openhuman-core/src/threads/ops/support.rs b/crates/openhuman-core/src/threads/ops/support.rs
index 6ae078bfc2..d8672665ca 100644
--- a/crates/openhuman-core/src/threads/ops/support.rs
+++ b/crates/openhuman-core/src/threads/ops/support.rs
@@ -4,7 +4,7 @@
use crate::config::Config;
use crate::core::runtime::context::CoreContext;
-use crate::threads::store;
+use crate::threads::store as conversations;
use crate::threads::store::{ConversationMessage, ConversationThread};
use crate::memory::{ConversationMessageRecord, ConversationThreadSummary};
use crate::threads::THREAD_TITLE_LOG_PREFIX;
diff --git a/crates/openhuman-core/src/threads/ops/title_generation.rs b/crates/openhuman-core/src/threads/ops/title_generation.rs
index 28c435dcfc..d4a099d384 100644
--- a/crates/openhuman-core/src/threads/ops/title_generation.rs
+++ b/crates/openhuman-core/src/threads/ops/title_generation.rs
@@ -5,7 +5,7 @@ use super::support::{counts, envelope, thread_to_summary, update_thread_with_fal
use crate::config::Config;
use crate::core::Outcome;
use crate::inference::provider;
-use crate::threads::store;
+use crate::threads::store as conversations;
use crate::memory::{
ApiEnvelope, ConversationThreadSummary, GenerateConversationThreadTitleRequest,
};
diff --git a/crates/openhuman-core/src/threads/welcome_migration.rs b/crates/openhuman-core/src/threads/welcome_migration.rs
index 8d9ddedf17..e6a391103c 100644
--- a/crates/openhuman-core/src/threads/welcome_migration.rs
+++ b/crates/openhuman-core/src/threads/welcome_migration.rs
@@ -18,7 +18,7 @@
use std::fs;
use std::path::Path;
-use crate::threads::store;
+use crate::threads::store as conversations;
use serde_json::{json, Value};
const MIGRATION_MARKER: &str = "state/migrations/welcome_to_orchestrator_v1.done";
diff --git a/crates/openhuman-core/src/web_chat/presentation_tests.rs b/crates/openhuman-core/src/web_chat/presentation_tests.rs
index e4c3711ad9..765c0608cd 100644
--- a/crates/openhuman-core/src/web_chat/presentation_tests.rs
+++ b/crates/openhuman-core/src/web_chat/presentation_tests.rs
@@ -129,7 +129,7 @@ async fn chat_done_omits_timing_when_no_snapshot_is_supplied() {
#[tokio::test]
async fn delivery_stores_the_reply_before_announcing_it() {
- use crate::threads::store::{self, CreateConversationThread};
+ use crate::threads::store::{self as conversations, CreateConversationThread};
let ws = std::env::temp_dir().join(format!("deliver-persist-{}", uuid::Uuid::new_v4()));
std::fs::create_dir_all(&ws).unwrap();
diff --git a/crates/openhuman-core/src/web_chat/reply_persistence.rs b/crates/openhuman-core/src/web_chat/reply_persistence.rs
index fb9191cfd1..5676b2f261 100644
--- a/crates/openhuman-core/src/web_chat/reply_persistence.rs
+++ b/crates/openhuman-core/src/web_chat/reply_persistence.rs
@@ -23,7 +23,7 @@ use std::path::Path;
use serde_json::json;
use crate::memory::agent::memory_loader::MemoryCitation;
-use crate::threads::store::{self, run_reply_message_id, ConversationMessage};
+use crate::threads::store::{self as conversations, run_reply_message_id, ConversationMessage};
/// Metadata scope stamped on a reply persisted by the web-channel delivery path.
///
diff --git a/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs b/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs
index a0c36c0cdd..500baff2b5 100644
--- a/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs
+++ b/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs
@@ -2,7 +2,7 @@ use std::path::PathBuf;
use super::persist_delivered_reply;
use crate::memory::agent::memory_loader::MemoryCitation;
-use crate::threads::store::{self, CreateConversationThread};
+use crate::threads::store::{self as conversations, CreateConversationThread};
fn temp_ws() -> PathBuf {
let dir = std::env::temp_dir().join(format!("web-chat-reply-{}", uuid::Uuid::new_v4()));