Skip to content

core: defer fork context injection to first turn#15442

Closed
charley-oai wants to merge 3 commits intocc/fork-startup-context-snapshotfrom
cc/remove-fork-startup-context-injection
Closed

core: defer fork context injection to first turn#15442
charley-oai wants to merge 3 commits intocc/fork-startup-context-snapshotfrom
cc/remove-fork-startup-context-injection

Conversation

@charley-oai
Copy link
Collaborator

Summary

  • stop appending initial context during fork startup
  • rely on the reconstructed fork baseline so the first real turn injects only the needed diffs
  • update forked-history tests to cover the new startup and first-turn behavior

Testing

  • cargo test -p codex-core record_initial_history_reconstructs_forked_transcript
  • cargo test -p codex-core record_initial_history_forked_preserves_previous_turn_settings_until_first_turn
  • just fix -p codex-core
  • just fmt

@charley-oai charley-oai force-pushed the cc/remove-fork-startup-context-injection branch 2 times, most recently from 0f137ef to 9e1a4a6 Compare March 22, 2026 08:17
@charley-oai charley-oai changed the base branch from cc/reference-turn-context-state to cc/fork-startup-context-snapshot March 22, 2026 08:17
@charley-oai charley-oai force-pushed the cc/remove-fork-startup-context-injection branch 3 times, most recently from b4253cc to f4a3419 Compare March 22, 2026 18:39
@charley-oai
Copy link
Collaborator Author

@codex review

Copy link
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

InitialHistory::Forked(rollout_items) => {
self.apply_rollout_reconstruction(&turn_context, &rollout_items)
.await;

P1 Badge Reinject full context when applying fork startup state

By removing fork-time build_initial_context injection, a fork that reconstructs a reference_context_item now enters first turn on the diff path only. That diff builder emits permissions/model/collab/realtime/personality/env updates, but not developer_instructions/user_instructions. If fork config or cwd changes those (e.g., different AGENTS/profile), the first request keeps stale source-thread instructions.

ℹ️ 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 charley-oai force-pushed the cc/fork-startup-context-snapshot branch from 320a845 to 7464ec0 Compare March 22, 2026 20:18
@charley-oai charley-oai force-pushed the cc/remove-fork-startup-context-injection branch from f4a3419 to c4c1e4a Compare March 22, 2026 20:21
Clear the model-visible reference baseline after fork reconstruction so the first real turn in the fork emits full initial context under the new session config.

Co-authored-by: Codex <[email protected]>
@charley-oai
Copy link
Collaborator Author

@codex review

Copy link
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

Here are some automated review suggestions for this pull request.

Reviewed commit: c4e466b8dc

ℹ️ 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".

Fork startup no longer appends extra context items, so double-fork rollout tests should compare against the exact truncated rollout instead of expecting a longer prefix.

Co-authored-by: Codex <[email protected]>
@charley-oai
Copy link
Collaborator Author

Closing this follow-up for now; we'll revisit reliable diffing later.

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