Render error state when agent binary exits unexpectedly (#35651)

This PR adds handling for the case where an agent binary exits
unexpectedly after successfully establishing a connection.

Release Notes:

- N/A

---------

Co-authored-by: Agus <agus@zed.dev>
This commit is contained in:
Cole Miller 2025-08-05 18:52:08 -04:00 committed by GitHub
parent 142efbac0d
commit bc2108cbba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 116 additions and 35 deletions

View file

@ -61,11 +61,24 @@ impl AcpConnection {
}
});
let io_task = cx.background_spawn(async move {
io_task.await?;
drop(child);
Ok(())
});
let io_task = cx.background_spawn(io_task);
cx.spawn({
let sessions = sessions.clone();
async move |cx| {
let status = child.status().await?;
for session in sessions.borrow().values() {
session
.thread
.update(cx, |thread, cx| thread.emit_server_exited(status, cx))
.ok();
}
anyhow::Ok(())
}
})
.detach();
let response = connection
.initialize(acp::InitializeRequest {