Skip to content

chore: extract remote compaction request attempts - #31316

Merged
celia-oai merged 2 commits into
mainfrom
codex/refactor-remote-compaction-attempts
Jul 7, 2026
Merged

chore: extract remote compaction request attempts#31316
celia-oai merged 2 commits into
mainfrom
codex/refactor-remote-compaction-attempts

Conversation

@celia-oai

@celia-oai celia-oai commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Why

This PR is a behavior-preserving refactor only. It does not add a fallback, change which model is used for compaction, or otherwise change compaction behavior. The behavioral change is implemented in the stacked follow-up, #30319.

Pre-sampling compaction deliberately uses the previous turn's context when the compaction compatibility hash changes or when switching to a model with a smaller context window. That preserves the model settings that produced the history being compacted, but the previous context is not always usable. For example, a resumed thread can still reference a model slug that has since been retired, causing compaction to fail before the currently selected model can sample.

#30319 addresses that failure mode by retrying compaction with the current turn's selected model when the backend rejects the previous-model attempt. This PR performs only that preparatory refactor.

What changed

  • Extracted one legacy /responses/compact request attempt into compact_remote_request.rs.
  • Extracted one Responses-based remote compaction request attempt into compact_remote_v2_attempt.rs.
  • Kept hooks, lifecycle events, analytics, window advancement, history processing and installation, and error behavior unchanged in the existing orchestration paths.
  • Preserved standalone Responses-based compaction's owned client-session lifetime through lifecycle completion.

Testing

  • just test -p codex-core -E 'test(remote_compact)' (22 tests)

@celia-oai
celia-oai force-pushed the codex/refactor-remote-compaction-attempts branch from 4809aa8 to 594fed1 Compare July 6, 2026 23:37
@celia-oai celia-oai changed the title [codex] Extract remote compaction request attempts chore: extract remote compaction request attempts Jul 6, 2026
@celia-oai
celia-oai force-pushed the codex/refactor-remote-compaction-attempts branch from 594fed1 to cf62e27 Compare July 7, 2026 00:24
@celia-oai
celia-oai force-pushed the codex/refactor-remote-compaction-attempts branch from ec16a25 to 1f3200a Compare July 7, 2026 06:05
@celia-oai
celia-oai marked this pull request as ready for review July 7, 2026 06:17
@celia-oai
celia-oai requested a review from a team as a code owner July 7, 2026 06:18
@celia-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

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

Reviewed commit: 1f3200acfa

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

@celia-oai
celia-oai merged commit 1f710c9 into main Jul 7, 2026
35 checks passed
@celia-oai
celia-oai deleted the codex/refactor-remote-compaction-attempts branch July 7, 2026 19:57
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants