mirror of
https://github.com/openai/codex.git
synced 2026-11-13 21:30:47 +00:00
Reuse current model context across paginated resume config loading (#56224)
## Why Resuming a paginated thread rechecks stored history after loading configuration. Unchanged model context can be reused instead of loading it again. ## What changed Retain the prepared model context across configuration loading and reuse it when the thread ID, rollout path, and history revision still match. Add `ThreadStore::is_model_context_current` to validate revisions, with a fresh read when validation fails or is unavailable. ## Testing Add coverage for revision invalidation after history is appended or removed. Extend resume tests to cover paginated history, concurrent metadata and lifecycle changes, workspace-root changes, and preservation of saved user messages in model requests. GitOrigin-RevId: bad2ca0caddb63523264ac530ffb801db3961f2b
This commit is contained in:
@@ -268,6 +268,19 @@ pub trait ThreadStore: Any + Send + Sync {
|
||||
})
|
||||
}
|
||||
|
||||
/// Checks whether a previously loaded model context still represents the stored history.
|
||||
///
|
||||
/// Stores that cannot validate the opaque revision must return false. A false result or an
|
||||
/// error requires a fresh read. This does not acquire writer ownership;
|
||||
/// [`Self::resume_thread`] must still validate the snapshot after acquisition.
|
||||
fn is_model_context_current(
|
||||
&self,
|
||||
_params: LoadThreadHistoryParams,
|
||||
_revision: String,
|
||||
) -> ThreadStoreFuture<'_, bool> {
|
||||
Box::pin(async { Ok(false) })
|
||||
}
|
||||
|
||||
/// Freezes source history and model context used to initialize a referenced fork.
|
||||
///
|
||||
/// Stores without reference-backed fork support can retain this default implementation.
|
||||
|
||||
Reference in New Issue
Block a user