mirror of
https://github.com/openai/codex.git
synced 2026-11-29 00:00:54 +00:00
Keep host MCP and plugin configuration local with remote environments (#53990)
## Why A remote primary environment could supply its working directory and workspace roots to host plugins and MCP processes, breaking relative MCP executable resolution and applying the wrong workspace permissions. ## What changed - Build host configuration from the local environment, falling back to the session's host working directory and runtime workspace roots when no local environment is selected. Preserve explicitly empty local roots. - Use the same host configuration for MCP startup and refresh, and refresh MCP state when runtime workspace roots change. - Keep repository skill discovery paired with the primary executor's working directory and filesystem. - Box skill warmup and turn context construction futures to reduce enclosing future sizes. ## Testing Extend the MCP integration test to cover a remote primary with populated, empty, or absent local roots; relative executable resolution before and after refresh; workspace-root revocation; and remote repository skill discovery. GitOrigin-RevId: 21a73c90507b55fd94261e7bf348695ff8466a24
This commit is contained in:
@@ -646,11 +646,13 @@ async fn warm_plugins_and_skills_for_session_init(
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
let fs = turn_environments.primary_filesystem();
|
||||
let effective_skill_roots = plugin_outcome.effective_plugin_skill_roots();
|
||||
let plugin_skill_snapshots = plugins_manager.plugin_skill_snapshots_for_config(&plugins_input);
|
||||
let skills_input = skills_load_input_from_config(config.as_ref(), effective_skill_roots)
|
||||
.with_plugin_skill_snapshots(plugin_skill_snapshots);
|
||||
let (skills_input, fs) = crate::skills::skills_load_input_for_environments(
|
||||
&config,
|
||||
&plugins_manager,
|
||||
effective_skill_roots,
|
||||
turn_environments,
|
||||
);
|
||||
skills_service
|
||||
.snapshot_for_config(&skills_input, fs)
|
||||
.await
|
||||
@@ -1173,11 +1175,6 @@ impl Session {
|
||||
let mcp_originator = session_configuration.originator.clone();
|
||||
let mcp_session_source = session_configuration.session_source.clone();
|
||||
let mcp_disabled_plugin_ids = session_configuration.disabled_plugin_ids.clone();
|
||||
let mcp_runtime_cwd = environment_selections
|
||||
.first()
|
||||
.and_then(|environment| environment.cwd.to_abs_path().ok())
|
||||
.map(|cwd| cwd.to_path_buf())
|
||||
.unwrap_or_else(|| session_configuration.cwd().to_path_buf());
|
||||
let auth_and_mcp_fut = async move {
|
||||
let auth = mcp_auth.await;
|
||||
if config_for_mcp.features.plugin_recommendations_enabled() {
|
||||
@@ -1480,14 +1477,15 @@ impl Session {
|
||||
session_configuration.environments = turn_environments.selections();
|
||||
let resolved_environments = turn_environments.snapshot().await;
|
||||
let agents_md_manager = Arc::new(AgentsMdManager::new(instructions));
|
||||
let plugin_skill_warmup = warm_plugins_and_skills_for_session_init(
|
||||
// Keep discovery's future out of the large embedded startup/resume frame.
|
||||
let plugin_skill_warmup = Box::pin(warm_plugins_and_skills_for_session_init(
|
||||
Arc::clone(&config),
|
||||
Arc::clone(&plugins_manager),
|
||||
Arc::clone(&skills_service),
|
||||
&resolved_environments,
|
||||
extensions.as_ref(),
|
||||
&session_configuration.session_source,
|
||||
)
|
||||
))
|
||||
.instrument(info_span!(
|
||||
"session_init.plugin_skill_warmup",
|
||||
otel.name = "session_init.plugin_skill_warmup",
|
||||
@@ -1943,7 +1941,6 @@ impl Session {
|
||||
latest_auth,
|
||||
mcp_projection,
|
||||
&resolved_environments,
|
||||
mcp_runtime_cwd,
|
||||
)
|
||||
.await?;
|
||||
sess.start_mcp_prewarm_worker(mcp_prewarm_rx, mcp_auth_changes);
|
||||
|
||||
Reference in New Issue
Block a user