Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

memories: bump rollout summary slug cap to 60 (#12167)

zuxin-oai82d82d9ca5b7
diff --git a/codex-rs/core/src/memories/storage.rs b/codex-rs/core/src/memories/storage.rs
index d8a47f084a..ea2b00acf5 100644
--- a/codex-rs/core/src/memories/storage.rs
+++ b/codex-rs/core/src/memories/storage.rs
@@ -194,7 +194,7 @@ pub(super) fn rollout_summary_file_stem_from_parts(
source_updated_at: chrono::DateTime<chrono::Utc>,
rollout_slug: Option<&str>,
) -> String {
- const ROLLOUT_SLUG_MAX_LEN: usize = 20;
+ const ROLLOUT_SLUG_MAX_LEN: usize = 60;
const SHORT_HASH_ALPHABET: &[u8; 62] =
b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const SHORT_HASH_SPACE: u32 = 14_776_336;
@@ -318,12 +318,17 @@ mod tests {
let thread_id = fixed_thread_id();
let memory = stage1_output_with_slug(
thread_id,
- Some("Unsafe Slug/With Spaces & Symbols + EXTRA_LONG_12345"),
+ Some("Unsafe Slug/With Spaces & Symbols + EXTRA_LONG_12345_67890_ABCDE_fghij_klmno"),
);
+ let stem = rollout_summary_file_stem(&memory);
+ let slug = stem
+ .strip_prefix(&format!("{FIXED_PREFIX}-"))
+ .expect("slug suffix should be present");
+ assert_eq!(slug.len(), 60);
assert_eq!(
- rollout_summary_file_stem(&memory),
- format!("{FIXED_PREFIX}-unsafe_slug_with_spa")
+ slug,
+ "unsafe_slug_with_spaces___symbols___extra_long_12345_67890_a"
);
}
diff --git a/codex-rs/core/src/memories/tests.rs b/codex-rs/core/src/memories/tests.rs
index 9db049a69a..7d86f75c9d 100644
--- a/codex-rs/core/src/memories/tests.rs
+++ b/codex-rs/core/src/memories/tests.rs
@@ -203,7 +203,7 @@ async fn sync_rollout_summaries_uses_timestamp_hash_and_sanitized_slug_filename(
short_hash.chars().all(|ch| ch.is_ascii_alphanumeric()),
"short hash should use only alphanumeric chars"
);
- assert!(slug.len() <= 20, "slug should be capped at 20 chars");
+ assert!(slug.len() <= 60, "slug should be capped at 60 chars");
assert!(
slug.chars()
.all(|ch| ch.is_ascii_lowercase() || ch.is_ascii_digit() || ch == '_'),