@ondeinference / ed / commits / 86dc30b

ed-acp: reset models/llm only after successful logout

Previously logout() cleared the models cache and llm config before checking the result of auth.logout(); a failed logout left the agent in an inconsistent state. Move the resets inside the Ok(()) arm so state is only cleared when logout actually succeeds. Co-Authored-By: siGit Code v1.6.7-acp <noreply@sigit.si>

Seto Elkahfi committed Oct 12, 2026 at 17:28 UTC 86dc30b4a15be4c694cd57a5dd9329b2e2d7f2ff
1 file changed +7 -6
crates/ed-acp/src/agent.rs
+7 -6
@@ -420,12 +420,13 @@ impl AcpServer {
420 /// and keeps the agent signed in.
421 pub async fn logout(&self) -> agent_client_protocol::Result<LogoutResponse> {
422 if let Some(auth) = &self.auth {
423 - let result = auth.logout().await;
424 - *self.models.lock().await = None;
425 - *self.llm.lock().unwrap() =
426 - LlmClient::new(Self::config_for(self.auth.as_deref(), &self.env));
427 - return match result {
428 - Ok(()) => Ok(LogoutResponse::new()),
423 + return match auth.logout().await {
424 + Ok(()) => {
425 + *self.models.lock().await = None;
426 + *self.llm.lock().unwrap() =
427 + LlmClient::new(Self::config_for(self.auth.as_deref(), &self.env));
428 + Ok(LogoutResponse::new())
429 + }
430 Err(e) => {
431 Err(agent_client_protocol::Error::internal_error().data(format!("{e:#}")))
432 }