Skip to content

[codex] Store compact window id in rollout - #27264

Merged
pakrym-oai merged 3 commits into
mainfrom
pakrym/compact-window-id
Jun 10, 2026
Merged

[codex] Store compact window id in rollout#27264
pakrym-oai merged 3 commits into
mainfrom
pakrym/compact-window-id

Conversation

@pakrym-oai

Copy link
Copy Markdown
Contributor

Why

Compaction window identity is part of session history, not model-client transport state. Persisting it with the compacted rollout item lets resumed threads continue from the reconstructed window without keeping mutable window state on ModelClient.

What changed

  • Added window_id to CompactedItem and stamp it when replace_compacted_history installs compacted history.
  • Moved auto-compact window id ownership into AutoCompactWindow / SessionState; ModelClient now receives the request window id from callers instead of storing it.
  • Returned window_id from rollout reconstruction for resume. Reconstruction uses the newest surviving compacted item's stored window_id when present, and falls back to the legacy compacted-item count when it is absent.
  • Kept fork startup at the fresh default window id and updated direct model-client tests to pass explicit test window ids.

Validation

  • cargo check -p codex-core --tests

@pakrym-oai
pakrym-oai marked this pull request as ready for review June 9, 2026 23:41
@pakrym-oai
pakrym-oai requested a review from a team as a code owner June 9, 2026 23:41

@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: a0435c29b1

ℹ️ 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
Comment thread codex-rs/core/src/session/mod.rs Outdated
@pakrym-oai
pakrym-oai force-pushed the pakrym/compact-window-id branch from 97d1986 to f99614b Compare June 10, 2026 13:09

@owenlin0 owenlin0 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.

nice, getting rid of state in model_client here too 👍

@pakrym-oai
pakrym-oai merged commit 30ddb33 into main Jun 10, 2026
31 checks passed
@pakrym-oai
pakrym-oai deleted the pakrym/compact-window-id branch June 10, 2026 15:47
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 10, 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