Skip to content

core: remove redundant TurnContext and Prompt fields#28638

Merged
pakrym-oai merged 7 commits into
mainfrom
pakrym/remove-turn-context-duplicates
Jun 17, 2026
Merged

core: remove redundant TurnContext and Prompt fields#28638
pakrym-oai merged 7 commits into
mainfrom
pakrym/remove-turn-context-duplicates

Conversation

@pakrym-oai

@pakrym-oai pakrym-oai commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Why

TurnContext had accumulated dead fields and cached projections of values already owned by its per-turn Config or ModelInfo. 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.

Prompt similarly 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 from model_info, and prompts contain only data consumed by request construction.

What changed

  • Remove the unused ghost_snapshot, codex_self_exe, and thread_source fields.
  • Remove duplicate comp_hash, truncation_policy, features, shell_environment_policy, codex_linux_sandbox_exe, compact_prompt, and tool_mode fields.
  • Read those values directly from TurnContext::config or TurnContext::model_info at their consumers.
  • Remove the write-only Prompt::personality field and its constructor assignments.
  • Preserve review-turn inheritance of the parent turn's shell policy, Linux sandbox executable, and compact prompt through the review config.

Testing

  • cargo check -p codex-core --tests

@pakrym-oai
pakrym-oai requested a review from a team as a code owner June 17, 2026 01:43
@pakrym-oai pakrym-oai changed the title core: remove redundant TurnContext fields core: remove redundant TurnContext and Prompt fields Jun 17, 2026
@pakrym-oai
pakrym-oai force-pushed the pakrym/remove-turn-context-duplicates branch from e0b7404 to 5c6bcbb Compare June 17, 2026 02:25
@pakrym-oai
pakrym-oai merged commit 172b221 into main Jun 17, 2026
31 checks passed
@pakrym-oai
pakrym-oai deleted the pakrym/remove-turn-context-duplicates branch June 17, 2026 05:17
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 17, 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.

2 participants