mirror of
https://github.com/openai/codex.git
synced 2026-11-17 14:58:36 +00:00
Expose session sources to MCP contributors (#37167)
## What changed - Add `session_source()` to `McpServerContributionContext` for thread-scoped MCP resolution. - Propagate each thread's `SessionSource` through initial setup, per-step resolution, and runtime refreshes. ## Testing - Verify global contexts omit the source while thread-scoped contexts retain it. - Verify MCP contributors observe distinct sources for a root thread and its spawned subagent. GitOrigin-RevId: 23da1509858e023fbd9e2d179034ddc83553f17b
This commit is contained in:
1 parent
ad6e48ddd3
commit
15ea598c6e
9 files changed
+239
-24
No files matched your search
@@ -26,6 +26,7 @@ use codex_mcp::configured_mcp_servers;
|
||||
use codex_mcp::effective_mcp_servers;
|
||||
use codex_plugin::AppConnectorId;
|
||||
use codex_protocol::capabilities::SelectedCapabilityRoot;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
|
||||
const LEGACY_CODEX_APPS_REGISTRATION_ID: &str = "legacy_codex_apps";
|
||||
|
||||
@@ -36,6 +37,11 @@ pub(crate) struct McpRuntimeProjection {
|
||||
pub(crate) plugins_available: bool,
|
||||
}
|
||||
|
||||
pub(crate) struct McpThreadIdentity<'a> {
|
||||
pub(crate) session_source: &'a SessionSource,
|
||||
pub(crate) originator: &'a str,
|
||||
}
|
||||
|
||||
enum OrderedMcpOverlay {
|
||||
Set {
|
||||
contributor_id: &'static str,
|
||||
@@ -109,7 +115,7 @@ impl McpManager {
|
||||
config: &Config,
|
||||
thread_init: &ExtensionDataInit,
|
||||
thread_store: &ExtensionData,
|
||||
originator: &str,
|
||||
identity: McpThreadIdentity<'_>,
|
||||
ready_selected_capability_roots: &[SelectedCapabilityRoot],
|
||||
executor_capability_discovery: Option<&ExecutorCapabilityDiscoverySnapshot>,
|
||||
) -> McpRuntimeProjection {
|
||||
@@ -118,11 +124,12 @@ impl McpManager {
|
||||
config,
|
||||
thread_init,
|
||||
thread_store,
|
||||
originator,
|
||||
identity.originator,
|
||||
ready_selected_capability_roots,
|
||||
executor_capability_discovery,
|
||||
),
|
||||
Some(originator),
|
||||
)
|
||||
.with_session_source(identity.session_source),
|
||||
Some(identity.originator),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user