huskies: merge 1093 bug Chat dispatcher spawns one Timmy per inbound message — needs coalesce window + per-session serial lock
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
//! transport's context struct.
|
||||
|
||||
use crate::agents::AgentPool;
|
||||
use crate::chat::dispatcher::ChatDispatcher;
|
||||
use crate::http::context::{PermissionDecision, PermissionForward};
|
||||
use crate::service::status::StatusBroadcaster;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
@@ -44,6 +45,12 @@ pub struct Services {
|
||||
/// only to subscribers of this instance, providing natural multi-project
|
||||
/// isolation.
|
||||
pub status: Arc<StatusBroadcaster>,
|
||||
/// Protocol-agnostic chat dispatcher shared by all transport handlers.
|
||||
///
|
||||
/// Transport handlers call [`ChatDispatcher::submit`] instead of spawning
|
||||
/// `claude -p` directly. The dispatcher applies a coalesce window and a
|
||||
/// per-session serial lock, preventing duplicate concurrent spawns.
|
||||
pub chat_dispatcher: Arc<ChatDispatcher>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -63,6 +70,7 @@ impl Services {
|
||||
perm_rx: std::sync::Arc::new(TokioMutex::new(perm_rx)),
|
||||
pending_perm_replies: std::sync::Arc::new(TokioMutex::new(HashMap::new())),
|
||||
permission_timeout_secs: 120,
|
||||
chat_dispatcher: std::sync::Arc::new(ChatDispatcher::new(1_500)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user