From 0a1dce3215380fa84a50e632c59a8a3c8fab182f Mon Sep 17 00:00:00 2001 From: Deven Ducommun Date: Tue, 9 Jun 2026 14:21:27 -0700 Subject: [PATCH] fix(daemon): drain UI channel in headless mode to prevent panic On PinePhone (headless display), the UI update receiver was dropped immediately, causing sends from diag.rs to fail with SendError and panic. Spawn a task that drains the channel until shutdown. Fixes #657 Co-Authored-By: Claude Opus 4.6 --- daemon/src/display/headless.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/daemon/src/display/headless.rs b/daemon/src/display/headless.rs index 88cfe31..9ae38e5 100644 --- a/daemon/src/display/headless.rs +++ b/daemon/src/display/headless.rs @@ -7,10 +7,18 @@ use crate::config; use crate::display::DisplayState; pub fn update_ui( - _task_tracker: &TaskTracker, + task_tracker: &TaskTracker, _config: &config::Config, - _shutdown_token: CancellationToken, - _ui_update_rx: Receiver, + shutdown_token: CancellationToken, + mut ui_update_rx: Receiver, ) { info!("Headless mode, not spawning UI."); + task_tracker.spawn(async move { + loop { + tokio::select! { + _ = shutdown_token.cancelled() => break, + _ = ui_update_rx.recv() => {} + } + } + }); }