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
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:
@@ -2,6 +2,7 @@
|
||||
//! The host binds the original action, captures evidence and enforces authorization.
|
||||
//! Async approvals can return while cancelled attempts finish under the parent's task tracker.
|
||||
|
||||
use crate::GuardianReviewDetails;
|
||||
use crate::GuardianReviewError;
|
||||
use crate::GuardianReviewOutcome;
|
||||
use crate::GuardianReviewSessionLimits;
|
||||
@@ -9,7 +10,6 @@ use crate::ReviewDeadline;
|
||||
use crate::ReviewDenials;
|
||||
use crate::ReviewReport;
|
||||
use crate::ReviewRequest;
|
||||
use codex_analytics::GuardianReviewAnalyticsResult;
|
||||
use codex_extension_api::ExtensionFuture;
|
||||
use codex_extension_api::SynchronousApprovalReviewer;
|
||||
use codex_protocol::approvals::GuardianReviewReason;
|
||||
@@ -59,7 +59,7 @@ pub trait ReviewHost: Clone + Send + Sync + 'static {
|
||||
) -> impl Future<
|
||||
Output = (
|
||||
GuardianReviewOutcome,
|
||||
GuardianReviewAnalyticsResult,
|
||||
GuardianReviewDetails,
|
||||
Option<Self::Evidence>,
|
||||
),
|
||||
> + Send;
|
||||
@@ -144,25 +144,25 @@ impl<H: ReviewHost> SynchronousApprovalReviewer for ReviewRequest<'_, H> {
|
||||
.await
|
||||
}
|
||||
});
|
||||
let (outcome, analytics, evidence) = if let Some(async_approval) = async_approval {
|
||||
let (outcome, details, evidence) = if let Some(async_approval) = async_approval {
|
||||
tokio::select! {
|
||||
biased;
|
||||
result = &mut review => result,
|
||||
() = async_approval => {
|
||||
cancellation.cancel();
|
||||
let analytics = if let Some(runtime) = self.thread_store.get::<crate::ReviewerTasks>() {
|
||||
let details = if let Some(runtime) = self.thread_store.get::<crate::ReviewerTasks>() {
|
||||
// Keep driving the same attempt: its pool reservation stays held
|
||||
// until it drains, and parent shutdown joins the tracked cleanup.
|
||||
runtime.tasks.spawn(async move { let _ = review.await; });
|
||||
// Final session and usage metadata are not available yet.
|
||||
GuardianReviewAnalyticsResult {
|
||||
GuardianReviewDetails {
|
||||
attempt_count: attempts.load(Ordering::Relaxed),
|
||||
..GuardianReviewAnalyticsResult::without_session()
|
||||
..GuardianReviewDetails::without_session()
|
||||
}
|
||||
} else {
|
||||
// Hosts without a lifetime tracker must finish cleanup here.
|
||||
let (_, analytics, _) = review.await;
|
||||
analytics
|
||||
let (_, details, _) = review.await;
|
||||
details
|
||||
};
|
||||
let outcome = if !self.host.cached_approval_is_current(&prepared).await
|
||||
|| self.cancellation.is_cancelled() {
|
||||
@@ -172,35 +172,22 @@ impl<H: ReviewHost> SynchronousApprovalReviewer for ReviewRequest<'_, H> {
|
||||
} else {
|
||||
GuardianReviewOutcome::CachedApproval
|
||||
};
|
||||
(outcome, analytics, None)
|
||||
(outcome, details, None)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
review.await
|
||||
};
|
||||
let completed_at_ms = codex_analytics::now_unix_millis();
|
||||
let completed_at_ms = crate::now_unix_millis();
|
||||
let cached_approval = matches!(outcome, GuardianReviewOutcome::CachedApproval);
|
||||
let (completed, elapsed) = report.complete(
|
||||
outcome,
|
||||
self.model,
|
||||
self.require_guardian,
|
||||
analytics,
|
||||
details,
|
||||
completed_at_ms.try_into().unwrap_or_default(),
|
||||
);
|
||||
if self.log_assessments
|
||||
&& !cached_approval
|
||||
&& let Some(event) = &completed.event
|
||||
{
|
||||
self.telemetry
|
||||
.guardian_assessment(event, completed.assessment_outcome);
|
||||
}
|
||||
report.track(
|
||||
self.telemetry,
|
||||
self.analytics,
|
||||
completed.analytics,
|
||||
completed_at_ms,
|
||||
elapsed,
|
||||
);
|
||||
report.record_metrics(self.telemetry, completed.details, elapsed);
|
||||
if let Some(message) = completed.warning {
|
||||
self.host
|
||||
.emit(EventMsg::GuardianWarning(WarningEvent { message }))
|
||||
|
||||
Reference in New Issue
Block a user