mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:30:49 +00:00
Remove unused Guardian evidence write acknowledgments (#63942)
## Why Guardian's public review path does not consume per-write acknowledgments. The session still needs to finish saving accepted evidence when a turn is canceled. ## What changed Replace the acknowledgment tracker with a `PreserveReviewWrites` opt-in for Guardian root sessions. The session continues to save changed evidence across turn cancellation and waits for those writes during shutdown. Remove the append callback from `LiveThread`. ## Testing Add a regression test that interrupts a turn while forwarded user instructions are still being saved, then checks that the instructions appear in persisted history. GitOrigin-RevId: 01e8b2665034f46e766cb382ace99c416f29aab6
This commit is contained in:
@@ -235,24 +235,8 @@ impl LiveThread {
|
||||
))
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "trace", skip_all, fields(item_count = raw_items.len()))]
|
||||
pub async fn append_items(&self, raw_items: &[RolloutItem]) -> ThreadStoreResult<()> {
|
||||
self.append_items_with_ack(raw_items, || {}).await
|
||||
}
|
||||
|
||||
/// Calls `on_append` synchronously once the store accepts a nonempty batch of
|
||||
/// persistable items. A later metadata error or cancellation does not undo that
|
||||
/// acknowledgment. Metadata errors still propagate to the caller.
|
||||
#[tracing::instrument(
|
||||
name = "append_items",
|
||||
level = "trace",
|
||||
skip_all,
|
||||
fields(item_count = raw_items.len())
|
||||
)]
|
||||
pub async fn append_items_with_ack(
|
||||
&self,
|
||||
raw_items: &[RolloutItem],
|
||||
on_append: impl FnOnce() + Send,
|
||||
) -> ThreadStoreResult<()> {
|
||||
let items = self
|
||||
.persist_appended_items(raw_items)
|
||||
.await?
|
||||
@@ -260,7 +244,6 @@ impl LiveThread {
|
||||
if items.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
on_append();
|
||||
if self.should_defer_rollout_metadata().await {
|
||||
let _ = self
|
||||
.metadata_sync
|
||||
|
||||
@@ -27,7 +27,7 @@ use crate::UpdateThreadMetadataParams;
|
||||
use crate::local::test_support::test_config;
|
||||
|
||||
#[tokio::test]
|
||||
async fn acknowledged_history_is_readable_after_metadata_failure() {
|
||||
async fn appended_history_is_readable_after_metadata_failure() {
|
||||
let (_home, store, runtime) = store_with_runtime().await;
|
||||
let thread_id = ThreadId::new();
|
||||
let mut params = create_thread_params(thread_id);
|
||||
@@ -44,13 +44,11 @@ async fn acknowledged_history_is_readable_after_metadata_failure() {
|
||||
phase: None,
|
||||
});
|
||||
let items = [RolloutItem::ResponseItem(message.clone().into())];
|
||||
let mut acknowledged = false;
|
||||
let error = live
|
||||
.append_items_with_ack(&items, || acknowledged = true)
|
||||
.append_items(&items)
|
||||
.await
|
||||
.expect_err("surface the metadata failure");
|
||||
assert!(error.to_string().contains("failed to read thread metadata"));
|
||||
assert!(acknowledged);
|
||||
store.flush_thread(thread_id).await.expect("flush history");
|
||||
let start = HistoryPosition {
|
||||
thread_id,
|
||||
|
||||
Reference in New Issue
Block a user