A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
speed up daemon startup checks (#3260)
kt00b1a56aaea2
diff --git a/crates/pa-cli/src/interactive_mode/daemon.rs b/crates/pa-cli/src/interactive_mode/daemon.rsindex 578c944130..96103d89f0 100644--- a/crates/pa-cli/src/interactive_mode/daemon.rs+++ b/crates/pa-cli/src/interactive_mode/daemon.rs@@ -9,12 +9,16 @@ use super::{anyhow, Command, Duration, Instant, Path, Result, Stdio};const DAEMON_STARTUP_TIMEOUT_MS: u64 = 30_000;const DAEMON_SHUTDOWN_WAIT_MS: u64 = 5_000;/// Pause between daemon-startup probes (TS `ensureDaemonRunning` polls at-/// 25ms). This port tightens the poll to 5ms: a cold supervisor binds its-/// socket ~39ms after the spawn and the 25ms grid quantized every cold-/// launch by 0-25ms (mean ~12.5ms) of pure wait (boot-floor lane record-/// 20260926-194800 at 7064d039a). Timing-only: the probe itself, the-/// 30s startup budget, and the timeout error are unchanged.-const DAEMON_PROBE_INTERVAL_MS: u64 = 5;+/// 25ms). A cold supervisor binds its socket ~39ms after the spawn, so the+/// poll interval quantizes every cold launch: the bind lands 0-interval+/// before the next probe, a pure wait on a floor of microseconds. The 1ms+/// interval caps that overshoot at <=1ms for the cost of ~40 failed+/// connects per cold launch (each ~us; bounded by the same 30s startup+/// budget, so a hung boot adds at most ~1k connects/s of syscall work,+/// not a spin). Overshoot tables: probe-grid record 20261001-034500 on the+/// bench repo. Timing-only: the probe itself, the 30s startup budget, and+/// the timeout error are unchanged.+const DAEMON_PROBE_INTERVAL_MS: u64 = 1;/// The daemon probe outcome (TS `DaemonVersionProbe`).enum DaemonProbe {diff --git a/crates/pa-daemon/src/supervisor/launch_budget.rs b/crates/pa-daemon/src/supervisor/launch_budget.rsindex 529996cf76..d00234b83e 100644--- a/crates/pa-daemon/src/supervisor/launch_budget.rs+++ b/crates/pa-daemon/src/supervisor/launch_budget.rs@@ -30,16 +30,19 @@ pub(super) const WORKER_CONNECT_PROBE_MS: u64 = 2_000;/// Pause between probe attempts. TS `WORKER_PROBE_BACKOFF_MIN_MS` (25ms)/// doubles per retry up to `WORKER_PROBE_BACKOFF_MAX_MS` (win32 2s, unix/// 25 - TS's min equals its max there, so the doubling is a flat grid).-/// This port keeps the unix pause flat at a tightened 5ms: a session-/// worker binds its socket ~1-3ms after the fork (measured cold-open-/// boot floor at 7064d039a, boot-floor lane record 20260926-194800), so-/// the 25ms grid quantized every spawn by 0-25ms (mean ~12.5ms) of pure-/// wait on the open path. Windows doubles exactly like TS (a flat 2s-/// first retry would sleep through the sub-second boots the doubling-/// exists to catch). Timing-only: the probe, the connect budget, the-/// auth floor, and the launch-failure error are unchanged.+/// Unix keeps a flat pause (the doubling adds nothing when min==max) at+/// 1ms: a session worker binds its socket ~1-3ms after the fork, the+/// probe loop starts once the descriptor's durable persist has landed,+/// and the pause quantizes the bind only in the windows where that+/// persist finishes before the worker binds - a 1ms pause caps the+/// overshoot at <=1ms for the cost of ~2-4 failed connects per spawn+/// (each ~us). Windows doubles exactly like TS (a flat 2s first retry+/// would sleep through the sub-second boots the doubling exists to+/// catch). Overshoot tables: probe-grid record 20261001-034500 on the+/// bench repo. Timing-only: the probe, the connect budget, the auth+/// floor, and the launch-failure error are unchanged.#[cfg(unix)]-pub(super) const WORKER_CONNECT_BACKOFF_MS: u64 = 5;+pub(super) const WORKER_CONNECT_BACKOFF_MS: u64 = 1;/// TS `WORKER_PROBE_BACKOFF_MIN_MS`: the first retry pause.#[cfg(not(unix))]pub(super) const WORKER_PROBE_BACKOFF_MIN_MS: u64 = 25;