mirror of
https://github.com/openai/codex.git
synced 2026-11-09 08:40:33 +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
@@ -51,6 +51,7 @@ use codex_protocol::protocol::TurnAbortReason;
|
||||
use codex_protocol::protocol::TurnAbortedEvent;
|
||||
use codex_protocol::protocol::TurnCompleteEvent;
|
||||
use codex_protocol::protocol::WarningEvent;
|
||||
use codex_thread_store::PersistContext;
|
||||
|
||||
use codex_features::Feature;
|
||||
use codex_protocol::error::CodexErrorDetails;
|
||||
@@ -627,7 +628,13 @@ impl Session {
|
||||
ts.token_usage_at_turn_start.clone(),
|
||||
)
|
||||
};
|
||||
run_hooks_and_record_inputs(self, &turn_context, &pending_input).await;
|
||||
run_hooks_and_record_inputs(
|
||||
self,
|
||||
&turn_context,
|
||||
&pending_input,
|
||||
PersistContext::Standard,
|
||||
)
|
||||
.await;
|
||||
task_ended_before_persistence |= self
|
||||
.pending_user_message_admissions
|
||||
.complete_task_end(&turn_context.sub_id);
|
||||
|
||||
Reference in new issue
Block a user