mirror of
https://github.com/openai/codex.git
synced 2026-09-10 20:26:47 +00:00
Improve MCP server startup error logging (#42370)
## What changed - Log failed MCP server startup outcomes once per startup attempt, including failures during discovery that do not emit startup notifications. - Preserve the full error chain when converting startup failures into cloneable outcome errors. GitOrigin-RevId: 54bbf2abaf3329d9828b2d2bc5d877fddc2917e1
This commit is contained in:
@@ -362,7 +362,7 @@ impl ManagedClientStartup {
|
||||
}
|
||||
};
|
||||
start_server_task(
|
||||
server_name,
|
||||
server_name.clone(),
|
||||
client,
|
||||
StartServerTaskParams {
|
||||
is_codex_apps_mcp_server,
|
||||
@@ -385,6 +385,10 @@ impl ManagedClientStartup {
|
||||
Ok(result) => result,
|
||||
Err(CancelErr::Cancelled) => Err(StartupOutcomeError::Cancelled),
|
||||
};
|
||||
// Log once per startup attempt, including discovery without startup notifications.
|
||||
if let Err(StartupOutcomeError::Failed { error, .. }) = &outcome {
|
||||
warn!(server_name, %error, "MCP server startup failed");
|
||||
}
|
||||
if outcome.is_ok()
|
||||
&& let Some(refresh_start) = refresh_start
|
||||
{
|
||||
@@ -618,7 +622,7 @@ impl From<anyhow::Error> for StartupOutcomeError {
|
||||
fn from(error: anyhow::Error) -> Self {
|
||||
let is_authentication_required = is_authentication_required_error(&error);
|
||||
Self::Failed {
|
||||
error: error.to_string(),
|
||||
error: format!("{error:#}"),
|
||||
is_authentication_required,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user