mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Distinguish turn-start thread persistence (#37926)
## What changed - Add `PersistContext` to the thread-store persistence contract so stores can identify persistence requested immediately before model sampling. A `TurnStart` request may be enqueued in the background when later flush and shutdown operations fence it and report any failure; all other persistence remains synchronous. - Use the turn-start context only for the initial input of a regular turn, while admission acknowledgments, steered input, and other persistence paths keep the standard durability behavior. - Flush pending metadata before turn-start persistence and ensure shutdown is still attempted if that metadata update fails. ## Testing - Verify that developer instructions and user input are persisted before the model request completes for a default paginated-history thread. GitOrigin-RevId: 162f0ec796a61aebe66ca0b909fbcccec3047b85
This commit is contained in:
1 parent
f8821d85eb
commit
722784e936
24 files changed
+289
-75
No files matched your search
@@ -49,6 +49,7 @@ use codex_protocol::protocol::TurnAbortReason;
|
||||
use codex_protocol::protocol::WarningEvent;
|
||||
use codex_protocol::request_permissions::RequestPermissionsResponse;
|
||||
use codex_protocol::request_user_input::RequestUserInputResponse;
|
||||
use codex_thread_store::PersistContext;
|
||||
|
||||
use crate::context_manager::is_user_turn_boundary;
|
||||
use codex_protocol::dynamic_tools::DynamicToolResponse;
|
||||
@@ -557,7 +558,7 @@ pub(super) async fn persist_thread_memory_mode_update(
|
||||
mode: ThreadMemoryMode,
|
||||
) -> anyhow::Result<()> {
|
||||
let live_thread = sess.live_thread_for_persistence("update thread memory mode")?;
|
||||
live_thread.persist().await?;
|
||||
live_thread.persist(PersistContext::Standard).await?;
|
||||
live_thread.flush().await?;
|
||||
live_thread
|
||||
.update_memory_mode(mode, /*include_archived*/ false)
|
||||
|
||||
Reference in new issue
Block a user