mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
Report per-server MCP startup durations (#63613)
## Why Required MCP servers can finish at different times even when their startup notifications arrive together. Notification arrival times cannot show how long each server took to start. ## What changed Measure each startup attempt and expose its elapsed milliseconds as `durationMs` on `ready` and `failed` updates from `mcpServer/startupStatus/updated`. Successful Codex Apps reconnects report their own duration. Reused connections, `starting`, and `cancelled` updates carry `null`. The protocol accepts notifications from older servers that omit the field. ## Testing Cover distinct durations for fast and slow required servers, timing through lease registration for newly opened shared connections, and a fresh duration after Codex Apps recovery. GitOrigin-RevId: 39c0c418149dd2b220828be04d998085f57acf2d
This commit is contained in:
committed by
copyberry
parent
32119bac26
commit
abc92e6bd4
@@ -808,6 +808,7 @@ async fn guardian_cleanup_drops_stale_reviews_and_restores_mcp_status() {
|
||||
thread_id: None,
|
||||
name: "alpha".to_string(),
|
||||
status: McpServerStartupState::Starting,
|
||||
duration_ms: None,
|
||||
error: None,
|
||||
failure_reason: None,
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ fn notify_mcp_status(chat: &mut ChatWidget, name: &str, status: McpServerStartup
|
||||
thread_id: Some("thread-1".to_string()),
|
||||
name: name.to_string(),
|
||||
status,
|
||||
duration_ms: None,
|
||||
error: None,
|
||||
failure_reason: None,
|
||||
}),
|
||||
@@ -23,6 +24,7 @@ fn notify_mcp_status_error(chat: &mut ChatWidget, name: &str, error: &str) {
|
||||
thread_id: Some("thread-1".to_string()),
|
||||
name: name.to_string(),
|
||||
status: McpServerStartupState::Failed,
|
||||
duration_ms: None,
|
||||
error: Some(error.to_string()),
|
||||
failure_reason: None,
|
||||
}),
|
||||
@@ -54,6 +56,7 @@ async fn mcp_startup_ignores_status_for_other_thread() {
|
||||
thread_id: Some(child_thread_id.to_string()),
|
||||
name: "sentry".to_string(),
|
||||
status,
|
||||
duration_ms: None,
|
||||
error: matches!(status, McpServerStartupState::Failed)
|
||||
.then(|| "sentry is not logged in".to_string()),
|
||||
failure_reason: None,
|
||||
@@ -85,6 +88,7 @@ async fn mcp_apps_readiness_retries_an_in_flight_installed_mention_lookup() {
|
||||
thread_id: None,
|
||||
name: "codex_apps".to_string(),
|
||||
status: McpServerStartupState::Ready,
|
||||
duration_ms: None,
|
||||
error: None,
|
||||
failure_reason: None,
|
||||
});
|
||||
@@ -552,6 +556,7 @@ async fn app_server_mcp_startup_failure_renders_warning_history() {
|
||||
name: "notes".to_string(),
|
||||
environment_id: Some(environment_id.to_string()),
|
||||
status: McpServerStartupState::Starting,
|
||||
duration_ms: None,
|
||||
error: None,
|
||||
failure_reason: None,
|
||||
});
|
||||
@@ -570,6 +575,7 @@ async fn app_server_mcp_startup_failure_renders_warning_history() {
|
||||
name: "notes".to_string(),
|
||||
environment_id: Some("env-a".to_string()),
|
||||
status: McpServerStartupState::Failed,
|
||||
duration_ms: None,
|
||||
error: Some("MCP client for `notes` failed to start: handshake failed".to_string()),
|
||||
failure_reason: None,
|
||||
});
|
||||
@@ -595,6 +601,7 @@ async fn app_server_mcp_startup_failure_renders_warning_history() {
|
||||
name: "notes".to_string(),
|
||||
environment_id: Some("env-b".to_string()),
|
||||
status: McpServerStartupState::Ready,
|
||||
duration_ms: None,
|
||||
error: None,
|
||||
failure_reason: None,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user