From cdf20ffcbad3d12018f77bc7daf2b6275be009fa Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Thu, 30 Apr 2026 10:44:44 -0700 Subject: [PATCH] agentHost: improve update pickup and fix startup-failure wedge (#313541) - Shorten background update check interval from 24h to 6h so newly published server versions are picked up sooner after auto-shutdown. - Don't store the child into self.running when it exits before signaling ready. Previously a failed startup left a dead child in running forever, wedging ensure_server() so it could never restart the server. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/src/tunnels/agent_host.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cli/src/tunnels/agent_host.rs b/cli/src/tunnels/agent_host.rs index 640de39632a..2d50c926885 100644 --- a/cli/src/tunnels/agent_host.rs +++ b/cli/src/tunnels/agent_host.rs @@ -33,7 +33,7 @@ use crate::util::sync::{new_barrier, Barrier, BarrierOpener}; use super::paths::{get_server_folder_name, SERVER_FOLDER_NAME}; /// How often to check for server updates. -pub const UPDATE_CHECK_INTERVAL: Duration = Duration::from_secs(24 * 60 * 60); +pub const UPDATE_CHECK_INTERVAL: Duration = Duration::from_secs(6 * 60 * 60); /// How often to re-check whether the server has exited when an update is pending. pub const UPDATE_POLL_INTERVAL: Duration = Duration::from_secs(10 * 60); /// How long to wait for the server to signal readiness. @@ -243,7 +243,10 @@ impl AgentHostManager { if let Some(o) = opener.take() { o.open(Err(format!("Server exited before ready: {e:?}"))); } - break; + // Child has already exited; don't store it in `running`, + // otherwise the manager would be wedged with a dead child + // forever and ensure_server() would never restart. + return; } } @@ -261,10 +264,6 @@ impl AgentHostManager { }); } - if !ready { - return; - } - info!(self.log, "[{}]: Server ready", commit_prefix); // Continue reading output until the process exits