Preserve subagent capabilities independently of forked history (#52241)

## Why

Subagents should retain the spawning turn's selected skills and plugin choices whether `fork_turns` is `none` or `all`. Capability selection should not depend on copied conversation metadata.

## What changed

- Use a shared child startup path for fresh and history-forked agents, inheriting selected capability roots from the spawning environment snapshot.
- Pass the spawning turn's `disabled_plugin_ids` through both spawn handlers. When omitted, inherit the parent's current choices; explicit lists, including an empty list, override them.
- Resolve the parent before startup so inherited client MCP settings apply even when only the session source identifies the parent.
- Carry plugin choices into delegates with inherited isolation and preserve saved capability roots when resuming a child.

## Testing

Add regression coverage for executor skill listing and reading, plugin MCP registration with both history modes, plugin overrides, capability-root precedence and isolation, and restoring saved child settings after parent settings change.

GitOrigin-RevId: 2a6891a9bc6372fd2d1f30add2b5611f96b60594
This commit is contained in:
Adam Perry @ OpenAI
2026-10-08 19:21:57 +00:00
committed by copyberry
parent 137f25f643
commit 845345b1dd
13 changed files with 734 additions and 253 deletions
+2 -1
View File
@@ -113,7 +113,8 @@ pub(crate) async fn run_codex_thread_interactive(
code_mode_session_provider: parent_session.services.code_mode_service.session_provider(),
extensions,
conversation_history,
disabled_plugin_ids: None,
disabled_plugin_ids: (isolation == codex_extension_api::SessionIsolation::Inherit)
.then(|| parent_ctx.disabled_plugin_ids.clone()),
requested_history_mode: None,
fork_persistence: ForkPersistence::Copied,
session_source,