mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Enable lazy startup for stdio MCP servers by default (#62366)
## What changed Mark `mcp_lazy_stdio_startup` stable and enable it by default. When a tool catalog is already cached, Codex can expose tools from an optional stdio MCP server and defer starting the server until the first tool call. Required servers still establish a live connection at startup. ## Testing Exercise lazy startup with the default configuration in the tool-cache test and explicitly disable the feature for the eager-start control. Update the code mode and working-directory tests to proceed without waiting for an optional server when its catalog is cached. GitOrigin-RevId: a65d83fd1a4c141dba3c10e68b138539aa0a44f0
This commit is contained in:
@@ -1202,7 +1202,8 @@ async fn code_mode_excludes_mcp_servers_using_their_configured_identity() -> Res
|
||||
let mut test = base_test;
|
||||
test.codex = new_thread.thread;
|
||||
test.session_configured = new_thread.session_configured;
|
||||
wait_for_mcp_server(&test.codex, "rmcp").await?;
|
||||
// The base thread may already have warmed the catalog, so this thread can
|
||||
// expose the cached tools without starting the optional server.
|
||||
test.submit_turn("inspect the directly callable MCP tool")
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -688,19 +688,21 @@ pub(super) async fn cached_stdio_first_use_scenario() -> anyhow::Result<Vec<Valu
|
||||
&format!("Echo from {first_process}."),
|
||||
);
|
||||
|
||||
let mut eager_config = fixture.config.clone();
|
||||
eager_config
|
||||
.features
|
||||
.disable(Feature::McpLazyStdioStartup)?;
|
||||
let control = fixture
|
||||
.thread_manager
|
||||
.start_thread(StartThreadOptions::new(fixture.config.clone()))
|
||||
.start_thread(StartThreadOptions::new(eager_config))
|
||||
.await?
|
||||
.thread;
|
||||
wait_for_mcp_server(&control, SERVER_NAME).await?;
|
||||
let control_pid = wait_for_new_pid(fs.as_ref(), &pid_file, Some(&first_pid)).await?;
|
||||
control.shutdown_and_wait().await?;
|
||||
|
||||
let mut treatment = fixture.config.clone();
|
||||
treatment.features.enable(Feature::McpLazyStdioStartup)?;
|
||||
// The flag must preserve a required live connection even when the catalog is warm.
|
||||
let mut required_config = treatment.clone();
|
||||
// A required server still needs a live connection even when the catalog is warm.
|
||||
let mut required_config = fixture.config.clone();
|
||||
let mut servers = required_config.mcp_servers.get().clone();
|
||||
servers
|
||||
.get_mut(SERVER_NAME)
|
||||
@@ -741,7 +743,7 @@ pub(super) async fn cached_stdio_first_use_scenario() -> anyhow::Result<Vec<Valu
|
||||
..
|
||||
} = fixture
|
||||
.thread_manager
|
||||
.start_thread(StartThreadOptions::new(treatment))
|
||||
.start_thread(StartThreadOptions::new(fixture.config.clone()))
|
||||
.await?;
|
||||
second_thread.submit(Op::Interrupt).await?;
|
||||
|
||||
|
||||
@@ -2442,7 +2442,7 @@ async fn local_stdio_server_uses_runtime_fallback_cwd_when_config_omits_cwd() ->
|
||||
.await?;
|
||||
fixture.codex = started.thread;
|
||||
fixture.session_configured = started.session_configured;
|
||||
wait_for_mcp_server(&fixture.codex, server_name).await?;
|
||||
// The catalog is warm; the optional server starts on its first tool call.
|
||||
|
||||
// A fresh thread must still discover the primary executor's repository
|
||||
// skills; host routing must not silently replace them with local skills.
|
||||
|
||||
@@ -1806,8 +1806,8 @@ pub const FEATURES: &[FeatureSpec] = &[
|
||||
FeatureSpec {
|
||||
id: Feature::McpLazyStdioStartup,
|
||||
key: "mcp_lazy_stdio_startup",
|
||||
stage: Stage::UnderDevelopment,
|
||||
default_enabled: false,
|
||||
stage: Stage::Stable,
|
||||
default_enabled: true,
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::MultiEnvironmentMcp,
|
||||
|
||||
Reference in New Issue
Block a user