Skip to content

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

refactor(host): remove inference-based reaction gate

Steven Enamakela5ec93b69bfc
diff --git a/crates/openhuman-core/src/channels/host/adapters.rs b/crates/openhuman-core/src/channels/host/adapters.rs
index e4d5258700..c38d06c981 100644
--- a/crates/openhuman-core/src/channels/host/adapters.rs
+++ b/crates/openhuman-core/src/channels/host/adapters.rs
@@ -12,7 +12,7 @@ use async_trait::async_trait;
use parking_lot::Mutex;
use tinychannels::host::{
AllowlistStore, ApprovalDecision, ApprovalGate, ConversationMessage, ConversationStore,
- EventSink, LifecycleRegistry, ReactionDecision, ReactionGate, ReactionQuery, ShutdownHook,
+ EventSink, LifecycleRegistry, ShutdownHook,
SpeechRequest, SpeechResult, SpeechSynthesizer, Transcriber, TranscriptionRequest,
TranscriptionResult,
};
@@ -132,39 +132,6 @@ impl SpeechSynthesizer for VoiceSynthesizer {
}
}
-// ---------------------------------------------------------------------------
-// ReactionGate → inference should_react
-// ---------------------------------------------------------------------------
-
-/// Inference-driven reaction gate backed by the local-AI should-react op.
-pub struct InferenceReactionGate {
- pub config: Arc<Config>,
-}
-
-#[async_trait]
-impl ReactionGate for InferenceReactionGate {
- async fn should_react(&self, query: ReactionQuery) -> anyhow::Result<ReactionDecision> {
- // Honour the runtime gate: when the local model runtime is disabled we
- // never react (matches presentation's prior inline guard).
- if !self.config.local_ai.runtime_enabled {
- tracing::debug!("{LOG_PREFIX} should_react skipped (local runtime disabled)");
- return Ok(ReactionDecision::default());
- }
- let outcome = crate::inference::ops::inference_should_react(
- &self.config,
- &query.message,
- &query.channel_type,
- )
- .await
- .map_err(|e| anyhow::anyhow!(e))?;
- Ok(ReactionDecision {
- should_react: outcome.value.should_react,
- emoji: outcome.value.emoji,
- reason: None,
- })
- }
-}
-
// ---------------------------------------------------------------------------
// ApprovalGate → approval reply parsing
// ---------------------------------------------------------------------------
diff --git a/crates/openhuman-core/src/channels/host/host_tests.rs b/crates/openhuman-core/src/channels/host/host_tests.rs
index dff2a17db1..6170ff0c34 100644
--- a/crates/openhuman-core/src/channels/host/host_tests.rs
+++ b/crates/openhuman-core/src/channels/host/host_tests.rs
@@ -4,7 +4,7 @@ use super::*;
use std::sync::Arc;
use tinychannels::host::{
ApprovalDecision, ApprovalGate, ConversationMessage, ConversationStore, EventSink,
- ReactionGate, ReactionQuery, Transcriber,
+ Transcriber,
};
use crate::config::Config;
@@ -21,24 +21,14 @@ fn approval_gate_maps_core_replies() {
assert_eq!(gate.parse_reply("banana"), None);
}
-// --- ReactionGate (runtime-disabled short-circuit) ------------------------
+// --- Reactions -----------------------------------------------------------
-#[tokio::test]
-async fn reaction_gate_returns_default_when_runtime_disabled() {
- let mut config = Config::default();
- config.local_ai.runtime_enabled = false;
- let gate = InferenceReactionGate {
- config: Arc::new(config),
- };
- let decision = gate
- .should_react(ReactionQuery {
- message: "hello".into(),
- channel_type: "web".into(),
- })
- .await
- .expect("should_react ok");
- assert!(!decision.should_react);
- assert!(decision.emoji.is_none());
+/// The host offers no reaction gate: emoji reactions came from a local-model
+/// call that sat on the reply path and could hold back delivery indefinitely.
+#[test]
+fn channel_host_offers_no_reaction_gate() {
+ let host = build_channel_host(Arc::new(Config::default()));
+ assert!(host.reactions().is_none());
}
// --- OpenHumanEventSink --------------------------------------------------
diff --git a/crates/openhuman-core/src/channels/host/mod.rs b/crates/openhuman-core/src/channels/host/mod.rs
index 5c7b89cf19..1d9aaa36b7 100644
--- a/crates/openhuman-core/src/channels/host/mod.rs
+++ b/crates/openhuman-core/src/channels/host/mod.rs
@@ -20,7 +20,7 @@ pub(crate) mod remote_control;
pub use adapters::{
ConfigAllowlistStore, ConversationHistoryStore, CoreApprovalGate, CoreShutdownRegistry,
- InferenceReactionGate, OpenHumanEventSink, VoiceSynthesizer, VoiceTranscriber,
+ OpenHumanEventSink, VoiceSynthesizer, VoiceTranscriber,
};
pub use channel_events::{ChannelApprovalSurfaceSubscriber, ChannelTurnStateSubscriber};
@@ -34,10 +34,11 @@ use crate::config::Config;
/// Assemble the full OpenHuman [`ChannelHost`] from a config snapshot.
///
/// Wires every capability OpenHuman can back today: lifecycle (shutdown),
-/// STT, TTS, reaction gate, approval-reply parsing, conversation history, and
-/// the web-channel event sink. Capabilities OpenHuman cannot yet express
-/// portably (turn dispatch, run ledger, pairing) are simply left unset — a
-/// provider that needs one degrades gracefully.
+/// STT, TTS, approval-reply parsing, conversation history, and the
+/// web-channel event sink. Capabilities OpenHuman cannot yet express portably
+/// (turn dispatch, run ledger, pairing) are simply left unset — a provider
+/// that needs one degrades gracefully. Emoji reactions are deliberately unset:
+/// the local-model reaction gate was removed, so providers never react.
pub fn build_channel_host(config: Arc<Config>) -> Arc<dyn ChannelHost> {
ChannelHostBuilder::new()
.lifecycle(Arc::new(CoreShutdownRegistry))
@@ -47,9 +48,6 @@ pub fn build_channel_host(config: Arc<Config>) -> Arc<dyn ChannelHost> {
.synthesizer(Arc::new(VoiceSynthesizer {
config: Arc::clone(&config),
}))
- .reactions(Arc::new(InferenceReactionGate {
- config: Arc::clone(&config),
- }))
.approvals(Arc::new(CoreApprovalGate))
.conversations(Arc::new(ConversationHistoryStore {
workspace_dir: config.workspace_dir.clone(),