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
fix(voice): require authenticated channel identity for voice facts
Steven Enamakelcfc37239b98f
diff --git a/crates/openhuman-core/src/channels/host/voice.rs b/crates/openhuman-core/src/channels/host/voice.rsindex 2d33737eeb..5dbc666b8c 100644--- a/crates/openhuman-core/src/channels/host/voice.rs+++ b/crates/openhuman-core/src/channels/host/voice.rs@@ -110,6 +110,12 @@ fn thread_key(scope: &HostVoiceScope) -> &str {.unwrap_or(&scope.conversation.id)}+fn has_authenticated_channel_identity(scope: &HostVoiceScope) -> bool {+ !scope.configured_instance.trim().is_empty()+ && scope.channel.id == tinychannels_bus::provider_id(&scope.configured_instance)+ && scope.channel.account_id.as_deref() == Some(scope.configured_instance.as_str())+}+fn wire_mode(mode: VoiceReplyMode) -> HostVoiceReplyMode {match mode {VoiceReplyMode::Mirror => HostVoiceReplyMode::Mirror,@@ -126,7 +132,11 @@ pub(crate) fn resolve_policy(tenant: &crate::core::runtime::Tenant,) -> HostVoiceReplyPolicy {let mode = voice.resolve_mode(&scope.configured_instance, thread_key(scope));- let facts = turn_facts(scope, tenant);+ let facts = if has_authenticated_channel_identity(scope) {+ turn_facts(scope, tenant)+ } else {+ VoiceTurnFacts::default()+ };HostVoiceReplyPolicy {mode: wire_mode(mode),inbound_has_voice: facts.inbound_has_voice,@@ -135,7 +145,7 @@ pub(crate) fn resolve_policy(}fn validate_scope(scope: &HostVoiceScope) -> anyhow::Result<()> {- if scope.configured_instance.trim().is_empty()+ if !has_authenticated_channel_identity(scope)|| scope.conversation.id.trim().is_empty()|| scope.turn_id.trim().is_empty(){diff --git a/crates/openhuman-core/src/channels/host/voice_tests.rs b/crates/openhuman-core/src/channels/host/voice_tests.rsindex a8f0bdd251..e148c48f78 100644--- a/crates/openhuman-core/src/channels/host/voice_tests.rs+++ b/crates/openhuman-core/src/channels/host/voice_tests.rs@@ -6,7 +6,7 @@ fn scope(channel: &str, conversation: &str, turn: &str) -> HostVoiceScope {HostVoiceScope {configured_instance: channel.into(),channel: ChannelRef {- id: channel.split(':').next().unwrap_or(channel).into(),+ id: tinychannels_bus::provider_id(channel).into(),account_id: Some(channel.into()),},conversation: ConversationRef {@@ -87,6 +87,36 @@ fn same_conversation_and_turn_ids_do_not_cross_voice_facts_between_accounts() {assert!(!bob.inbound_has_voice);}+#[test]+fn same_channel_account_and_turn_ids_do_not_cross_voice_facts_between_tenants() {+ let alice = crate::core::runtime::Tenant {+ profile: Some("profile-alice".into()),+ agent: None,+ };+ let bob = crate::core::runtime::Tenant {+ profile: Some("profile-bob".into()),+ agent: None,+ };+ let envelope_voice = envelope("same-conversation", "same-turn", true);+ let envelope_text = envelope("same-conversation", "same-turn", false);++ record_inbound_envelope(&envelope_voice, &alice);+ record_inbound_envelope(&envelope_text, &bob);++ assert!(resolve_policy(+ &ChannelVoiceConfig::default(),+ &scope("telegram", "same-conversation", "same-turn"),+ &alice,+ )+ .inbound_has_voice);+ assert!(!resolve_policy(+ &ChannelVoiceConfig::default(),+ &scope("telegram", "same-conversation", "same-turn"),+ &bob,+ )+ .inbound_has_voice);+}+#[test]fn unknown_turn_defaults_to_no_voice() {let policy = resolve_policy(@@ -167,7 +197,7 @@ async fn incomplete_scope_is_rejected_before_any_voice_work() {};assert!(host.synthesize_speech(bad).await.is_err());let bad = HostVoiceTranscriptionRequest {- scope: scope("", "c", "t"),+ scope: HostVoiceScope::default(),..Default::default()};assert!(host.transcribe_voice(bad).await.is_err());