Skip to content

[codex] Defer fork context injection until first turn#15699

Merged
charley-oai merged 4 commits intomainfrom
codex/defer-fork-context-injection
Mar 25, 2026
Merged

[codex] Defer fork context injection until first turn#15699
charley-oai merged 4 commits intomainfrom
codex/defer-fork-context-injection

Conversation

@charley-oai
Copy link
Copy Markdown
Contributor

@charley-oai charley-oai commented Mar 24, 2026

Summary

  • remove the fork-startup build_initial_context injection
  • keep the reconstructed reference_context_item as the fork baseline until the first real turn
  • update fork-history tests and the request snapshot, and add a TODO(ccunningham) for remaining nondiffable initial-context inputs

Why

Fork startup was appending current-session initial context immediately after reconstructing the parent rollout, then the first real turn could emit context updates again. That duplicated model-visible context in the child rollout.

Impact

Forked sessions now behave like resume for context seeding: startup reconstructs history and preserves the prior baseline, and the first real turn handles any current-session context emission.

charley-oai and others added 2 commits March 24, 2026 16:47
Stop fork startup from appending build_initial_context and preserve the reconstructed reference_context_item as the baseline until the first real turn.

Update fork-history coverage and the request snapshot, and leave a TODO for remaining nondiffable initial context inputs.

Co-authored-by: Codex <noreply@openai.com>
Remove the stale fork-startup TODO block and attach the note to build_settings_update_items, which is where the current diff coverage gap actually lives.

Co-authored-by: Codex <noreply@openai.com>
@charley-oai charley-oai marked this pull request as ready for review March 25, 2026 00:04
@charley-oai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

self.apply_rollout_reconstruction(&turn_context, &rollout_items)
.await;

P1 Badge Inject non-diffable context on first forked turn

Fork startup now only replays parent rollout and no longer appends build_initial_context. The first child turn then uses build_settings_update_items, which currently diffs only environment/permissions/collab/realtime/personality (context_manager/updates.rs lines 196-208). If fork-time config changes developer/user instructions, memories, apps, plugins, or skills, those model-visible instructions are never emitted in the child session.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

charley-oai and others added 2 commits March 24, 2026 17:27
Update the fork hydration test to match replay semantics for EventMsg-only user turns, and update the permissions suite to expect a single new permissions message on the first forked turn now that fork startup no longer reinjects context.

Co-authored-by: Codex <noreply@openai.com>
Update the fork-thread suite to expect exact truncated rollout copies after each fork now that fork startup no longer appends extra initial context.

Co-authored-by: Codex <noreply@openai.com>
@charley-oai charley-oai merged commit d72fa2a into main Mar 25, 2026
36 checks passed
@charley-oai charley-oai deleted the codex/defer-fork-context-injection branch March 25, 2026 01:34
@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants