From 3315b158dbc40d6a150dfb13529462bc7816c04a Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Wed, 11 Mar 2026 11:16:28 +0100 Subject: [PATCH] feat(appd): broadcast AppState::Stopped when supervised process exits runtime.rs: after the child exits (natural exit or abort), supervise() now broadcasts AppState { session_id, state: Stopped } in the same lock scope as set_state. WebSocket clients receive the notification without needing to poll QueryAppState or call TerminateApp. --- crates/weft-appd/src/runtime.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/weft-appd/src/runtime.rs b/crates/weft-appd/src/runtime.rs index b5ec290..eecae5e 100644 --- a/crates/weft-appd/src/runtime.rs +++ b/crates/weft-appd/src/runtime.rs @@ -75,10 +75,14 @@ pub(crate) async fn supervise( } } - registry - .lock() - .await - .set_state(session_id, AppStateKind::Stopped); + { + let mut reg = registry.lock().await; + reg.set_state(session_id, AppStateKind::Stopped); + let _ = reg.broadcast().send(Response::AppState { + session_id, + state: AppStateKind::Stopped, + }); + } Ok(()) }