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>
This commit is contained in:
Connor Peet
2026-04-30 10:44:44 -07:00
committed by GitHub
parent e2a611e46c
commit cdf20ffcba
+5 -6
View File
@@ -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