mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:28:11 +00:00
Preserve paginated thread metadata across resumes (#35678)
## Why Paginated rollout history may contain only a bounded suffix. Deriving display metadata from that suffix can replace the thread's original preview, title, and first user message when the thread is read or resumed. ## What changed - Use SQLite as the canonical source of display metadata for paginated thread reads, including reads by an explicit rollout path. - Seed resume metadata tracking from the persisted values so appended history fills only missing fields instead of overwriting existing ones. - Prefer an explicitly requested rollout path over a stale path stored in SQLite while retaining the canonical metadata. ## Testing Added coverage for reads by ID and path, bounded-history resumes across app server restarts, preservation of existing metadata, initialization of missing fields, and stale persisted rollout paths. GitOrigin-RevId: b393d0727afcba70fda7f50a6f2dcca0632745b4
This commit is contained in:
1 parent
bbeee9a406
commit
4d1f66bf81
6 files changed
+316
-47
No files matched your search
@@ -151,7 +151,20 @@ impl LiveThread {
|
||||
let thread_id = params.thread_id;
|
||||
let should_load_history = params.history.is_none();
|
||||
let include_archived = params.include_archived;
|
||||
let mut metadata_sync = ThreadMetadataSync::for_resume(¶ms);
|
||||
let metadata = if history_mode == ThreadHistoryMode::Paginated
|
||||
&& let Some(local_store) = thread_store.as_any().downcast_ref::<LocalThreadStore>()
|
||||
&& let Some(state_db) = local_store.state_db().await
|
||||
{
|
||||
state_db
|
||||
.get_thread(thread_id)
|
||||
.await
|
||||
.map_err(|err| ThreadStoreError::Internal {
|
||||
message: format!("failed to read thread metadata for {thread_id}: {err}"),
|
||||
})?
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let mut metadata_sync = ThreadMetadataSync::for_resume(¶ms, metadata.as_ref());
|
||||
thread_store.resume_thread(params).await?;
|
||||
if should_load_history {
|
||||
match thread_store
|
||||
|
||||
Reference in new issue
Block a user