Files
codex/codex-rs/analytics/src/thread_hint.rs
pmccrary-oai bdfd769640 Track history notes thread hint outcomes (#42247)
## What changed

- Emit a `codex_thread_hint_status` analytics event for each native history-notes thread hint attempt.
- Report whether retrieval was successful or failed along with thread context and timing, without including hint contents.
- Treat valid empty responses as successful retrievals while continuing to omit them from the context window.

## Testing

- Extend the app-server history-notes tests to verify success, empty-result success, and backend failure statuses.

GitOrigin-RevId: b9462f312847e8c871ed2be0c8cf8df0928a7fdd
2026-09-02 09:12:17 +00:00

39 lines
1.1 KiB
Rust

//! Per-attempt thread hint status analytics without hint contents.
use crate::events::CodexAppServerClientMetadata;
use crate::events::CodexRuntimeMetadata;
use codex_protocol::protocol::ThreadSource;
use serde::Serialize;
#[derive(Clone, Copy, Debug, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ThreadHintStatus {
Succeeded,
Failed,
}
pub struct ThreadHintStatusEvent {
pub thread_id: String,
pub status: ThreadHintStatus,
pub occurred_at_ms: u64,
}
#[derive(Serialize)]
pub(crate) struct ThreadHintStatusEventRequest {
pub(crate) event_type: &'static str,
pub(crate) event_params: ThreadHintStatusEventParams,
}
#[derive(Serialize)]
pub(crate) struct ThreadHintStatusEventParams {
pub(crate) thread_id: String,
pub(crate) session_id: String,
pub(crate) app_server_client: CodexAppServerClientMetadata,
pub(crate) runtime: CodexRuntimeMetadata,
pub(crate) thread_source: Option<ThreadSource>,
pub(crate) subagent_source: Option<String>,
pub(crate) parent_thread_id: Option<String>,
pub(crate) status: ThreadHintStatus,
pub(crate) occurred_at_ms: u64,
}