fix(discord): use channel_id instead of sender for replies (fixes #483)
fix(misc): complete parking_lot::Mutex migration (fixes #505) - DiscordChannel: store actual channel_id in ChannelMessage.channel instead of hardcoded "discord" string - channels/mod.rs: use msg.channel instead of msg.sender for replies - Migrate all std::sync::Mutex to parking_lot::Mutex: * src/security/audit.rs * src/memory/sqlite.rs * src/memory/response_cache.rs * src/memory/lucid.rs * src/channels/email_channel.rs * src/gateway/mod.rs * src/observability/traits.rs * src/providers/reliable.rs * src/providers/router.rs * src/agent/agent.rs - Remove all .lock().unwrap() and .map_err(PoisonError) patterns since parking_lot::Mutex never poisons Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f7d77b09f4
commit
1908af3248
12 changed files with 43 additions and 61 deletions
|
|
@ -344,7 +344,7 @@ impl Channel for DiscordChannel {
|
|||
}
|
||||
|
||||
let message_id = d.get("id").and_then(|i| i.as_str()).unwrap_or("");
|
||||
let _channel_id = d.get("channel_id").and_then(|c| c.as_str()).unwrap_or("").to_string();
|
||||
let channel_id = d.get("channel_id").and_then(|c| c.as_str()).unwrap_or("").to_string();
|
||||
|
||||
let channel_msg = ChannelMessage {
|
||||
id: if message_id.is_empty() {
|
||||
|
|
@ -354,7 +354,7 @@ impl Channel for DiscordChannel {
|
|||
},
|
||||
sender: author_id.to_string(),
|
||||
content: content.to_string(),
|
||||
channel: "discord".to_string(),
|
||||
channel: channel_id,
|
||||
timestamp: std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize};
|
|||
use std::collections::HashSet;
|
||||
use std::io::Write as IoWrite;
|
||||
use std::net::TcpStream;
|
||||
use std::sync::Mutex;
|
||||
use parking_lot::Mutex;
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::time::{interval, sleep};
|
||||
|
|
@ -415,7 +415,7 @@ impl Channel for EmailChannel {
|
|||
let mut seen = self
|
||||
.seen_messages
|
||||
.lock()
|
||||
.expect("seen_messages mutex should not be poisoned");
|
||||
;
|
||||
if seen.contains(&id) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ async fn process_channel_message(ctx: Arc<ChannelRuntimeContext>, msg: traits::C
|
|||
truncate_with_ellipsis(&response, 80)
|
||||
);
|
||||
if let Some(channel) = target_channel.as_ref() {
|
||||
if let Err(e) = channel.send(&response, &msg.sender).await {
|
||||
if let Err(e) = channel.send(&response, &msg.channel).await {
|
||||
eprintln!(" ❌ Failed to reply on {}: {e}", channel.name());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue