The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(memory): record owning channel on ingested turns
Steven Enamakela5be1ad9db69
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rsindex 09584a2179..f7c24e5a1a 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/memory_ingest.rs@@ -33,11 +33,36 @@ use tinymemory_tools::layout::identity::ResolvedIdentity;pub(super) struct PendingMemoryTurn {identity: ResolvedIdentity,user_index: u32,+ channel: Option<String>,// The canonical runtime can commit on a different task. Restore the// authenticated profile captured at preparation, never infer it from config.profile_context: ProfileMemoryContext,}+/// The provider channel that owns a logged conversation, if this turn came+/// from a registered external channel. Event-context labels such as `cron`,+/// `voice`, and `mcp_server` are not channel owners.+fn logged_channel(origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>) -> Option<String> {+ let Some(crate::agent::turn_origin::AgentTurnOrigin::ExternalChannel {+ channel,+ message_id,+ ..+ }) = origin+ else {+ return None;+ };+ if message_id.starts_with("cron:") {+ return None;+ }+ let channel = channel.trim().to_ascii_lowercase();+ if channel.is_empty()+ || tinychannels_bus::controllers::find_channel_definition(&channel).is_none()+ {+ return None;+ }+ Some(channel)+}+// Missing profile authority must not be confused with an ordinary desktop turn.#[derive(Clone)]enum ProfileMemoryContext {@@ -143,6 +168,7 @@ impl OpenHumanTurnPrelude {.pending_memory_turn = Some(PendingMemoryTurn {identity: identity.clone(),user_index,+ channel: logged_channel(origin.as_ref()),profile_context,});let pack = crate::memory::lifecycle::prefetch::pre_turn(@@ -231,6 +257,7 @@ impl OpenHumanTurnPrelude {assistant_text,tool_calls,Utc::now(),+ pending.channel,).await;};diff --git a/crates/openhuman-core/src/memory/lifecycle/hooks.rs b/crates/openhuman-core/src/memory/lifecycle/hooks.rsindex 07b81bffea..7bd3f028b4 100644--- a/crates/openhuman-core/src/memory/lifecycle/hooks.rs+++ b/crates/openhuman-core/src/memory/lifecycle/hooks.rs@@ -366,6 +366,7 @@ pub async fn post_turn(assistant_text: String,tool_calls: Vec<ToolCallSummary>,at: DateTime<Utc>,+ channel: Option<String>,) {if !config.memory.conversations.enabled {return;@@ -386,6 +387,7 @@ pub async fn post_turn(}};let mut post = PostTurn::new(&thread_id, turn_index, text);+ post.channel = channel;post.at = Some(at);post.tool_calls = tool_calls.iter()