mirror of
https://github.com/openai/codex.git
synced 2026-12-05 01:00:54 +00:00
## Why Several invalidations can be handled by a single MCP runtime refresh. Recording the reasons together shows which changes prompted that refresh. ## What changed When `mcp_refresh_reason_telemetry` is enabled, successful MCP runtime refreshes report a `codex_mcp_runtime_refresh_event` with distinct reason labels, a timestamp, and thread and session attribution. The flag is off by default. Multiple installed-plugin metadata changes collapse to one `installed_plugin_metadata` label. The event omits configuration contents and plugin change IDs. Analytics buffers refresh events that arrive before their thread context is available. ## Testing Add an integration test that queues multiple invalidations and verifies that one event with deduplicated reasons and the correct thread and session IDs is sent after thread start is recorded. GitOrigin-RevId: 639326d0cb993b8b3a0fcbf0618049cb2ff065fd
33 lines
1.0 KiB
Rust
33 lines
1.0 KiB
Rust
//! MCP runtime publication analytics without configuration contents.
|
|
|
|
use crate::events::CodexAppServerClientMetadata;
|
|
use crate::events::CodexRuntimeMetadata;
|
|
use codex_protocol::protocol::ThreadSource;
|
|
use serde::Serialize;
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct McpRuntimeRefreshEvent {
|
|
pub thread_id: String,
|
|
pub reasons: Vec<String>,
|
|
pub occurred_at_ms: u64,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub(crate) struct McpRuntimeRefreshEventRequest {
|
|
pub(crate) event_type: &'static str,
|
|
pub(crate) event_params: McpRuntimeRefreshEventParams,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub(crate) struct McpRuntimeRefreshEventParams {
|
|
pub(crate) thread_id: String,
|
|
pub(crate) session_id: String,
|
|
pub(crate) app_server_client: CodexAppServerClientMetadata,
|
|
pub(crate) runtime: CodexRuntimeMetadata,
|
|
pub(crate) reasons: Vec<String>,
|
|
pub(crate) occurred_at_ms: u64,
|
|
pub(crate) thread_source: Option<ThreadSource>,
|
|
pub(crate) subagent_source: Option<String>,
|
|
pub(crate) parent_thread_id: Option<String>,
|
|
}
|