Skip to content

Preserve pending environments when spawning subagents - #49075

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/a2afed740391f88d195596cfe28e418332b60d43
Sep 28, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/a2afed740391f88d195596cfe28e418332b60d43

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Preserve pending environments when spawning subagents

Why

Spawning a subagent before an environment was ready dropped the starting environment from the child's selections. The child needs to retain that environment and receive its configuration or failure when preparation finishes.

What changed

  • Pass the spawning step's environment snapshot to children, preserving ready and starting environments and configuration ownership.
  • Propagate the original owner's first configuration result through descendants, applying each session's validation and leaving independently configured children unchanged.
  • Preserve pending configuration waits across executor retries. Later owner updates do not overwrite the child's inherited configuration.

Testing

Add regression coverage for fresh and forked subagents, readiness through turn-settings updates, failure propagation to children and grandchildren, child configuration precedence, and executor retries. Add a request snapshot showing a child using wait_for_environment before execution tools become available.

## Why

Spawning a subagent before an environment was ready dropped the starting environment from the child's selections. The child needs to retain that environment and receive its configuration or failure when preparation finishes.

## What changed

- Pass the spawning step's environment snapshot to children, preserving ready and starting environments and configuration ownership.
- Propagate the original owner's first configuration result through descendants, applying each session's validation and leaving independently configured children unchanged.
- Preserve pending configuration waits across executor retries. Later owner updates do not overwrite the child's inherited configuration.

## Testing

Add regression coverage for fresh and forked subagents, readiness through turn-settings updates, failure propagation to children and grandchildren, child configuration precedence, and executor retries. Add a request snapshot showing a child using `wait_for_environment` before execution tools become available.

GitOrigin-RevId: a2afed740391f88d195596cfe28e418332b60d43
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/a2afed740391f88d195596cfe28e418332b60d43 branch from e9debb2 to 3749d1e Compare September 28, 2026 20:42
@copyberry
copyberry Bot merged commit 3749d1e into main Sep 28, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/a2afed740391f88d195596cfe28e418332b60d43 branch September 28, 2026 20:42
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 28, 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.

1 participant