mirror of
https://github.com/openai/codex.git
synced 2026-11-22 23:00:42 +00:00
Expose a stable executor build identity in environment metadata (#43513)
## Why Executor compatibility checks need a build identity that distinguishes commits and compiler targets independently of the package release version. ## What changed - Add optional `providerId` to exec-server environment metadata, cached at startup and returned by initialization and `environment/info`. - Derive the ID as SHA-256 of `git:<lowercase commit>:<target>`. It identifies a standard build configuration, not exact executable bytes, and is omitted when the commit stamp or target is unavailable or invalid. - Embed the compiler target in `BuildInfo`, preserve compatibility with historical metadata without a target, and stamp Cargo release builds with `STABLE_GIT_COMMIT`. - Group Bazel build-script argument files under one `--arg-file` flag to reduce Windows command-line length while preserving file order. ## Testing Add deterministic build-ID vectors across targets, commit normalization and invalid input coverage, and historical metadata compatibility tests. Extend exec-server coverage for metadata caching and ensure runtime environment overrides cannot replace the executor's build identity. GitOrigin-RevId: 125a18c23de7ad006571940ba305836376c983f4
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
//! Cache the running executor's build identity before accepting connections.
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use codex_build_info::BuildInfo;
|
||||
use codex_build_info::build_id;
|
||||
|
||||
use crate::protocol::EnvironmentInfo;
|
||||
|
||||
pub(super) static PROVIDER_ID: LazyLock<Option<String>> = LazyLock::new(|| {
|
||||
let info = BuildInfo::get();
|
||||
info.target()
|
||||
.and_then(|target| build_id(info.build_commit(), target))
|
||||
});
|
||||
|
||||
pub(super) fn local_environment_info() -> EnvironmentInfo {
|
||||
EnvironmentInfo {
|
||||
provider_id: PROVIDER_ID.clone(),
|
||||
..super::release_version::local_environment_info()
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,7 @@ use crate::rpc::RpcNotificationSender;
|
||||
use crate::rpc::internal_error;
|
||||
use crate::rpc::invalid_params;
|
||||
use crate::rpc::invalid_request;
|
||||
use crate::server::build_identity::local_environment_info;
|
||||
use crate::server::file_system_handler::FileSystemHandler;
|
||||
use crate::server::session_registry::SessionHandle;
|
||||
use crate::server::session_registry::SessionRegistry;
|
||||
@@ -162,7 +163,7 @@ impl ExecServerHandler {
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner) = Some(session);
|
||||
Ok(InitializeResponse {
|
||||
session_id,
|
||||
environment_info: Some(super::release_version::local_environment_info()),
|
||||
environment_info: Some(local_environment_info()),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -197,7 +198,7 @@ impl ExecServerHandler {
|
||||
|
||||
pub(crate) fn environment_info(&self) -> Result<EnvironmentInfo, JSONRPCErrorError> {
|
||||
self.require_initialized_for("environment info")?;
|
||||
Ok(super::release_version::local_environment_info())
|
||||
Ok(local_environment_info())
|
||||
}
|
||||
|
||||
pub(crate) async fn environment_config_read(
|
||||
|
||||
Reference in New Issue
Block a user