Skip to content

Overlap subagent spawn persistence and clean up cancelled children - #47348

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

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

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Overlap subagent spawn persistence and clean up cancelled children

Why

Forked subagent startup serializes history persistence and spawn-edge writes. Cancellation during startup can also leave a provisional child behind.

What changed

  • Defer copied-history durability so it can run alongside spawn-edge persistence, while still awaiting both before submitting the child's initial input.
  • Commit agent and residency reservations and notify clients only after initial input is accepted.
  • Guard provisional children so cancellation or startup failure removes and shuts them down, discards their stored state, and closes their spawn edge after any pending edge write finishes.

Testing

Add coverage for cancellation at the child-history durability barrier, checking child termination, removal, and edge closure. Extend fork-context tests in legacy and paginated history modes to verify inherited context can be read from storage after spawn acknowledgment without flushing the live child first.

…47348)

## Why

Forked subagent startup serializes history persistence and spawn-edge writes. Cancellation during startup can also leave a provisional child behind.

## What changed

- Defer copied-history durability so it can run alongside spawn-edge persistence, while still awaiting both before submitting the child's initial input.
- Commit agent and residency reservations and notify clients only after initial input is accepted.
- Guard provisional children so cancellation or startup failure removes and shuts them down, discards their stored state, and closes their spawn edge after any pending edge write finishes.

## Testing

Add coverage for cancellation at the child-history durability barrier, checking child termination, removal, and edge closure. Extend fork-context tests in legacy and paginated history modes to verify inherited context can be read from storage after spawn acknowledgment without flushing the live child first.

GitOrigin-RevId: e02dda57efc32b7237bb7af0ce5e5844922890c3
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/e02dda57efc32b7237bb7af0ce5e5844922890c3 branch from b014a11 to 5121aef Compare September 22, 2026 19:39
@copyberry
copyberry Bot merged commit 5121aef into main Sep 22, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/e02dda57efc32b7237bb7af0ce5e5844922890c3 branch September 22, 2026 19:39
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 22, 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