Skip to content

Share resumed rollout history - #28426

Merged
charliemarsh-oai merged 3 commits into
mainfrom
charlie/share-resumed-history
Jun 23, 2026
Merged

Share resumed rollout history#28426
charliemarsh-oai merged 3 commits into
mainfrom
charlie/share-resumed-history

Conversation

@charliemarsh-oai

Copy link
Copy Markdown
Contributor

Summary

Resuming a persisted thread currently deep-clones its complete rollout history several times. InitialHistory is retained for the app-server response, copied into thread persistence, and copied again by read-only accessors. These copies scale with the complete rollout rather than the bounded model context and add measurable latency for large sessions.

This change stores resumed rollout history in Arc<Vec<RolloutItem>>. Rollout loading wraps the parsed vector once, while app-server response construction, session initialization, and thread persistence share it through inexpensive Arc clones. Read-only history access now returns a borrowed slice, and fork paths use Arc::unwrap_or_clone where they genuinely need mutable ownership. Rollout reconstruction also consumes its temporary context instead of cloning the reconstructed model history.

The serialized representation remains unchanged. In an artificial 123 MB rollout benchmark, sharing resumed history reduced cold resume latency by roughly 9–10%. The affected crates compile with their test targets, all 80 thread-store tests pass, and the Bazel dependency lock remains valid.

@charliemarsh-oai
charliemarsh-oai force-pushed the charlie/share-resumed-history branch from 967b40f to ebc8c5f Compare June 16, 2026 02:34
@charliemarsh-oai
charliemarsh-oai marked this pull request as ready for review June 16, 2026 02:34
@charliemarsh-oai
charliemarsh-oai requested a review from a team as a code owner June 16, 2026 02:34
@charliemarsh-oai
charliemarsh-oai force-pushed the charlie/share-resumed-history branch from ebc8c5f to 90188f2 Compare June 16, 2026 02:34
@charliemarsh-oai
charliemarsh-oai requested a review from anp-oai June 16, 2026 13:20
.as_ref()
.map(|history| history.items.clone())
.take()
.map(|history| history.items)

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.

I like the ownership transfer here, but the running-thread resume branch still clones source_thread.history and then clears it immediately. Can we put the same take() there? Otherwise this improvement becomes marginal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed now

@charliemarsh-oai
charliemarsh-oai force-pushed the charlie/share-resumed-history branch from 90188f2 to eb2ebf6 Compare June 16, 2026 13:55
@charliemarsh-oai
charliemarsh-oai requested a review from jif-oai June 16, 2026 13:55
@charliemarsh-oai
charliemarsh-oai force-pushed the charlie/share-resumed-history branch 2 times, most recently from 8ff6e1f to e3e7a90 Compare June 22, 2026 23:56

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

ℹ️ 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/Cargo.toml
semver = "1.0"
sentry = "0.46.0"
serde = "1"
serde = { version = "1", features = ["rc"] }

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 Commit the regenerated Bazel lockfile

This changes the workspace serde dependency features, but the commit does not update MODULE.bazel.lock. The repo requires running just bazel-lock-update and committing the refreshed lockfile whenever Cargo.toml/Cargo.lock dependencies change; otherwise Bazel lock checks can reject the change or use stale crate-universe metadata for the new rc feature. Please regenerate the Bazel lockfile with this dependency update.

AGENTS.md reference: AGENTS.md:L37-L40

Useful? React with 👍 / 👎.

@charliemarsh-oai
charliemarsh-oai force-pushed the charlie/share-resumed-history branch from e3e7a90 to c85a4f6 Compare June 23, 2026 00:07
@charliemarsh-oai
charliemarsh-oai merged commit 330ae6a into main Jun 23, 2026
45 checks passed
@charliemarsh-oai
charliemarsh-oai deleted the charlie/share-resumed-history branch June 23, 2026 14:23
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 23, 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.

3 participants