Skip to content

feat(app-server): experimental flag to persist extended history#11227

Merged
owenlin0 merged 2 commits into
mainfrom
owen/persist_full_history
Feb 12, 2026
Merged

feat(app-server): experimental flag to persist extended history#11227
owenlin0 merged 2 commits into
mainfrom
owen/persist_full_history

Conversation

@owenlin0

@owenlin0 owenlin0 commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator

This PR adds an experimental persist_extended_history bool flag to app-server thread APIs so rollout logs can retain a richer set of EventMsgs for non-lossy Thread > Turn > ThreadItems reconstruction (i.e. on thread/resume).

Motivation

Today, our rollout recorder only persists a small subset (e.g. user message, reasoning, assistant message) of EventMsg types, dropping a good number (like command exec, file change, etc.) that are important for reconstructing full item history for thread/resume, thread/read, and thread/fork.

Some clients want to be able to resume a thread without lossiness. This lossiness is primarily a UI thing, since what the model sees are ResponseItem and not EventMsg.

Approach

This change introduces an opt-in persist_full_history flag to preserve those events when you start/resume/fork a thread (defaults to false).

This is done by adding an EventPersistenceMode to the rollout recorder:

  • Limited (existing behavior, default)
  • Extended (new opt-in behavior)

In Extended mode, persist additional EventMsg variants needed for non-lossy app-server ThreadItem reconstruction. We now store the following ThreadItems that we didn't before:

  • web search
  • command execution
  • patch/file changes
  • MCP tool calls
  • image view calls
  • collab tool outcomes
  • context compaction
  • review mode enter/exit

For command executions in particular, we truncate the output using the existing truncate_text from core to store an upper bound of 10,000 bytes, which is also the default value for truncating tool outputs shown to the model. This keeps the size of the rollout file and command execution items returned over the wire reasonable.

And we also persist EventMsg::Error which we can now map back to the Turn's status and populates the Turn's error metadata.

Updates to EventMsgs

To truly make thread/resume non-lossy, we also needed to persist the status on EventMsg::CommandExecutionEndEvent and EventMsg::PatchApplyEndEvent. Previously it was not obvious whether a command failed or was declined (similar for apply_patch). These EventMsgs were never persisted before so I made it a required field.

@owenlin0 owenlin0 force-pushed the owen/persist_full_history branch 2 times, most recently from 1fc7780 to 5b1e1c1 Compare February 10, 2026 20:53
@owenlin0 owenlin0 marked this pull request as ready for review February 10, 2026 21:34
@owenlin0

Copy link
Copy Markdown
Collaborator 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: 7e242eb1fe

ℹ️ 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/app-server-protocol/src/protocol/thread_history.rs
Comment thread codex-rs/core/src/rollout/policy.rs Outdated
@owenlin0

Copy link
Copy Markdown
Collaborator 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: 792262b0b7

ℹ️ 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/app-server-protocol/src/protocol/thread_history.rs
Comment thread codex-rs/app-server-protocol/src/protocol/thread_history.rs Outdated
@owenlin0

Copy link
Copy Markdown
Collaborator 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: 7f8a9dde16

ℹ️ 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/app-server-protocol/src/protocol/thread_history.rs
Comment thread codex-rs/app-server-protocol/src/protocol/thread_history.rs Outdated
@owenlin0 owenlin0 force-pushed the owen/persist_full_history branch 3 times, most recently from 6243cfb to a6208e8 Compare February 11, 2026 18:07
@owenlin0

Copy link
Copy Markdown
Collaborator Author

@codex review

@owenlin0 owenlin0 requested a review from celia-oai February 11, 2026 18:35

@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: 3c1eea654a

ℹ️ 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/app-server-protocol/src/protocol/thread_history.rs Outdated
Comment thread codex-rs/app-server-protocol/src/protocol/thread_history.rs Outdated
@owenlin0 owenlin0 force-pushed the owen/persist_full_history branch 2 times, most recently from f0ab0e8 to b987497 Compare February 11, 2026 19:33
@owenlin0

Copy link
Copy Markdown
Collaborator 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: b987497096

ℹ️ 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/app-server-protocol/src/protocol/thread_history.rs
Comment thread codex-rs/core/src/tools/events.rs
@owenlin0 owenlin0 force-pushed the owen/persist_full_history branch 2 times, most recently from 0fcdb76 to 4f6b90a Compare February 11, 2026 20:02
@owenlin0

Copy link
Copy Markdown
Collaborator Author

@codex review

@owenlin0 owenlin0 force-pushed the owen/persist_full_history branch from 783d384 to 21db6ac Compare February 11, 2026 20:23

@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: 783d38409f

ℹ️ 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/tools/events.rs
@owenlin0 owenlin0 force-pushed the owen/persist_full_history branch from 206e215 to a419a13 Compare February 11, 2026 21:19
@owenlin0 owenlin0 changed the title feat(app-server): experimental flag to persist full history feat(app-server): experimental flag to persist extended history Feb 11, 2026
@owenlin0 owenlin0 force-pushed the owen/persist_full_history branch from a419a13 to 2a39cf5 Compare February 11, 2026 21:33

@celia-oai celia-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.

what happens when a user try to resume a session without extended history? Shall we throw some warning? similar with user try to resume a session with extended history but flag off. mostly curious about the mismatch between persistence & resume

Comment thread codex-rs/app-server-protocol/src/protocol/thread_history.rs
Comment thread codex-rs/app-server-protocol/src/protocol/thread_history.rs
Comment thread codex-rs/app-server/README.md Outdated
Comment thread codex-rs/core/src/rollout/recorder.rs
RolloutCmd::AddItems(items) => {
let mut persisted_items = Vec::new();
for item in items {
if is_persisted_response_item(&item) {

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.

why is this one changed?

@owenlin0 owenlin0 Feb 12, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it happens earlier in record_items() at line 474, so by the time we get here it's already filtered

Comment thread codex-rs/core/src/tools/events.rs
Comment thread codex-rs/protocol/src/protocol.rs
@owenlin0 owenlin0 force-pushed the owen/persist_full_history branch from 2a39cf5 to c7415c4 Compare February 12, 2026 18:47
@owenlin0 owenlin0 force-pushed the owen/persist_full_history branch from c7415c4 to 32eef61 Compare February 12, 2026 18:51
@owenlin0

owenlin0 commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator Author

what happens when a user try to resume a session without extended history? Shall we throw some warning? similar with user try to resume a session with extended history but flag off. mostly curious about the mismatch between persistence & resume

@celia-oai I don't think we should throw a warning, we'll just return what we have stored on disk. the client needs to be able to handle the full set of items anyway (when streaming), so client-rendering should be compatible with either limited or extended persistence modes.

@celia-oai

Copy link
Copy Markdown
Collaborator

what happens when a user try to resume a session without extended history? Shall we throw some warning? similar with user try to resume a session with extended history but flag off. mostly curious about the mismatch between persistence & resume

@celia-oai I don't think we should throw a warning, we'll just return what we have stored on disk. the client needs to be able to handle the full set of items anyway (when streaming), so client-rendering should be compatible with either limited or extended persistence modes.

sg!

@owenlin0 owenlin0 enabled auto-merge (squash) February 12, 2026 19:19
@owenlin0 owenlin0 merged commit efc8d45 into main Feb 12, 2026
53 of 55 checks passed
@owenlin0 owenlin0 deleted the owen/persist_full_history branch February 12, 2026 19:34
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 12, 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