Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

chore: morpheus does not generate memories (#15175)

jif-oai859c58f07dc3
diff --git a/codex-rs/core/src/memories/phase2.rs b/codex-rs/core/src/memories/phase2.rs
index 23933ca7f9..6eb10edb70 100644
--- a/codex-rs/core/src/memories/phase2.rs
+++ b/codex-rs/core/src/memories/phase2.rs
@@ -267,6 +267,8 @@ mod agent {
let mut agent_config = config.as_ref().clone();
agent_config.cwd = root;
+ // Consolidation threads must never feed back into phase-1 memory generation.
+ agent_config.memories.generate_memories = false;
// Approval policy
agent_config.permissions.approval_policy = Constrained::allow_only(AskForApproval::Never);
// Consolidation runs as an internal sub-agent and must not recursively delegate.
diff --git a/codex-rs/core/src/memories/tests.rs b/codex-rs/core/src/memories/tests.rs
index d32564aad2..e04a018a84 100644
--- a/codex-rs/core/src/memories/tests.rs
+++ b/codex-rs/core/src/memories/tests.rs
@@ -437,6 +437,7 @@ mod phase2 {
use codex_state::ThreadMetadataBuilder;
use std::path::PathBuf;
use std::sync::Arc;
+ use std::time::Duration;
use tempfile::TempDir;
fn stage1_output_with_source_updated_at(source_updated_at: i64) -> Stage1Output {
@@ -663,9 +664,10 @@ mod phase2 {
pretty_assertions::assert_eq!(user_input_ops, 1);
let thread_ids = harness.manager.list_thread_ids().await;
pretty_assertions::assert_eq!(thread_ids.len(), 1);
+ let thread_id = thread_ids[0];
let subagent = harness
.manager
- .get_thread(thread_ids[0])
+ .get_thread(thread_id)
.await
.expect("get consolidation thread");
let config_snapshot = subagent.config_snapshot().await;
@@ -682,6 +684,34 @@ mod phase2 {
}
other => panic!("unexpected sandbox policy: {other:?}"),
}
+ subagent.codex.session.ensure_rollout_materialized().await;
+ subagent.codex.session.flush_rollout().await;
+ let rollout_path = subagent
+ .rollout_path()
+ .expect("consolidation thread should have a rollout path");
+ crate::state_db::read_repair_rollout_path(
+ Some(harness.state_db.as_ref()),
+ Some(thread_id),
+ Some(/*archived_only*/ false),
+ rollout_path.as_path(),
+ )
+ .await;
+ let memory_mode = tokio::time::timeout(Duration::from_secs(10), async {
+ loop {
+ let memory_mode = harness
+ .state_db
+ .get_thread_memory_mode(thread_id)
+ .await
+ .expect("read consolidation thread memory mode");
+ if memory_mode.is_some() {
+ break memory_mode;
+ }
+ tokio::time::sleep(Duration::from_millis(10)).await;
+ }
+ })
+ .await
+ .expect("timed out waiting for consolidation thread memory mode to persist");
+ pretty_assertions::assert_eq!(memory_mode.as_deref(), Some("disabled"));
harness.shutdown_threads().await;
}