mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
Extend memory extension resource retention to 14 days (#54033)
## What changed Increase memory extension resource retention from 7 to 14 days before pruning. ## Testing Update pruning and startup test fixtures for the 14-day retention window, including resources at the exact cutoff. GitOrigin-RevId: 5044a1262c8806245d90d567cd84b21aa0d3da43
This commit is contained in:
@@ -27,9 +27,9 @@ async fn prunes_only_old_resources_from_extensions_with_instructions() {
|
||||
.expect("parse now"),
|
||||
Utc,
|
||||
);
|
||||
let old_file = chronicle_resources.join("2026-04-06T11-59-59-abcd-10min-old.md");
|
||||
let exact_cutoff_file = chronicle_resources.join("2026-04-07T12-00-00-abcd-10min-cutoff.md");
|
||||
let recent_file = chronicle_resources.join("2026-04-08T12-00-00-abcd-10min-recent.md");
|
||||
let old_file = chronicle_resources.join("2026-03-30T11-59-59-abcd-10min-old.md");
|
||||
let exact_cutoff_file = chronicle_resources.join("2026-03-31T12-00-00-abcd-10min-cutoff.md");
|
||||
let recent_file = chronicle_resources.join("2026-04-01T12-00-00-abcd-10min-recent.md");
|
||||
let invalid_file = chronicle_resources.join("not-a-timestamp.md");
|
||||
for file in [&old_file, &exact_cutoff_file, &recent_file, &invalid_file] {
|
||||
tokio::fs::write(file, "resource")
|
||||
@@ -41,7 +41,7 @@ async fn prunes_only_old_resources_from_extensions_with_instructions() {
|
||||
tokio::fs::create_dir_all(&ignored_resources)
|
||||
.await
|
||||
.expect("create ignored resources");
|
||||
let ignored_old_file = ignored_resources.join("2026-04-06T11-59-59-abcd-10min-old.md");
|
||||
let ignored_old_file = ignored_resources.join("2026-03-30T11-59-59-abcd-10min-old.md");
|
||||
tokio::fs::write(&ignored_old_file, "ignored")
|
||||
.await
|
||||
.expect("write ignored resource");
|
||||
|
||||
@@ -42,7 +42,7 @@ mod artifacts {
|
||||
|
||||
mod extension_resources {
|
||||
pub(super) const FILENAME_TS_FORMAT: &str = "%Y-%m-%dT%H-%M-%S";
|
||||
pub(super) const RETENTION_DAYS: i64 = 7;
|
||||
pub(super) const RETENTION_DAYS: i64 = 14;
|
||||
}
|
||||
|
||||
mod guard_limits {
|
||||
|
||||
@@ -520,12 +520,12 @@ async fn memories_startup_phase2_prunes_old_extension_resources() -> anyhow::Res
|
||||
.await?;
|
||||
let old_file = chronicle_resources.join(format!(
|
||||
"{}-abcd-10min-old.md",
|
||||
(now - chrono::Duration::days(8)).format("%Y-%m-%dT%H-%M-%S")
|
||||
(now - chrono::Duration::days(15)).format("%Y-%m-%dT%H-%M-%S")
|
||||
));
|
||||
tokio::fs::write(&old_file, "old resource").await?;
|
||||
let recent_file = chronicle_resources.join(format!(
|
||||
"{}-abcd-10min-recent.md",
|
||||
(now - chrono::Duration::days(6)).format("%Y-%m-%dT%H-%M-%S")
|
||||
(now - chrono::Duration::days(13)).format("%Y-%m-%dT%H-%M-%S")
|
||||
));
|
||||
tokio::fs::write(&recent_file, "recent resource").await?;
|
||||
seed_required_memory_artifacts(&home.path().join("memories")).await?;
|
||||
@@ -586,7 +586,7 @@ async fn memories_startup_phase2_prunes_old_extension_resources_without_stage1_i
|
||||
.await?;
|
||||
let old_file = chronicle_resources.join(format!(
|
||||
"{}-abcd-10min-old.md",
|
||||
(now - chrono::Duration::days(8)).format("%Y-%m-%dT%H-%M-%S")
|
||||
(now - chrono::Duration::days(15)).format("%Y-%m-%dT%H-%M-%S")
|
||||
));
|
||||
tokio::fs::write(&old_file, "old resource").await?;
|
||||
seed_required_memory_artifacts(&home.path().join("memories")).await?;
|
||||
|
||||
Reference in New Issue
Block a user