Skip to content

[codex] Use compaction_trigger item for remote compaction v2#22809

Merged
jif-oai merged 1 commit into
mainfrom
codex/remote-compaction-trigger
May 15, 2026
Merged

[codex] Use compaction_trigger item for remote compaction v2#22809
jif-oai merged 1 commit into
mainfrom
codex/remote-compaction-trigger

Conversation

@jif-oai

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

Copy link
Copy Markdown
Collaborator

Why

Remote compaction v2 was still using context_compaction as both the request trigger and the compacted output shape. The Responses API now has the landed contract for this flow: Codex sends a dedicated { "type": "compaction_trigger" } input item, and the backend returns the standard compaction output item with encrypted content.

This aligns the v2 path with that wire contract while preserving the existing local compacted-history post-processing behavior.

What changed

  • Add ResponseItem::CompactionTrigger and regenerate the app-server protocol schema fixtures.
  • Send compaction_trigger from remote_compaction_v2 instead of a payload-less context_compaction.
  • Collect exactly one backend compaction output item, then reuse the existing compacted-history rebuilding path.
  • Treat the trigger item as a transient request marker rather than model output or persisted rollout/memory content.

Verification

  • cargo test -p codex-protocol compaction_trigger
  • cargo test -p codex-core remote_compact_v2
  • cargo test -p codex-core compact_remote_v2
  • cargo test -p codex-core responses_websocket_sends_response_processed_after_remote_compaction_v2
  • just write-app-server-schema
  • cargo test -p codex-app-server-protocol schema_fixtures

@jif-oai jif-oai marked this pull request as ready for review May 15, 2026 09:23
@jif-oai jif-oai requested a review from a team as a code owner May 15, 2026 09:23
@jif-oai

jif-oai commented May 15, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Nice work!

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

@jif-oai jif-oai changed the title [codex] Use compaction_trigger for remote compaction v2 [codex] Use compaction_trigger item for remote compaction v2 May 15, 2026
@jif-oai jif-oai merged commit 0322ac3 into main May 15, 2026
31 checks passed
@jif-oai jif-oai deleted the codex/remote-compaction-trigger branch May 15, 2026 09:40
@github-actions github-actions Bot locked and limited conversation to collaborators May 15, 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.

1 participant