mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Reuse MCP handlers across sampling steps (#37273)
## Why MCP tool handlers and their Code Mode definitions are immutable for the lifetime of a stable MCP binding, so rebuilding them for every sampling step repeats schema construction unnecessarily. ## What changed - Cache MCP handlers per session and reuse them while the same binding remains active, invalidating the cache when the binding changes. - Lazily cache schema-free Code Mode definitions on MCP handlers while continuing to rebuild definitions for step-local tools whose specifications may change. - Reapply current app enablement, tool policy, exposure, and plugin schema budgets whenever cached handlers are registered for a step. ## Testing - Cover handler and Code Mode definition reuse, binding invalidation, changing app policy, stable continuation schemas, and step-local custom tool updates. GitOrigin-RevId: 69c5011fb97c08580ac476e7fb2286b1e92e0359
This commit is contained in:
1 parent
bfb6a6ea22
commit
e1831db7c3
13 files changed
+439
-85
No files matched your search
@@ -1115,6 +1115,7 @@ impl Session {
|
||||
// Start with an empty connection set. The initialized set is
|
||||
// published after SessionConfigured so MCP events follow it.
|
||||
mcp_runtime,
|
||||
mcp_handler_cache: Default::default(),
|
||||
unified_exec_manager: UnifiedExecProcessManager::new(
|
||||
config.background_terminal_max_timeout,
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user