Skip to content

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

feat(events): add retired channel reaction variants as wire tombstones

Steven Enamakel703f2c51b680
diff --git a/crates/openhuman-core/src/channels/host/host_tests.rs b/crates/openhuman-core/src/channels/host/host_tests.rs
index ec07d14790..903e84f1e8 100644
--- a/crates/openhuman-core/src/channels/host/host_tests.rs
+++ b/crates/openhuman-core/src/channels/host/host_tests.rs
@@ -186,10 +186,12 @@ async fn typed_channel_projection_uses_scoped_persisted_row_bindings_after_resta
},
};
- assert!(super::adapters::project_channel_event(&bob, event.clone())
- .await
- .unwrap()
- .is_none());
+ assert!(
+ super::adapters::project_channel_event(&bob, event.clone())
+ .await
+ .unwrap()
+ .is_none()
+ );
let bob_messages = crate::threads::store::blocking::get_messages(
bob.clone(),
workspace.clone(),
@@ -201,10 +203,12 @@ async fn typed_channel_projection_uses_scoped_persisted_row_bindings_after_resta
bob_messages[0].extra_metadata["voiceNote"]["opaqueId"],
"bob-voice"
);
- assert!(bob_messages[0]
- .extra_metadata
- .get("channelActivity")
- .is_none());
+ assert!(
+ bob_messages[0]
+ .extra_metadata
+ .get("channelActivity")
+ .is_none()
+ );
let projected = super::adapters::project_channel_event(&alice, event.clone())
.await
@@ -236,10 +240,12 @@ async fn typed_channel_projection_uses_scoped_persisted_row_bindings_after_resta
},
..event
};
- assert!(super::adapters::project_channel_event(&restarted, read)
- .await
- .unwrap()
- .is_some());
+ assert!(
+ super::adapters::project_channel_event(&restarted, read)
+ .await
+ .unwrap()
+ .is_some()
+ );
let messages = crate::threads::store::blocking::get_messages(restarted, workspace, thread_id)
.await
.unwrap();
@@ -285,8 +291,8 @@ async fn event_sink_rejects_non_object_payload() {
#[tokio::test]
async fn event_sink_ignores_legacy_reactions_without_a_typed_message_target() {
let sink = OpenHumanEventSink;
- assert!(sink
- .publish_host(
+ assert!(
+ sink.publish_host(
"channel",
"reaction_received",
serde_json::json!({
@@ -295,9 +301,10 @@ async fn event_sink_ignores_legacy_reactions_without_a_typed_message_target() {
}),
)
.await
- .is_ok());
- assert!(sink
- .publish_host(
+ .is_ok()
+ );
+ assert!(
+ sink.publish_host(
"channel",
"reaction_sent",
serde_json::json!({
@@ -306,14 +313,17 @@ async fn event_sink_ignores_legacy_reactions_without_a_typed_message_target() {
}),
)
.await
- .is_ok());
+ .is_ok()
+ );
// Unknown domain/kind is a benign no-op.
- assert!(sink
- .publish_host("mystery", "x", serde_json::json!({}))
- .await
- .is_ok());
- assert!(sink
- .publish_host("channel", "unknown", serde_json::json!({}))
- .await
- .is_ok());
+ assert!(
+ sink.publish_host("mystery", "x", serde_json::json!({}))
+ .await
+ .is_ok()
+ );
+ assert!(
+ sink.publish_host("channel", "unknown", serde_json::json!({}))
+ .await
+ .is_ok()
+ );
}
diff --git a/crates/openhuman-core/src/core/events.rs b/crates/openhuman-core/src/core/events.rs
index cceb1b74ac..7820b29c29 100644
--- a/crates/openhuman-core/src/core/events.rs
+++ b/crates/openhuman-core/src/core/events.rs
@@ -353,6 +353,22 @@ pub enum DomainEvent {
/// `workspace_dir` does not match their own workspace binding.
workspace_dir: std::path::PathBuf,
},
+ /// Retired legacy reaction callback payload. Kept as a wire tombstone for
+ /// Events 1.x compatibility; new providers publish typed `ChannelEvent`s.
+ ChannelReactionReceived {
+ channel: String,
+ sender: String,
+ target_message_id: String,
+ emoji: String,
+ },
+ /// Retired legacy reaction callback payload. Kept as a wire tombstone for
+ /// Events 1.x compatibility; new providers publish typed `ChannelEvent`s.
+ ChannelReactionSent {
+ channel: String,
+ target_message_id: String,
+ emoji: String,
+ success: bool,
+ },
/// A channel connected successfully.
ChannelConnected { channel: String },
/// A channel disconnected.
@@ -1365,6 +1381,8 @@ impl DomainEvent {
Self::ChannelInboundMessage { .. }
| Self::ChannelMessageReceived { .. }
| Self::ChannelMessageProcessed { .. }
+ | Self::ChannelReactionReceived { .. }
+ | Self::ChannelReactionSent { .. }
| Self::ChannelConnected { .. }
| Self::ChannelDisconnected { .. } => "channel",
@@ -1496,6 +1514,8 @@ impl DomainEvent {
Self::ChannelInboundMessage { .. } => "ChannelInboundMessage",
Self::ChannelMessageReceived { .. } => "ChannelMessageReceived",
Self::ChannelMessageProcessed { .. } => "ChannelMessageProcessed",
+ Self::ChannelReactionReceived { .. } => "ChannelReactionReceived",
+ Self::ChannelReactionSent { .. } => "ChannelReactionSent",
Self::ChannelConnected { .. } => "ChannelConnected",
Self::ChannelDisconnected { .. } => "ChannelDisconnected",
Self::CronJobTriggered { .. } => "CronJobTriggered",
diff --git a/crates/openhuman-core/src/core/events_tests.rs b/crates/openhuman-core/src/core/events_tests.rs
index f71d2c86ce..44182ff102 100644
--- a/crates/openhuman-core/src/core/events_tests.rs
+++ b/crates/openhuman-core/src/core/events_tests.rs
@@ -157,6 +157,24 @@ 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(),
@@ -763,19 +781,23 @@ fn a_long_error_is_clipped_on_a_character_boundary() {
/// Every other variant is unchanged: no detail, so its row renders as before.
#[test]
fn events_outside_the_supervisor_have_no_event_log_detail() {
- assert!(DomainEvent::CronJobCompleted {
- job_id: "job-1".into(),
- success: true,
- output: "done".into(),
- }
- .log_detail()
- .is_none());
- assert!(DomainEvent::McpServerConnected {
- server_id: "srv-1".into(),
- tool_count: 25,
- }
- .log_detail()
- .is_none());
+ assert!(
+ DomainEvent::CronJobCompleted {
+ job_id: "job-1".into(),
+ success: true,
+ output: "done".into(),
+ }
+ .log_detail()
+ .is_none()
+ );
+ assert!(
+ DomainEvent::McpServerConnected {
+ server_id: "srv-1".into(),
+ tool_count: 25,
+ }
+ .log_detail()
+ .is_none()
+ );
}
// ── workspace_dir ────────────────────────────────────────────────────────
@@ -925,6 +947,17 @@ 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,
+ "the retired wire tombstone has no workspace field"
+ );
}
/// The artifact family carries its workspace as a `String`, so it is the one