mirror of
https://github.com/openai/codex.git
synced 2026-11-06 20:20:34 +00:00
## Why Selected capability roots can contribute plugins, MCP servers, connectors, and skills. Discovering each contribution separately requires repeated access to the executor filesystem. ## What changed - Add the `capabilityRoots/discoverV1` exec-server RPC to scan selected roots and materialize recognized plugin manifests, configuration files, skill instructions, and skill metadata in one bounded request. - Add the opt-in `executor_capability_discovery` feature, with a thread-scoped cache and per-step snapshot shared by MCP and skill discovery. - Parse MCP, connector, and skill contributions from the materialized snapshot, including serving cached skill instructions without another filesystem read. ## Testing - Cover discovery limits, manifest precedence, root-local failures, cache reuse, plugin contributions, and parity with the existing environment skill loader. GitOrigin-RevId: f98fd2321cafb58c596db02da1f83c09d8eb375d
50 lines
1.7 KiB
Rust
50 lines
1.7 KiB
Rust
use super::*;
|
|
use codex_config::McpServerTransportConfig;
|
|
use codex_core::config::ConfigBuilder;
|
|
use codex_extension_api::ExtensionData;
|
|
use codex_extension_api::ExtensionDataInit;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[tokio::test]
|
|
async fn hosted_plugin_runtime_forwards_thread_originator() -> Result<(), Box<dyn std::error::Error>>
|
|
{
|
|
let codex_home = tempfile::tempdir()?;
|
|
let config = ConfigBuilder::default()
|
|
.codex_home(codex_home.path().to_path_buf())
|
|
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
|
.cli_overrides(vec![
|
|
("features.apps".to_string(), true.into()),
|
|
("chatgpt_base_url".to_string(), "https://chatgpt.com".into()),
|
|
])
|
|
.build()
|
|
.await?;
|
|
let thread_init = ExtensionDataInit::new();
|
|
let thread_store = ExtensionData::new("thread");
|
|
|
|
let contributions = HostedPluginRuntimeExtension
|
|
.contribute(McpServerContributionContext::for_step(
|
|
&config,
|
|
&thread_init,
|
|
&thread_store,
|
|
"codex_work_desktop",
|
|
/*ready_selected_capability_roots*/ &[],
|
|
/*executor_capability_discovery*/ None,
|
|
))
|
|
.await;
|
|
let [McpServerContribution::Set { config: server, .. }] = contributions.as_slice() else {
|
|
panic!("hosted plugin runtime should contribute one server");
|
|
};
|
|
let McpServerTransportConfig::StreamableHttp { http_headers, .. } = &server.transport else {
|
|
panic!("hosted plugin runtime should use streamable HTTP");
|
|
};
|
|
|
|
assert_eq!(
|
|
http_headers
|
|
.as_ref()
|
|
.and_then(|headers| headers.get("originator")),
|
|
Some(&"codex_work_desktop".to_string())
|
|
);
|
|
|
|
Ok(())
|
|
}
|