Track thread archive analytics (#37199)

## What changed

- Emit `codex_thread_archive_event` when a thread is successfully archived or
  unarchived, including the thread ID, action, and producer timestamp.
- Route archive notifications through the analytics client while preserving
  normal app-server notification delivery.

## Testing

- Extend app-server coverage for archive and unarchive analytics, including
  descendant archives and a repeated archive request that fails without
  producing another event.

GitOrigin-RevId: 0d973c232fd795b7cd6cddd47ecc9446234c44dd
This commit is contained in:
Eddie Chen authored and copyberry committed 2026-08-06 02:30:18 +00:00
1 parent 547080e4d6
commit 70b4653232
6 files changed
+176 -4

No files matched your search

+21
View File
@@ -63,6 +63,7 @@ pub(crate) struct TrackEventsRequest {
pub(crate) enum TrackEventRequest {
SkillInvocation(SkillInvocationEventRequest),
ThreadInitialized(ThreadInitializedEvent),
ThreadArchive(ThreadArchiveEvent),
GuardianReview(Box<GuardianReviewEventRequest>),
AppMentioned(CodexAppMentionedEventRequest),
AppUsed(CodexAppUsedEventRequest),
@@ -187,6 +188,26 @@ pub(crate) struct ThreadInitializedEvent {
pub(crate) event_params: ThreadInitializedEventParams,
}
#[derive(Clone, Copy, Serialize)]
#[serde(rename_all = "snake_case")]
pub(crate) enum ThreadArchiveAction {
Archived,
Unarchived,
}
#[derive(Serialize)]
pub(crate) struct ThreadArchiveEventParams {
pub(crate) thread_id: String,
pub(crate) action: ThreadArchiveAction,
pub(crate) occurred_at_ms: u64,
}
#[derive(Serialize)]
pub(crate) struct ThreadArchiveEvent {
pub(crate) event_type: &'static str,
pub(crate) event_params: ThreadArchiveEventParams,
}
#[derive(Serialize)]
pub(crate) struct GuardianReviewEventRequest {
pub(crate) event_type: &'static str,