Skip to content

[codex] Remove unused TurnContextItem fields#22709

Open
pakrym-oai wants to merge 4 commits into
mainfrom
pakrym/file-system-sandbox-context-explicit-cwd
Open

[codex] Remove unused TurnContextItem fields#22709
pakrym-oai wants to merge 4 commits into
mainfrom
pakrym/file-system-sandbox-context-explicit-cwd

Conversation

@pakrym-oai
Copy link
Copy Markdown
Collaborator

Why

TurnContextItem is the durable baseline used to reconstruct context diffs across resume/fork. Several fields persisted on it were no longer read from the persisted item: trace ids, reasoning summary, user/developer instructions, output schema, and truncation policy. Keeping them in rollout snapshots adds schema surface and state that can drift without affecting reconstruction.

What changed

  • Removed the unused persisted fields from TurnContextItem.
  • Stopped writing those fields from TurnContext::to_turn_context_item.
  • Updated rollout/context reconstruction fixtures and the trace-id unit test to assert the live TurnContext trace id instead of carrying it through TurnContextItem.

Verification

  • cargo test -p codex-protocol --lib turn_context_item
  • cargo test -p codex-core --lib new_default_turn_captures_current_span_trace_id
  • cargo test -p codex-core --lib record_initial_history_resumed_turn_context_after_compaction_reestablishes_reference_context_item
  • cargo test -p codex-rollout resume_candidate_matches_cwd_reads_latest_turn_context
  • cargo test -p codex-state turn_context
  • git diff --check

@pakrym-oai pakrym-oai marked this pull request as ready for review May 14, 2026 21:57
@pakrym-oai pakrym-oai requested a review from a team as a code owner May 14, 2026 21:57
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

Here are some automated review suggestions for this pull request.

Reviewed commit: e723214081

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@@ -382,11 +381,6 @@ impl TurnContext {
collaboration_mode: Some(self.collaboration_mode.clone()),
realtime_active: Some(self.realtime_active),
effort: self.reasoning_effort,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Keep new rollout turn_context lines readable by older builds

When a user creates turns with this version and then opens/resumes/forks the same rollout with the currently released older binary, the older TurnContextItem still requires summary, so RolloutRecorder::load_rollout_items fails to deserialize and skips each new turn_context line. That drops the persisted previous-turn settings/reference context baseline used for resume/fork reconstruction, so model/realtime/context diffs are rebuilt as if no baseline existed; if rollout compatibility across versions is expected, keep serializing at least the default summary until older readers make it optional.

Useful? React with 👍 / 👎.

@@ -2805,8 +2805,6 @@ pub struct TurnContextNetworkItem {
pub struct TurnContextItem {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Update the remaining suite TurnContextItem constructor

This struct shape change leaves core/tests/suite/resume_warning.rs:28 constructing TurnContextItem with the removed trace_id, summary, user_instructions, developer_instructions, final_output_json_schema, and truncation_policy fields. Building the core integration suite now fails with unknown-field errors for that test target, so the removed fields need to be deleted there as well.

Useful? React with 👍 / 👎.

@github-actions
Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 2 committers have signed the CLA.
✅ (pakrym-oai)[https://github.com/pakrym-oai]
@alexburch-oai
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

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.

3 participants