nit: one more fix (#19813)

Fix this:
https://github.com/openai/codex/pull/19812#discussion_r3147529230
This commit is contained in:
jif-oai
2026-04-27 15:32:31 +02:00
committed by GitHub
parent 79b4f691a6
commit f431ec12c9
3 changed files with 12 additions and 151 deletions
+2 -18
View File
@@ -122,11 +122,12 @@ pub(super) async fn run(session: &Arc<Session>, config: Arc<Config>) {
if !workspace_diff.has_changes() {
tracing::error!("Phase 2 no changes");
// We check only after sync of the file system.
job::succeed_preserving_selection(
job::succeed(
session,
db,
&claim,
new_watermark,
&raw_memories,
"succeeded_no_workspace_changes",
)
.await;
@@ -290,23 +291,6 @@ mod job {
.await
.unwrap_or(false)
}
pub(super) async fn succeed_preserving_selection(
session: &Arc<Session>,
db: &StateRuntime,
claim: &Claim,
completion_watermark: i64,
reason: &'static str,
) -> bool {
session.services.session_telemetry.counter(
metrics::MEMORY_PHASE_TWO_JOBS,
/*inc*/ 1,
&[("status", reason)],
);
db.mark_global_phase2_job_succeeded_preserving_selection(&claim.token, completion_watermark)
.await
.unwrap_or(false)
}
}
mod agent {
+10 -2
View File
@@ -1128,9 +1128,10 @@ mod phase2 {
}
#[tokio::test]
async fn dispatch_with_clean_workspace_preserves_selected_phase2_baseline() {
async fn dispatch_with_clean_workspace_rebuilds_selected_phase2_baseline() {
let harness = DispatchHarness::new().await;
let thread_id = harness.seed_stage1_output(Utc::now().timestamp()).await;
let source_updated_at = (Utc::now() - ChronoDuration::days(1)).timestamp();
let thread_id = harness.seed_stage1_output(source_updated_at).await;
let root = memory_root(&harness.config.codex_home);
let selected = harness
.state_db
@@ -1151,6 +1152,13 @@ mod phase2 {
phase2::run(&harness.session, Arc::clone(&harness.config)).await;
pretty_assertions::assert_eq!(harness.user_input_ops_count(), 0);
let pruned = harness
.state_db
.prune_stage1_outputs_for_retention(/*max_unused_days*/ 0, /*limit*/ 10)
.await
.expect("prune stage1 outputs after clean phase2");
pretty_assertions::assert_eq!(pruned, 0);
let selected = harness
.state_db
.get_phase2_input_selection(/*n*/ 1, /*max_unused_days*/ 30)