[KongchangAI]
Conceptstd::sync::OnceLock

OnceLock

A one-time initialization primitive in the Rust standard library that allows a value to be written only once during the lifetime of the process, after which it is read-only and thread-safe. It is commonly used to cache the results of expensive initialization.

Timeline (last 90 days)

Oct 13

In crates/agent-runtime/src/dependencies.rs, CodeSmith adopts a 'probe first, then decide' approach to probe Python candidate commands in order (PYTHON_CANDIDATES = ["python3", "python", "py -3"]), and caches the results in a OnceLock for the process lifetime to avoid repeatedly executing the probe on every round of model interaction.

Unverified50%
Oct 13

OnceLock is a one-time initialization primitive in the Rust standard library (std::sync::OnceLock) that allows a value to be written only once during the process lifetime, after which all accesses are read-only and thread-safe; its cost is that the cache is unaware of runtime environment changes, such as needing to restart the process for a mid-run Python installation to take effect.

Unverified50%

All Facts (2)

Source Articles