[codex] Defer fork context injection until first turn#15699
[codex] Defer fork context injection until first turn#15699charley-oai merged 4 commits intomainfrom
Conversation
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>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/core/src/codex.rs
Lines 2203 to 2204 in 2b0b2e5
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".
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>
Summary
build_initial_contextinjectionreference_context_itemas the fork baseline until the first real turnTODO(ccunningham)for remaining nondiffable initial-context inputsWhy
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.