Skip to content

core: assign item IDs to compacted replacement history#29012

Merged
pakrym-oai merged 3 commits into
mainfrom
pakrym/always-persist-item-ids
Jun 19, 2026
Merged

core: assign item IDs to compacted replacement history#29012
pakrym-oai merged 3 commits into
mainfrom
pakrym/always-persist-item-ids

Conversation

@pakrym-oai

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

Copy link
Copy Markdown
Collaborator

Why

Remote v2 compaction can return replacement-history items without IDs. Because replacement history is installed directly, those items bypass normal history preparation and remain ID-less in later Responses requests even when the item_ids feature is enabled.

What changed

  • Pass the active TurnContext into replace_compacted_history.
  • When item_ids is enabled, assign missing IDs before installing and persisting replacement history.
  • Rebuild CompactedItem from the prepared history so live and persisted replacement histories match.
  • Add integration coverage requiring IDs on every ID-capable input item in the initial, remote v2 compaction, and post-compaction requests.

Test plan

  • just test -p codex-core response_item_ids
  • just test -p codex-core websocket_v2_test_codex_shell_chain
  • just test -p codex-core remote_compaction_parity_pre_turn_auto
  • just test -p codex-app-server thread_inject_items_adds_raw_response_items_to_thread_history

@pakrym-oai pakrym-oai requested a review from a team as a code owner June 19, 2026 01:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d1221de19

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

Comment thread codex-rs/core/src/session/mod.rs Outdated
@pakrym-oai pakrym-oai changed the title core: always persist response item IDs core: assign item IDs to compacted replacement history Jun 19, 2026
@pakrym-oai pakrym-oai merged commit 70a6aa2 into main Jun 19, 2026
46 of 47 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/always-persist-item-ids branch June 19, 2026 01:49
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 19, 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