mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
## What changed - Probe whether the native Windows MXC process security environment is usable when selecting a sandbox. - Emit `codex.windows_mxc.available` at most once per process, labeled with the probe result. - Add the MXC workspace dependencies for Cargo and Bazel, and pin `tracelogging` to a version compatible with the GNU Windows toolchain. GitOrigin-RevId: d7cfeed6f0333feda5764e1ee44fe5bbd50f9a58
29 lines
1.1 KiB
Rust
29 lines
1.1 KiB
Rust
//! Native Windows MXC capability discovery and availability metrics.
|
|
//! Probing is cached upstream; reporting happens at most once per process.
|
|
|
|
use appcontainer_common::base_container_runner::BaseContainerRunner;
|
|
use std::sync::atomic::AtomicBool;
|
|
use std::sync::atomic::Ordering;
|
|
|
|
static AVAILABILITY_RECORDED: AtomicBool = AtomicBool::new(false);
|
|
|
|
// tracelogging 1.2.3 leaves its ETW import library to the application. These
|
|
// APIs are exported by Advapi32 in both the MSVC and GNU Windows toolchains.
|
|
#[link(name = "advapi32")]
|
|
unsafe extern "system" {}
|
|
|
|
pub(super) fn record_availability_once() {
|
|
// Probe actual PSEC create/close support; symbol presence alone also
|
|
// succeeds on transitional Windows builds where MXC is not enabled.
|
|
let available = BaseContainerRunner::is_process_security_environment_usable();
|
|
if let Some(metrics) = codex_otel::global()
|
|
&& !AVAILABILITY_RECORDED.swap(true, Ordering::Relaxed)
|
|
{
|
|
let _ = metrics.counter(
|
|
"codex.windows_mxc.available",
|
|
/*inc*/ 1,
|
|
&[("available", if available { "true" } else { "false" })],
|
|
);
|
|
}
|
|
}
|