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

@@ -6,7 +6,6 @@ use chrono::DateTime;
use chrono::Local;
use chrono::Utc;
use codex_config::types::McpServerConfig;
use codex_config::types::OtelExporterKind;
use codex_core::SleepFuture;
use codex_core::TimeFuture;
use codex_core::TimeProvider;
@@ -2397,14 +2396,12 @@ async fn interrupted_guardian_review_across_model_change_does_not_execute_the_co
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
#[tracing_test::traced_test]
#[test_case(None, false, true; "legacy_fallback")]
#[test_case(None, true, true; "otel_enabled")]
#[test_case(Some("Acting model rejection instructions."), false, true; "catalog_override")]
#[test_case(Some(""), false, true; "empty_override")]
#[test_case(None, false, false; "feedback_disabled")]
#[test_case(None, true; "legacy_fallback")]
#[test_case(Some("Acting model rejection instructions."), true; "catalog_override")]
#[test_case(Some(""), true; "empty_override")]
#[test_case(None, false; "feedback_disabled")]
async fn guardian_denial_rejects_tool_call_with_rationale(
rejection_instructions: Option<&'static str>,
log_assessments: bool,
feedback_enabled: bool,
) -> Result<()> {
skip_if_no_network!(Ok(()));
@@ -2455,12 +2452,6 @@ async fn guardian_denial_rejects_tool_call_with_rationale(
.with_config(move |config| {
config.feedback_enabled = feedback_enabled;
config.otel.log_user_prompt = true;
config.otel.log_guardian_assessments = log_assessments;
config.otel.exporter = OtelExporterKind::OtlpGrpc {
endpoint: "http://127.0.0.1:1".to_string(),
headers: Default::default(),
tls: None,
};
config.permissions.approval_policy = Constrained::allow_any(approval_policy);
config
.set_legacy_sandbox_policy(sandbox_policy_for_config)
@@ -2669,8 +2660,6 @@ async fn guardian_denial_rejects_tool_call_with_rationale(
"Guardian-denied command unexpectedly executed"
);
// Approval workers do not inherit the test span, so select the conversation explicitly.
let thread_id = test.session_configured.thread_id;
let logs = String::from_utf8(
tracing_test::internal::global_buf()
.lock()
@@ -2696,24 +2685,6 @@ async fn guardian_denial_rejects_tool_call_with_rationale(
1,
"Guardian prompt telemetry: {prompt_events:?}"
);
let assessments: Vec<_> = logs
.lines()
.filter(|line| {
line.contains("codex.guardian_assessment")
&& line.contains(&format!("conversation.id={thread_id}"))
})
.collect();
assert_eq!(assessments.len(), usize::from(log_assessments));
if let Some(log) = assessments.first() {
for field in [
"status=\"denied\"",
"outcome=\"deny\"",
"item.id=\"exec-call-denied\"",
"rationale=\"The requested write has unacceptable test risk.\"",
] {
assert!(log.contains(field), "missing {field}: {log}");
}
}
Ok(())
}