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(agent): track turn origin across agent turns
Steven Enamakelb61532ad0b09
diff --git a/crates/openhuman-core/src/agent/attachments/mod_access_tests.rs b/crates/openhuman-core/src/agent/attachments/mod_access_tests.rsindex 66d0f2bf11..306d8d327a 100644--- a/crates/openhuman-core/src/agent/attachments/mod_access_tests.rs+++ b/crates/openhuman-core/src/agent/attachments/mod_access_tests.rs@@ -8,6 +8,7 @@ fn external_origin() -> crate::agent::turn_origin::AgentTurnOrigin {sender: None,reply_target: "test".into(),message_id: "test".into(),+ history_key: None,}}diff --git a/crates/openhuman-core/src/agent/attachments/provider_tests.rs b/crates/openhuman-core/src/agent/attachments/provider_tests.rsindex c9d70b070e..eafdf0b8c5 100644--- a/crates/openhuman-core/src/agent/attachments/provider_tests.rs+++ b/crates/openhuman-core/src/agent/attachments/provider_tests.rs@@ -165,6 +165,7 @@ async fn external_channel_cannot_rehydrate_a_local_image() {sender: None,reply_target: "chat".into(),message_id: "message".into(),+ history_key: None,};let mut context = crate::agent::tinyagents::host::OpenHumanRunContext::new();context.origin = Some(origin);diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rsindex 8a246625ed..421527d1d4 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context_tests.rs@@ -11,6 +11,7 @@ async fn attachment_scope_is_request_local_and_contains_only_typed_authority() {sender: None,reply_target: "room".into(),message_id: "message".into(),+ history_key: None,},);data.workspace = Some(tinytools::WorkspaceDescriptor::new(root.clone()));diff --git a/crates/openhuman-core/src/agent/tinyagents/tools_canonical_tests.rs b/crates/openhuman-core/src/agent/tinyagents/tools_canonical_tests.rsindex 5159d72567..2533510d7b 100644--- a/crates/openhuman-core/src/agent/tinyagents/tools_canonical_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/tools_canonical_tests.rs@@ -198,6 +198,7 @@ async fn canonical_adapter_scopes_tool_execution_to_the_run_origin() {sender: None,reply_target: "room".into(),message_id: "message".into(),+ history_key: None,},);let run = host.into_tinyagents(RunConfig::new("origin-observer"));diff --git a/crates/openhuman-core/src/agent/triage/evaluator/arm.rs b/crates/openhuman-core/src/agent/triage/evaluator/arm.rsindex ca4bcae580..3d67988858 100644--- a/crates/openhuman-core/src/agent/triage/evaluator/arm.rs+++ b/crates/openhuman-core/src/agent/triage/evaluator/arm.rs@@ -143,6 +143,7 @@ pub(super) async fn try_arm(sender: None,reply_target: envelope.display_label.clone(),message_id: envelope.external_id.clone(),+ history_key: None,},};diff --git a/crates/openhuman-core/src/agent/turn_origin.rs b/crates/openhuman-core/src/agent/turn_origin.rsindex a283aacd62..db590ccfc2 100644--- a/crates/openhuman-core/src/agent/turn_origin.rs+++ b/crates/openhuman-core/src/agent/turn_origin.rs@@ -52,6 +52,12 @@ pub enum AgentTurnOrigin {sender: Option<String>,reply_target: String,message_id: String,+ /// The channel runtime's conversation-history key for this chat, set only by+ /// the channel processor (the one place that owns `conversation_histories`).+ /// `None` for ExternalChannel-labelled turns that are not a channel+ /// conversation (MCP server callers, triage, voice), so scheduling can tell a+ /// real chat from those.+ history_key: Option<String>,},/// Internal automation the user explicitly authorized (cron job the/// user created, internal background job on local data). `source`diff --git a/crates/openhuman-core/src/agent/turn_origin_tests.rs b/crates/openhuman-core/src/agent/turn_origin_tests.rsindex ac66156359..506d569427 100644--- a/crates/openhuman-core/src/agent/turn_origin_tests.rs+++ b/crates/openhuman-core/src/agent/turn_origin_tests.rs@@ -68,6 +68,7 @@ async fn inherited_origin_preserves_a_non_cli_origin_verbatim() {sender: Some("u-42".into()),reply_target: "chat-7".into(),message_id: "m-9".into(),+ history_key: None,},async {let captured = capture();@@ -261,6 +262,7 @@ async fn spawn_preserves_an_untrusted_origin_verbatim() {sender: Some("u-42".into()),reply_target: "chat-7".into(),message_id: "m-9".into(),+ history_key: None,},async {spawn(async { current() })diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rsindex 6bf2b33e6b..cb7dac993a 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs@@ -344,6 +344,7 @@ pub(crate) async fn process_channel_runtime_message(sender: Some(msg.sender.clone()),reply_target: msg.reply_target.clone(),message_id: msg.id.clone(),+ history_key: None,};let turn_request = AgentTurnRequest {diff --git a/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs b/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rsindex 9049da5c1b..94dd1ac7a8 100644--- a/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs+++ b/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs@@ -8,6 +8,7 @@ async fn dispatch_scope_uses_explicit_origin_without_mutating_shared_context() {sender: Some("sender".into()),reply_target: "room".into(),message_id: "message".into(),+ history_key: None,};CoreContext::scope_with_turn_origin(ctx.clone(), Some(origin), async {assert!(matches!(@@ -28,6 +29,7 @@ async fn missing_child_origin_inherits_bound_external_authority() {sender: None,reply_target: "room".into(),message_id: "message".into(),+ history_key: None,};CoreContext::scope_with_turn_origin(ctx, Some(external), async {let parent = CoreContext::current().expect("parent context");diff --git a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs b/crates/openhuman-core/src/mcp/server/tools/dispatch.rsindex 05f7b8ab99..eaa7992aa5 100644--- a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs+++ b/crates/openhuman-core/src/mcp/server/tools/dispatch.rs@@ -363,6 +363,7 @@ async fn run_subagent_tool(params: &Map<String, Value>) -> Result<Value, ToolCalsender: None,reply_target: agent_id.clone(),message_id: uuid::Uuid::new_v4().to_string(),+ history_key: None,};// Run the subagent one level deeper in the chain, so its own Claude Code// turns stamp `child_depth` onto any grandchildren they spawn. The agentdiff --git a/crates/openhuman-core/src/security/approval/gate_intercept.rs b/crates/openhuman-core/src/security/approval/gate_intercept.rsindex 80b4a068df..245a14d869 100644--- a/crates/openhuman-core/src/security/approval/gate_intercept.rs+++ b/crates/openhuman-core/src/security/approval/gate_intercept.rs@@ -237,6 +237,7 @@ impl ApprovalGate {sender,reply_target,message_id,+ ..,} => {tracing::info!(tool = tool_name,diff --git a/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs b/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rsindex 111969d389..8f2c5056c5 100644--- a/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs+++ b/crates/openhuman-core/src/security/approval/gate_origin_intercept_tests.rs@@ -120,6 +120,7 @@ async fn intercept_with_external_channel_origin_persists_and_ttl_denies() {sender: Some("tg-user-1".into()),reply_target: "tg-chat-1".into(),message_id: "msg-1".into(),+ history_key: None,};let g = gate.clone();diff --git a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rsindex 325ccfa319..d027f9ba66 100644--- a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs+++ b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs@@ -162,6 +162,7 @@ async fn external_origin_cannot_reuse_an_existing_attachment_marker() {sender: None,reply_target: "room".into(),message_id: "message".into(),+ history_key: None,};assert!(append_with_test_config(request("external", &staged, "user"), &config, Some(&origin))diff --git a/crates/openhuman-core/src/voice/realtime_harness/agent.rs b/crates/openhuman-core/src/voice/realtime_harness/agent.rsindex 74ea2430a3..ce5d437b79 100644--- a/crates/openhuman-core/src/voice/realtime_harness/agent.rs+++ b/crates/openhuman-core/src/voice/realtime_harness/agent.rs@@ -152,6 +152,7 @@ async fn run_single_with_timeout(sender: None,reply_target: correlation_id.to_string(),message_id: format!("voice-{correlation_id}"),+ history_key: None,},crate::security::approval::APPROVAL_CHAT_CONTEXT.scope(approval_ctx, scoped_run),);diff --git a/vendor/tinyagents b/vendor/tinyagentsindex 64cdd4137b..bac517d52e 160000--- a/vendor/tinyagents+++ b/vendor/tinyagents@@ -1 +1 @@-Subproject commit 64cdd4137b91851a323d87174aec3665b8531f40+Subproject commit bac517d52e61bfefe16750511ab8a1f67061647a