pub struct CompilationConfig {Show 13 fields
pub confidence_threshold: f64,
pub min_local_time_ms: u64,
pub remote_speedup_threshold: f64,
pub build_slots: u32,
pub test_slots: u32,
pub check_slots: u32,
pub disk_headroom_gib: u32,
pub build_timeout_sec: u64,
pub test_timeout_sec: u64,
pub bun_timeout_sec: u64,
pub external_timeout_enabled: bool,
pub allow_local_fallback: bool,
pub remote_build_jobs: RemoteBuildJobs,
}Fields§
§confidence_threshold: f64Minimum confidence score to intercept (0.0-1.0).
min_local_time_ms: u64Skip interception if estimated local time < this (ms).
remote_speedup_threshold: f64Minimum expected speedup ratio (local_time / remote_time) to offload. If predicted speedup < threshold, run locally. Default: 1.2 (20% faster). Set to 1.0 to always offload when other criteria are met.
build_slots: u32Default slot estimate for build commands (cargo build, gcc, etc.).
test_slots: u32Default slot estimate for test commands (cargo test, nextest). Tests typically use more parallelism than builds.
check_slots: u32Default slot estimate for check/lint commands (cargo check, clippy). These are typically faster and use fewer resources.
disk_headroom_gib: u32Per-build additional free-space budget on the worker’s reported build filesystem, in GiB. Include expected output growth and a safety margin. Zero (default) disables this explicit budget. Positive budgets require a fresh disk observation and are held in durable daemon ownership until completion. They are admission accounting, not filesystem quotas.
build_timeout_sec: u64Timeout in seconds for build commands. Build commands (cargo build, gcc, etc.) typically complete faster than tests.
test_timeout_sec: u64Timeout in seconds for test commands. Test commands often need longer timeouts due to test suite execution time.
bun_timeout_sec: u64Timeout in seconds for bun commands (bun test, bun typecheck). Bun has known issues where its internal –timeout flag doesn’t work for CPU-bound hangs, so we use a shorter external timeout by default.
external_timeout_enabled: boolWhether to wrap remote commands with external timeout protection. This prevents runaway/stuck processes from consuming worker slots indefinitely. Default: true. Set to false to disable timeout wrapping entirely.
allow_local_fallback: boolWhether a remote build FAILURE may fall back to LOCAL execution on the orchestrator once every eligible remote worker has been exhausted.
On a remote failure the hook first retries the build on a different,
higher-capacity worker (see run_exec’s worker-fallback loop). Local
execution runs the heavy compile on the orchestrator that coordinates the
whole fleet, so it is a genuine last resort and can flood that box. This
flag gates it. Default true preserves the historical fail-open behavior
(local only when no worker can serve); set to false on an orchestrator
to refuse local fallback and fail the build closed instead. force_remote
/ proof mode / RCH_REQUIRE_REMOTE still override this by refusing local
unconditionally.
remote_build_jobs: RemoteBuildJobsPer-job rustc parallelism cap applied on the WORKER (issue #49).
total_slots bounds concurrent jobs per worker, but cargo defaults
-j to the worker’s nproc, so one offloaded cargo test --workspace
forks nproc rustc regardless of slots and can swap-thrash a
RAM-light box. This policy injects CARGO_BUILD_JOBS into the remote
build environment; see RemoteBuildJobs for the modes. It never
overrides a CARGO_BUILD_JOBS the worker session already carries, an
inline CARGO_BUILD_JOBS=N or -j N in the command, or a project
.cargo/config.toml [build] jobs — explicit intent always wins.
Implementations§
Source§impl CompilationConfig
impl CompilationConfig
Sourcepub fn timeout_for_kind(&self, kind: Option<CompilationKind>) -> Duration
pub fn timeout_for_kind(&self, kind: Option<CompilationKind>) -> Duration
Returns the appropriate external timeout for the given compilation kind.
- Bun commands get the shorter bun_timeout (to protect against known hang issues)
- Test commands get the longer test_timeout
- All other commands (builds, checks, clippy) get the build_timeout
Sourcepub fn external_timeout_enabled(&self) -> bool
pub fn external_timeout_enabled(&self) -> bool
Returns whether external timeout wrapping is enabled.