Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/acp/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ impl AcpConnection {
params: None,
});
}
// Signal subscriber
let sub = notify_tx.lock().await;
drop(sub);
// Close the notify channel so rx.recv() returns None
let mut sub = notify_tx.lock().await;
*sub = None;
})
};

Expand Down
11 changes: 10 additions & 1 deletion src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,16 @@ impl AdapterRouter {

// Process ACP notifications
let mut response_error: Option<String> = None;
while let Some(notification) = rx.recv().await {
let recv_timeout = std::time::Duration::from_secs(600);
loop {
let notification = match tokio::time::timeout(recv_timeout, rx.recv()).await {
Ok(Some(n)) => n,
Ok(None) => break, // channel closed
Err(_) => {
response_error = Some("Agent stopped responding".into());
break;
}
};
if notification.id.is_some() {
if let Some(ref err) = notification.error {
response_error = Some(format_coded_error(err.code, &err.message));
Expand Down
Loading