Skip to content

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

fix: reject senderless Discord inbound events

Steven Enamakelf3bb357c7a6e
diff --git a/crates/openhuman-core/src/channels/bus/subscriber.rs b/crates/openhuman-core/src/channels/bus/subscriber.rs
index ac82e1827f..1fafdf6f0d 100644
--- a/crates/openhuman-core/src/channels/bus/subscriber.rs
+++ b/crates/openhuman-core/src/channels/bus/subscriber.rs
@@ -63,6 +63,16 @@ impl EventHandler<DomainEvent> for ChannelInboundSubscriber {
message.len()
);
+ // Discord's backend supplies the author's id for every forwarded DM.
+ // If that contract is broken, the legacy channel-only key would let
+ // different users share one chat session and its prepared wallet quote.
+ if channel.split(':').next() == Some("discord")
+ && sender.as_deref().is_none_or(|value| value.trim().is_empty())
+ {
+ tracing::warn!("[channel-inbound] dropping Discord message without sender id");
+ return;
+ }
+
// Mirror `channels::context::conversation_history_key`: the inbound
// path must key on `(channel, sender, reply_target, thread_ts)` —
// not channel alone — or distinct participants in a shared