runtime-rs: enforce a minimum vsock reconnect window

Low-CPU sandboxes can take longer than a few seconds to complete guest
boot and start the agent.

Let's clamp the reconnect timeout to a safe minimum so sandbox startup
does not fail early with transient vsock ECONNRESET.

Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
Assisted-by: Codex <codex@openai.com>
This commit is contained in:
Fabiano Fidêncio
2026-06-07 13:04:20 +02:00
parent ed34d7811d
commit 4d569c22b4

View File

@@ -90,9 +90,14 @@ pub struct ConnectConfig {
impl ConnectConfig {
pub fn new(dial_timeout_ms: u64, reconnect_timeout_ms: u64) -> Self {
// With static sandbox resource sizing enabled by default, tiny CPU
// allocations can make early guest boot/agent startup exceed 3s on
// loaded nodes. Keep a reasonable lower bound to avoid premature
// sandbox teardown during agent bring-up.
const MIN_RECONNECT_TIMEOUT_MS: u64 = 10_000;
Self {
dial_timeout_ms,
reconnect_timeout_ms,
reconnect_timeout_ms: reconnect_timeout_ms.max(MIN_RECONNECT_TIMEOUT_MS),
}
}
}