mirror of
https://github.com/openai/codex.git
synced 2026-04-28 16:45:54 +00:00
[codex-analytics] enable general analytics by default (#17389)
## Summary - Make GeneralAnalytics stable and enabled by default. - Update feature tests and app-server lifecycle fixtures for explicit general_analytics=false. - Keep app-server integration tests isolated from host managed config so explicit feature fixtures are deterministic. ## Validation - cargo test -p codex-features - cargo test -p codex-app-server general_analytics (matched 0 tests) - cargo test -p codex-app-server thread_start_ - cargo test -p codex-app-server thread_fork_ - cargo test -p codex-app-server thread_resume_ - cargo test -p codex-app-server config_read_includes_system_layer_and_overrides
This commit is contained in:
@@ -144,6 +144,11 @@ impl McpProcess {
|
||||
cmd.current_dir(codex_home);
|
||||
cmd.env("CODEX_HOME", codex_home);
|
||||
cmd.env("RUST_LOG", "info");
|
||||
// Keep integration tests isolated from host managed configuration.
|
||||
cmd.env(
|
||||
"CODEX_APP_SERVER_MANAGED_CONFIG_PATH",
|
||||
codex_home.join("managed_config.toml"),
|
||||
);
|
||||
cmd.env_remove(CODEX_INTERNAL_ORIGINATOR_OVERRIDE_ENV_VAR);
|
||||
cmd.args(args);
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ use wiremock::matchers::path;
|
||||
use super::analytics::assert_basic_thread_initialized_event;
|
||||
use super::analytics::mount_analytics_capture;
|
||||
use super::analytics::thread_initialized_event;
|
||||
use super::analytics::wait_for_analytics_event;
|
||||
use super::analytics::wait_for_analytics_payload;
|
||||
|
||||
const DEFAULT_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10);
|
||||
@@ -281,16 +280,25 @@ async fn thread_start_does_not_track_thread_initialized_analytics_without_featur
|
||||
.await??;
|
||||
let _ = to_response::<ThreadStartResponse>(resp)?;
|
||||
|
||||
let payload = wait_for_analytics_event(
|
||||
&server,
|
||||
Duration::from_millis(250),
|
||||
"codex_thread_initialized",
|
||||
)
|
||||
.await;
|
||||
assert!(
|
||||
payload.is_err(),
|
||||
"thread analytics should be gated off when general_analytics is disabled"
|
||||
);
|
||||
assert_no_thread_initialized_analytics(&server, Duration::from_millis(250)).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn assert_no_thread_initialized_analytics(
|
||||
server: &MockServer,
|
||||
wait_duration: Duration,
|
||||
) -> Result<()> {
|
||||
tokio::time::sleep(wait_duration).await;
|
||||
let requests = server.received_requests().await.unwrap_or_default();
|
||||
for request in requests.iter().filter(|request| {
|
||||
request.method == "POST" && request.url.path() == "/codex/analytics-events/events"
|
||||
}) {
|
||||
let payload: Value = serde_json::from_slice(&request.body)?;
|
||||
assert!(
|
||||
thread_initialized_event(&payload).is_err(),
|
||||
"thread analytics should be gated off when general_analytics is disabled; payload={payload}"
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user