Skip to content

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

refactor(threads): flatten nested condition in persist_channel_turn

Steven Enamakel3d5edb70ebe0
diff --git a/crates/openhuman-core/src/threads/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rs
index 0cb69bc2de..13f5cbb954 100644
--- a/crates/openhuman-core/src/threads/store/bus.rs
+++ b/crates/openhuman-core/src/threads/store/bus.rs
@@ -398,13 +398,14 @@ async fn persist_channel_turn(
workspace_dir: &Path,
descriptor: ChannelTurnDescriptor<'_>,
) -> Result<(), String> {
- if let Some(envelope) = descriptor.inbound_envelope
- && (envelope.channel.id != descriptor.channel
+ if let Some(envelope) = descriptor.inbound_envelope {
+ if envelope.channel.id != descriptor.channel
|| envelope.message_id != descriptor.message_id
|| envelope.sender.id != descriptor.sender
- || envelope.conversation.id != descriptor.reply_target)
- {
- return Err("inbound envelope identity does not match message".into());
+ || envelope.conversation.id != descriptor.reply_target
+ {
+ return Err("inbound envelope identity does not match message".into());
+ }
}
// The fixture exists only where both features compile it (channels/mod.rs).
#[cfg(all(test, feature = "channels", feature = "modules"))]