aKode fase 2c: eliminato il codice di invio dati (crate analytics, otel-trace-websocket, sentry, esportatori OTLP); /feedback salva solo in locale; chiavi legacy [analytics]/[otel] accettate e ignorate; test di analytics/OTLP/upload rimossi
Some checks failed
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled

This commit is contained in:
Andrea
2026-11-09 18:45:41 +01:00
parent 981745ccc8
commit 60532b6337
509 changed files with 2043 additions and 46606 deletions

View File

@@ -3,6 +3,7 @@ use std::time::Duration;
use anyhow::Result;
use app_test_support::MockResponsesConfig;
use app_test_support::TestAppServer;
use app_test_support::mount_chatgpt_account;
use codex_app_server_protocol::ThreadStartParams;
use codex_app_server_protocol::TurnStartParams;
use codex_app_server_protocol::UserInput;
@@ -21,11 +22,6 @@ use wiremock::matchers::body_partial_json;
use wiremock::matchers::method;
use wiremock::matchers::path;
use super::analytics::mount_analytics_capture;
use super::analytics::wait_for_matching_analytics_event;
const DEFAULT_READ_TIMEOUT: Duration = Duration::from_secs(30);
const THREAD_HINT: &str =
"Recent notes (up to 5, most-recent first):\n- /root/notes/latest.md (2 lines, 14 UTF-8 bytes)";
const BRIDGE_HINT: &str = "unstructured notes/thread_hint fixture result";
@@ -138,7 +134,7 @@ async fn app_server_uses_configured_notes_backend_for_context_window_hints(
server.uri(),
))
.write(codex_home.path())?;
mount_analytics_capture(&backend, codex_home.path()).await?;
mount_chatgpt_account(&backend, codex_home.path()).await?;
let mut app_server = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -231,27 +227,11 @@ async fn app_server_uses_configured_notes_backend_for_context_window_hints(
&& item["name"] == "thread_hint"
}));
if use_history_notes_extension {
let event = wait_for_matching_analytics_event(&backend, DEFAULT_READ_TIMEOUT, |event| {
event["event_type"] == "codex_thread_hint_status"
&& event["event_params"]["thread_id"] == thread.id
})
.await?;
assert_eq!(
event["event_params"]["status"],
if hint_status == 200 {
"succeeded"
} else {
"failed"
},
);
}
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn history_notes_and_async_message_emit_control_tool_analytics() -> Result<()> {
async fn history_notes_and_async_message_control_tools_execute() -> Result<()> {
let encrypted_query = format!("enc_query_{}", "x".repeat(1_001));
let calls = [
("history", "list_windows", json!({})),
@@ -364,7 +344,7 @@ async fn history_notes_and_async_message_emit_control_tool_analytics() -> Result
"[features.token_budget]\nenabled = true\nuse_history_notes_extension = true",
)
.write(codex_home.path())?;
mount_analytics_capture(&backend, codex_home.path()).await?;
mount_chatgpt_account(&backend, codex_home.path()).await?;
let mut app_server = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -376,7 +356,7 @@ async fn history_notes_and_async_message_emit_control_tool_analytics() -> Result
.start_thread(ThreadStartParams::default())
.await?
.thread;
let completed = app_server
app_server
.start_turn_and_wait_for_completion(TurnStartParams {
thread_id: thread.id.clone(),
input: vec![UserInput::Text {
@@ -400,45 +380,6 @@ async fn history_notes_and_async_message_emit_control_tool_analytics() -> Result
assert_eq!(tool["parameters"]["properties"][field]["encrypted"], true);
}
for (index, (namespace, tool, _)) in calls.iter().enumerate() {
let event = wait_for_matching_analytics_event(&backend, DEFAULT_READ_TIMEOUT, |event| {
event["event_type"] == "codex_control_tool_call_event"
&& event["event_params"]["item_id"] == format!("call-{index}")
})
.await?;
let params = &event["event_params"];
assert_eq!(
json!({
"tool": params["tool_name"],
"thread": params["thread_id"],
"turn": params["turn_id"],
"status": params["terminal_status"],
"origin": params["originating_response_id"],
"duration": params["execution_duration_ms"].is_u64(),
}),
json!({
"tool": if *namespace == "functions" { tool.to_string() } else { format!("{namespace}.{tool}") },
"thread": thread.id,
"turn": completed.turn.id,
"status": if index < 10 { "completed" } else { "failed" },
"origin": format!("resp-{index}"),
"duration": true,
})
);
assert!(!event.to_string().contains("PRIVATE_"));
}
let turn_event = wait_for_matching_analytics_event(&backend, DEFAULT_READ_TIMEOUT, |event| {
event["event_type"] == "codex_turn_event"
&& event["event_params"]["turn_id"] == completed.turn.id
})
.await?;
assert_eq!(
json!({
"total": turn_event["event_params"]["total_tool_call_count"],
"dynamic": turn_event["event_params"]["dynamic_tool_call_count"],
}),
json!({"total": calls.len(), "dynamic": 0})
);
assert_eq!(
response_mock.requests()[10].function_call_output_text("call-9"),
Some(r#"{"accepted":true}"#.to_string())