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

@ -18,6 +18,7 @@ use project::{AgentLocation, Project};
use std::collections::HashMap;
use std::error::Error;
use std::fmt::Formatter;
use std::process::ExitStatus;
use std::rc::Rc;
use std::{
fmt::Display,
@ -581,6 +582,7 @@ pub enum AcpThreadEvent {
ToolAuthorizationRequired,
Stopped,
Error,
ServerExited(ExitStatus),
}
impl EventEmitter<AcpThreadEvent> for AcpThread {}
@ -1229,6 +1231,10 @@ impl AcpThread {
pub fn to_markdown(&self, cx: &App) -> String {
self.entries.iter().map(|e| e.to_markdown(cx)).collect()
}
pub fn emit_server_exited(&mut self, status: ExitStatus, cx: &mut Context<Self>) {
cx.emit(AcpThreadEvent::ServerExited(status));
}
}
#[cfg(test)]