Skip to content

feat: add remote compaction v2 Responses client path#20773

Merged
jif-oai merged 5 commits into
mainfrom
jif/remote-compaction-v2
May 4, 2026
Merged

feat: add remote compaction v2 Responses client path#20773
jif-oai merged 5 commits into
mainfrom
jif/remote-compaction-v2

Conversation

@jif-oai

@jif-oai jif-oai commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Why

This adds the remote_compaction_v2 client path so remote compaction can run through the normal Responses stream and install a context_compaction item that trigger a compaction.

The goal is to migrate some of the compaction logic on the client side

We keeps the v2 transport behind a feature flag while letting follow-up requests reuse the compacted context instead of falling back to the legacy compaction item shape.

What changed

  • add ResponseItem::ContextCompaction and refresh the generated app-server / schema / TypeScript fixtures that expose response items on the wire
  • add core/src/compact_remote_v2.rs to send compaction through the standard streamed Responses client, require exactly one context_compaction output item, and install that item into compacted history
  • route manual compact and auto-compaction through the v2 path when remote_compaction_v2 is enabled, while keeping the existing remote compaction path as the fallback
  • preserve the new item type across history retention, follow-up request construction, telemetry, rollout persistence, and rollout-trace normalization
  • add targeted coverage for the feature flag, context_compaction serialization, rollout-trace normalization, and remote-compaction follow-up behavior

Verification

  • added protocol tests for context_compaction serialization/deserialization in protocol/src/models.rs
  • added rollout-trace coverage for context_compaction normalization in rollout-trace/src/reducer/conversation_tests.rs
  • added remote compaction integration coverage for v2 follow-up reuse and mixed compaction output streams in core/tests/suite/compact_remote.rs

Co-authored-by: Codex <noreply@openai.com>
@jif-oai jif-oai requested a review from a team as a code owner May 2, 2026 10:30

@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: 68fbdc27a5

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

Comment thread codex-rs/core/src/compact_remote_v2.rs Outdated
jif-oai and others added 3 commits May 2, 2026 12:05
Fix the compact_remote_v2 lint issues and refresh generated schema fixtures.

Co-authored-by: Codex <noreply@openai.com>
@jif-oai jif-oai changed the title feat: implement remote compaction v2 client path feat: add remote compaction v2 Responses client path May 4, 2026
Co-authored-by: Codex <noreply@openai.com>
Comment thread codex-rs/core/src/compact_remote_v2.rs

@aibrahim-oai aibrahim-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we parametrize all compaction logic to run as v2 as well to not lose coverage in the future?

@jif-oai jif-oai merged commit d927f61 into main May 4, 2026
26 checks passed
@jif-oai jif-oai deleted the jif/remote-compaction-v2 branch May 4, 2026 12:15
@github-actions github-actions Bot locked and limited conversation to collaborators May 4, 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