feat: implement subagent tool gating and timeout mechanisms for enhanced security and performance
This commit is contained in:
+27
-1
@@ -350,7 +350,33 @@ pub fn trigger_review(state: &mut AppStateRest) -> anyhow::Result<()> {
|
||||
probe_note,
|
||||
);
|
||||
|
||||
let (tx, _rx) = tokio::sync::mpsc::channel(32);
|
||||
// Use a drain thread for subagent events (so blocking_send never
|
||||
// fails on a closed channel) and log events at debug level for
|
||||
// observability during review runs.
|
||||
let (tx, rx) = tokio::sync::mpsc::channel(32);
|
||||
let _drain_thread = std::thread::spawn(move || {
|
||||
use crate::app::subagent::event::SubagentEvent;
|
||||
let mut rx = rx;
|
||||
while let Some(event) = rx.blocking_recv() {
|
||||
match &event {
|
||||
SubagentEvent::ToolCall { _tool, .. } => {
|
||||
tracing::debug!("[review] tool call: {}", _tool);
|
||||
}
|
||||
SubagentEvent::ToolResult { _tool, .. } => {
|
||||
tracing::debug!("[review] tool result: {}", _tool);
|
||||
}
|
||||
SubagentEvent::StepCompleted { _step, .. } => {
|
||||
tracing::trace!("[review] step {} completed", _step);
|
||||
}
|
||||
SubagentEvent::StepFailed { _step, _error } => {
|
||||
tracing::warn!("[review] step {} failed: {}", _step, _error);
|
||||
}
|
||||
SubagentEvent::Completed { .. } => {
|
||||
tracing::debug!("[review] completed");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
let turn_events = state.turn_events.clone();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
|
||||
Reference in New Issue
Block a user