Skip to content

Make forked agent spawns keep parent model config#17247

Merged
friel-openai merged 2 commits intomainfrom
dev/friel/fork-config-inheritance
Apr 13, 2026
Merged

Make forked agent spawns keep parent model config#17247
friel-openai merged 2 commits intomainfrom
dev/friel/fork-config-inheritance

Conversation

@friel-openai
Copy link
Copy Markdown
Contributor

@friel-openai friel-openai commented Apr 9, 2026

Summary

When a spawn_agent call does a full-history fork, keep the parent's effective agent type and model configuration instead of applying child role/model overrides.

This is the minimal config-inheritance slice of #16055. Prompt-cache key inheritance and MCP tool-surface stability are split into follow-up PRs.

Design

  • Reject agent_type, model, and reasoning_effort for v1 fork_context spawns.
  • Reject agent_type, model, and reasoning_effort for v2 fork_turns = "all" spawns.
  • Keep v2 partial-history forks (fork_turns = "N") configurable; requested model/reasoning overrides and role config still apply there.
  • Keep non-forked spawn behavior unchanged.

Tests

  • cargo +1.93.1 test -p codex-core spawn_agent_fork_context --lib
  • cargo +1.93.1 test -p codex-core multi_agent_v2_spawn_fork_turns --lib
  • cargo +1.93.1 test -p codex-core multi_agent_v2_spawn_partial_fork_turns_allows_agent_type_override --lib

Ok(config)
}

pub(crate) fn reject_forked_spawn_model_overrides(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for agent_type

apply_role_to_config(&mut config, role_name)
.await
.map_err(FunctionCallError::RespondToModel)?;
if fork_mode.is_some() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only if fork_mode is "all"

@friel-openai friel-openai force-pushed the dev/friel/fork-config-inheritance branch from d9a1aa4 to a7f099a Compare April 10, 2026 16:43
@friel-openai friel-openai marked this pull request as ready for review April 13, 2026 15:07
@friel-openai friel-openai enabled auto-merge (squash) April 13, 2026 15:08
@friel-openai friel-openai merged commit 776246c into main Apr 13, 2026
26 of 30 checks passed
@friel-openai friel-openai deleted the dev/friel/fork-config-inheritance branch April 13, 2026 15:28
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants