Skip to content

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

refactor(channels): drop legacy channel reaction events

Steven Enamakel844fbd1cf454
diff --git a/crates/openhuman-core/src/channels/host/adapters.rs b/crates/openhuman-core/src/channels/host/adapters.rs
index 2d02730749..84ee905f5e 100644
--- a/crates/openhuman-core/src/channels/host/adapters.rs
+++ b/crates/openhuman-core/src/channels/host/adapters.rs
@@ -68,7 +68,8 @@ impl ConfigAllowlistStore {
/// Routes provider events by `domain`:
/// - `"web"` → the web channel's `WebChannelEvent` broadcast bus (payload
/// must deserialize into a `WebChannelEvent`; presentation builds that shape).
-/// - `"channel"` → the global `DomainEvent` bus for legacy provider callbacks.
+/// - `"channel"` → ignored legacy reaction callbacks. Reactions with durable
+/// message identity use the typed `channel_event` callback above instead.
/// Typed `channel_event` payloads use `publish_host_in` so trusted scope can
/// resolve and persist their exact OpenHuman message target first.
///
@@ -155,14 +156,6 @@ pub(super) fn channel_event_target_message_id(
}
}
-fn json_str(payload: &serde_json::Value, key: &str) -> String {
- payload
- .get(key)
- .and_then(|v| v.as_str())
- .unwrap_or_default()
- .to_string()
-}
-
async fn publish_event(domain: &str, kind: &str, payload: serde_json::Value) -> anyhow::Result<()> {
match domain {
"web" => {
@@ -175,30 +168,9 @@ async fn publish_event(domain: &str, kind: &str, payload: serde_json::Value) ->
crate::web_chat::publish_web_channel_event(event);
}
"channel" => {
- use crate::core::bus::BUS;
- use crate::core::events::DomainEvent;
- let event = match kind {
- "reaction_received" => DomainEvent::ChannelReactionReceived {
- channel: json_str(&payload, "channel"),
- sender: json_str(&payload, "sender"),
- target_message_id: json_str(&payload, "target_message_id"),
- emoji: json_str(&payload, "emoji"),
- },
- "reaction_sent" => DomainEvent::ChannelReactionSent {
- channel: json_str(&payload, "channel"),
- target_message_id: json_str(&payload, "target_message_id"),
- emoji: json_str(&payload, "emoji"),
- success: payload
- .get("success")
- .and_then(|v| v.as_bool())
- .unwrap_or(false),
- },
- other => {
- tracing::warn!("{LOG_PREFIX} unmapped channel event kind: {other}");
- return Ok(());
- }
- };
- BUS.publish(event);
+ tracing::debug!(
+ "{LOG_PREFIX} ignored legacy channel event kind without a typed target: {kind}"
+ );
}
other => tracing::warn!("{LOG_PREFIX} unmapped event domain: {other}"),
}
diff --git a/crates/openhuman-core/src/channels/host/host_tests.rs b/crates/openhuman-core/src/channels/host/host_tests.rs
index 3a75bdcad6..ec07d14790 100644
--- a/crates/openhuman-core/src/channels/host/host_tests.rs
+++ b/crates/openhuman-core/src/channels/host/host_tests.rs
@@ -283,7 +283,7 @@ async fn event_sink_rejects_non_object_payload() {
}
#[tokio::test]
-async fn event_sink_routes_channel_reactions_to_domain_bus() {
+async fn event_sink_ignores_legacy_reactions_without_a_typed_message_target() {
let sink = OpenHumanEventSink;
assert!(sink
.publish_host(
diff --git a/crates/openhuman-core/src/core/events_tests.rs b/crates/openhuman-core/src/core/events_tests.rs
index 39b17b5dd4..f71d2c86ce 100644
--- a/crates/openhuman-core/src/core/events_tests.rs
+++ b/crates/openhuman-core/src/core/events_tests.rs
@@ -157,24 +157,6 @@ fn all_variants_have_correct_domain() {
},
"channel",
),
- (
- DomainEvent::ChannelReactionReceived {
- channel: "c".into(),
- sender: "s".into(),
- target_message_id: "m1".into(),
- emoji: "👍".into(),
- },
- "channel",
- ),
- (
- DomainEvent::ChannelReactionSent {
- channel: "c".into(),
- target_message_id: "m1".into(),
- emoji: "✅".into(),
- success: true,
- },
- "channel",
- ),
(
DomainEvent::ChannelConnected {
channel: "c".into(),
@@ -943,17 +925,6 @@ fn events_without_a_workspace_report_none() {
.workspace_dir(),
None
);
- assert_eq!(
- DomainEvent::ChannelReactionReceived {
- channel: "c".into(),
- sender: "s".into(),
- target_message_id: "m1".into(),
- emoji: "👍".into(),
- }
- .workspace_dir(),
- None,
- "a channel event with no workspace field must not borrow one"
- );
}
/// The artifact family carries its workspace as a `String`, so it is the one