Skip to content

[codex] Round-trip turn state through compact - #27931

Closed
aibrahim-oai wants to merge 1 commit into
codex/model-bound-http-turn-statefrom
codex/compact-turn-state
Closed

[codex] Round-trip turn state through compact#27931
aibrahim-oai wants to merge 1 commit into
codex/model-bound-http-turn-statefrom
codex/compact-turn-state

Conversation

@aibrahim-oai

@aibrahim-oai aibrahim-oai commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Carry opaque turn state through remote compaction using the active model client session.

  • inline and pre-turn compaction receive the session's current value
  • a compact response can replace the value used by subsequent sampling
  • standalone compaction uses isolated state that does not leak into user turns

Stack

  1. [codex] Make turn state replaceable #27930 — replaceable HTTP turn state
  2. [codex] Round-trip turn state through compact #27931 — compact round-trip (this PR)
  3. [codex] Send request-scoped turn state over WebSocket #27929 — WebSocket request metadata

Coverage

  • pre-turn compaction replays its returned value to sampling
  • previous-model pre-turn compaction is replaced by the current model's response
  • inline compact round-trips updates over HTTP for both compact protocols
  • standalone compact remains isolated for both compact protocols

@aibrahim-oai
aibrahim-oai force-pushed the codex/model-bound-http-turn-state branch from 09cc0ae to 5db8ef1 Compare June 12, 2026 18:44
@aibrahim-oai
aibrahim-oai force-pushed the codex/compact-turn-state branch from 1a75dcb to 7ffdd61 Compare June 12, 2026 18:44
@aibrahim-oai
aibrahim-oai force-pushed the codex/model-bound-http-turn-state branch from 5db8ef1 to c73a2b3 Compare June 12, 2026 18:51
@aibrahim-oai
aibrahim-oai force-pushed the codex/compact-turn-state branch from 7ffdd61 to 8313869 Compare June 12, 2026 18:51
@aibrahim-oai
aibrahim-oai force-pushed the codex/model-bound-http-turn-state branch from c73a2b3 to c9cf1b5 Compare June 12, 2026 19:11
@aibrahim-oai
aibrahim-oai force-pushed the codex/compact-turn-state branch 2 times, most recently from e4ab789 to 005bb27 Compare June 12, 2026 20:20
@aibrahim-oai
aibrahim-oai marked this pull request as ready for review June 12, 2026 20:55
@aibrahim-oai
aibrahim-oai requested a review from a team as a June 12, 2026 20:55
@aibrahim-oai
aibrahim-oai force-pushed the codex/model-bound-http-turn-state branch from c9cf1b5 to 748b8e1 Compare June 12, 2026 21:17
@aibrahim-oai
aibrahim-oai force-pushed the codex/compact-turn-state branch from 005bb27 to 5dd34cc Compare June 12, 2026 21:17
@aibrahim-oai
aibrahim-oai force-pushed the codex/model-bound-http-turn-state branch from 748b8e1 to b05a1ff Compare June 12, 2026 21:22
@aibrahim-oai
aibrahim-oai force-pushed the codex/compact-turn-state branch from 5dd34cc to 62b3bdd Compare June 12, 2026 21:22
@aibrahim-oai
aibrahim-oai force-pushed the codex/compact-turn-state branch from 62b3bdd to 763f6fd Compare June 12, 2026 21:33
@aibrahim-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 763f6fd922

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

&payload,
extra_headers,
compact_request_timeout,
turn_state.as_deref(),

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 Reconnect before sampling with new compact state

When remote compaction runs on a ModelClientSession that already has an open Responses websocket (for example after prewarm or a mid-turn sample), this call stores the compact response's x-codex-turn-state, but websocket_connection later reuses the existing connection and only builds/replays headers when opening a new one. The post-compact sample can therefore continue on the old route instead of using the compact state; reset or reconnect the websocket when compaction updates the turn state.

Useful? React with 👍 / 👎.

@aibrahim-oai

Copy link
Copy Markdown
Contributor Author

Closing this stack to replace it with one consolidated PR.

@aibrahim-oai

Copy link
Copy Markdown
Contributor Author

Replaced by #27996.

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.

1 participant