mirror of
https://github.com/openai/codex.git
synced 2026-11-23 07:17:11 +00:00
Make the optional MCP startup grace configurable (#41199)
## What changed - Add `mcp_optional_startup_grace_ms` with a default of 1,000 ms to control how long tool catalog capture waits for optional MCP servers. - Treat a value of `0` as disabling the shared grace, so optional servers use their configured `startup_timeout_sec` instead. - Apply updated grace values during runtime and MCP configuration refreshes, and reset cached startup deadlines when the configured duration changes. ## Testing - Cover custom, disabled, refreshed, and shared startup grace behavior in MCP connection and core integration tests. GitOrigin-RevId: 936196215ed6e0a29c9ec72cfee17663978df8ef
This commit is contained in:
1 parent
035295b46e
commit
124e560b93
14 files changed
+495
-17
No files matched your search
@@ -134,6 +134,11 @@ pub struct McpConfig {
|
||||
pub mcp_oauth_callback_port: Option<u16>,
|
||||
/// Optional OAuth redirect URI override for MCP login.
|
||||
pub mcp_oauth_callback_url: Option<String>,
|
||||
/// How long a tool catalog capture waits for optional MCP servers to initialize.
|
||||
///
|
||||
/// A zero duration disables the shared grace and waits for each server's
|
||||
/// configured startup timeout instead.
|
||||
pub optional_mcp_startup_grace: Duration,
|
||||
/// Whether skill MCP dependency installation prompts are enabled.
|
||||
pub skill_mcp_dependency_install_enabled: bool,
|
||||
/// Approval policy used for MCP tool calls and MCP elicitation requests.
|
||||
@@ -175,6 +180,9 @@ pub struct McpConfig {
|
||||
pub connector_snapshot: ConnectorSnapshot,
|
||||
}
|
||||
|
||||
/// Default amount of time a tool catalog capture waits for optional MCP servers.
|
||||
pub const DEFAULT_OPTIONAL_MCP_STARTUP_GRACE: Duration = Duration::from_secs(1);
|
||||
|
||||
impl McpConfig {
|
||||
/// Resolves enabled runtime servers against the exact attachment permissions being published.
|
||||
pub fn set_server_permission_profiles(
|
||||
|
||||
@@ -27,6 +27,7 @@ pub(crate) fn test_mcp_config(codex_home: PathBuf) -> McpConfig {
|
||||
auth_keyring_backend_kind: AuthKeyringBackendKind::default(),
|
||||
mcp_oauth_callback_port: None,
|
||||
mcp_oauth_callback_url: None,
|
||||
optional_mcp_startup_grace: DEFAULT_OPTIONAL_MCP_STARTUP_GRACE,
|
||||
skill_mcp_dependency_install_enabled: true,
|
||||
approval_policy: Constrained::allow_any(AskForApproval::OnRequest),
|
||||
permission_profile: PermissionProfile::default(),
|
||||
|
||||
Reference in new issue
Block a user