mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:30:49 +00:00
Initialize Statsig feature gates across Codex launch modes (#64001)
## Why Enabling `statsig_gates` can only load evaluations if the process starts the Statsig runtime. Several Codex entry points never started it. ## What changed Start Statsig in standalone and embedded app servers, the TUI when it connects to a separate app server, eligible `codex sandbox` launches, and local and remote exec servers. This also covers `codex exec` through its embedded app server. Use the serving or local account where applicable and installation identity for remote execution. Share the runtime with the embedded TUI and flush it on normal shutdown. ## Testing Add a CLI integration test that checks which evaluation endpoint each launch mode requests, including signed-in and signed-out sandbox launches. Supply a bundled fixture key in Bazel and nextest CI builds so the test runs. GitOrigin-RevId: 64df9933c1a9783a86be8712fa012b495f34b0f8
This commit is contained in:
@@ -323,6 +323,16 @@ impl ExecServerCommand {
|
||||
}
|
||||
remote_config.request_dispatch_mode = self.request_dispatch_mode;
|
||||
let remote_config = remote_config.with_telemetry(telemetry);
|
||||
let statsig = if self.command.is_none() {
|
||||
config
|
||||
.start_statsig(
|
||||
codex_core::statsig::StatsigSurface::RemoteExecutor,
|
||||
codex_core::statsig::HostIdentity::Installation,
|
||||
)
|
||||
.await
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let (shutdown_sender, shutdown_receiver) = tokio::sync::oneshot::channel();
|
||||
#[cfg(target_os = "macos")]
|
||||
let runtime_paths = runtime_paths.with_allowed_symlinked_codex_home(
|
||||
@@ -360,6 +370,7 @@ impl ExecServerCommand {
|
||||
exec_server_telemetry::ShutdownBehavior::Graceful(shutdown_sender),
|
||||
)
|
||||
.await;
|
||||
codex_core::statsig::StatsigRuntime::finish(statsig).await;
|
||||
if let Some(provider) = credential_provider {
|
||||
provider.check_pipe_failure()?;
|
||||
}
|
||||
@@ -378,6 +389,22 @@ impl ExecServerCommand {
|
||||
config_result.ok()
|
||||
};
|
||||
let (_otel, telemetry) = exec_server_telemetry::init(config.as_ref());
|
||||
let statsig = match &config {
|
||||
Some(config)
|
||||
if config
|
||||
.config_layer_stack
|
||||
.ensure_config_server_applied()
|
||||
.is_ok() =>
|
||||
{
|
||||
config
|
||||
.start_statsig(
|
||||
codex_core::statsig::StatsigSurface::ExecServer,
|
||||
codex_core::statsig::HostIdentity::LocalAccount,
|
||||
)
|
||||
.await
|
||||
}
|
||||
Some(_) | None => None,
|
||||
};
|
||||
#[cfg(target_os = "macos")]
|
||||
let runtime_paths = runtime_paths.with_allowed_symlinked_codex_home(
|
||||
config.as_ref().and_then(|config| {
|
||||
@@ -406,7 +433,9 @@ impl ExecServerCommand {
|
||||
ParentLifetime::Independent,
|
||||
exec_server_telemetry::ShutdownBehavior::Immediate,
|
||||
);
|
||||
run.await.map_err(anyhow::Error::from_boxed)
|
||||
let result = run.await.map_err(anyhow::Error::from_boxed);
|
||||
codex_core::statsig::StatsigRuntime::finish(statsig).await;
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user