core: remove redundant TurnContext and Prompt fields#28638
Merged
Conversation
sayan-oai
approved these changes
Jun 17, 2026
pakrym-oai
force-pushed
the
pakrym/remove-turn-context-duplicates
branch
from
June 17, 2026 02:25
e0b7404 to
5c6bcbb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
TurnContexthad accumulated dead fields and cached projections of values already owned by its per-turnConfigorModelInfo. Keeping both copies made ownership unclear and allowed artificial split-brain states, such as a compatibility hash differing from the model metadata it came from.Promptsimilarly carried a write-only personality after personality selection had already been materialized into its base instructions.This makes the canonical owner explicit: configuration-backed values come from
config, model-derived values come frommodel_info, and prompts contain only data consumed by request construction.What changed
ghost_snapshot,codex_self_exe, andthread_sourcefields.comp_hash,truncation_policy,features,shell_environment_policy,codex_linux_sandbox_exe,compact_prompt, andtool_modefields.TurnContext::configorTurnContext::model_infoat their consumers.Prompt::personalityfield and its constructor assignments.Testing
cargo check -p codex-core --tests