mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add dedicated memory v2 consolidation and read prompts (#43813)
## What changed - Consolidate v2 rollout summaries into `memory_summary.md` without generating `raw_memories.md` or requiring `MEMORY.md`. Validate the summary's required sections and size below 10,000 UTF-8 bytes. - Add v2 read instructions for selective history retrieval, evidence-grounded preferences, citations, and explicit memory edits. Split injected instructions into fragments to preserve the complete summary within fragment byte limits. - Record memory citation usage in the store selected by `memories.version`. ## Testing Add coverage for v2 consolidation without a handbook, summary validation, version-isolated memory reads, and resetting both memory versions while preserving threads. GitOrigin-RevId: 1d895fb4a23a973f1a45ba03be07a1f480c10227
This commit is contained in:
1 parent
e7f5de0a6a
commit
553df1c691
14 files changed
+487
-86
No files matched your search
@@ -91,3 +91,31 @@ async fn validate_consolidation_artifacts_rejects_invalid_summary() {
|
||||
|
||||
assert!(err.to_string().contains("does not start with v1"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn v2_accepts_summary_only_and_checks_its_format_and_size() -> anyhow::Result<()> {
|
||||
let home = TempDir::new()?;
|
||||
let root = home.path();
|
||||
fs::write(
|
||||
root.join("memory_summary.md"),
|
||||
"v1\n\n## User Profile\nProfile\n## User preferences\nPreferences\n## General Tips\nTips\n## What's in Memory\nIndex\n",
|
||||
)?;
|
||||
validate_consolidation_artifacts_for_version(root, MemoryVersion::V2).await?;
|
||||
assert!(validate_consolidation_artifacts(root).await.is_err());
|
||||
fs::write(root.join("memory_summary.md"), "v2\nsummary")?;
|
||||
assert!(
|
||||
validate_consolidation_artifacts_for_version(root, MemoryVersion::V2)
|
||||
.await
|
||||
.is_err()
|
||||
);
|
||||
fs::write(
|
||||
root.join("memory_summary.md"),
|
||||
format!("v1\n{}", "x".repeat(10_000)),
|
||||
)?;
|
||||
assert!(
|
||||
validate_consolidation_artifacts_for_version(root, MemoryVersion::V2)
|
||||
.await
|
||||
.is_err()
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
Reference in new issue
Block a user