Skip to content

core: reuse parent shell snapshot for thread-spawn subagents#13052

Open
daveaitel-openai wants to merge 1 commit intomainfrom
exp/parent-shell-snapshot-reuse
Open

core: reuse parent shell snapshot for thread-spawn subagents#13052
daveaitel-openai wants to merge 1 commit intomainfrom
exp/parent-shell-snapshot-reuse

Conversation

@daveaitel-openai
Copy link
Contributor

@daveaitel-openai daveaitel-openai commented Feb 27, 2026

Summary

  • reuse the parent shell snapshot when spawning/forking/resuming SessionSource::SubAgent(SubAgentSource::ThreadSpawn { .. }) sessions
  • plumb inherited snapshot through AgentControl -> ThreadManager -> Codex::spawn -> SessionConfiguration
  • skip shell snapshot refresh on cwd updates for thread-spawn subagents so inherited snapshots are not replaced

Why

  • avoids per-subagent shell snapshot creation and cleanup work
  • keeps thread-spawn subagents on the parent snapshot path, matching the intended parent/child snapshot model

Validation

  • just fmt (in codex-rs)
  • cargo test -p codex-core --no-run
  • cargo test -p codex-core spawn_agent -- --nocapture
  • cargo test -p codex-core --test all suite::agent_jobs::spawn_agents_on_csv_runs_and_exports

Notes

  • full cargo test -p codex-core --test all was left running separately for broader verification

Pass the parent session's shell snapshot into spawned/resumed/forked thread-spawn subagents so they bootstrap from inherited shell state instead of creating a fresh snapshot.

Also skip shell snapshot refresh on cwd changes for thread-spawn subagents, so inherited snapshots are not replaced during child-session updates.

Co-authored-by: Codex <noreply@openai.com>
@daveaitel-openai daveaitel-openai enabled auto-merge (squash) February 27, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant