mirror of
https://github.com/openai/codex.git
synced 2026-06-01 19:02:59 +00:00
nit: phase 2 ephemeral (#18338)
This commit is contained in:
@@ -300,7 +300,9 @@ mod agent {
|
||||
|
||||
agent_config.cwd = root.clone();
|
||||
// Consolidation threads must never feed back into phase-1 memory generation.
|
||||
agent_config.ephemeral = true;
|
||||
agent_config.memories.generate_memories = false;
|
||||
agent_config.memories.use_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.
|
||||
|
||||
@@ -427,6 +427,7 @@ mod phase2 {
|
||||
use chrono::Duration as ChronoDuration;
|
||||
use chrono::Utc;
|
||||
use codex_config::Constrained;
|
||||
use codex_features::Feature;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_protocol::permissions::FileSystemSandboxPolicy;
|
||||
@@ -440,7 +441,6 @@ 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 {
|
||||
@@ -683,6 +683,7 @@ mod phase2 {
|
||||
.expect("get consolidation thread");
|
||||
let config_snapshot = subagent.config_snapshot().await;
|
||||
pretty_assertions::assert_eq!(config_snapshot.approval_policy, AskForApproval::Never);
|
||||
assert!(config_snapshot.ephemeral);
|
||||
pretty_assertions::assert_eq!(
|
||||
config_snapshot.cwd.as_path(),
|
||||
memory_root(&harness.config.codex_home).as_path()
|
||||
@@ -734,39 +735,28 @@ mod phase2 {
|
||||
NetworkSandboxPolicy::Restricted,
|
||||
"consolidation subagent split network policy should preserve no-network sandboxing"
|
||||
);
|
||||
subagent.codex.session.ensure_rollout_materialized().await;
|
||||
subagent
|
||||
.codex
|
||||
.session
|
||||
.flush_rollout()
|
||||
assert!(
|
||||
!turn_context.features.enabled(Feature::MemoryTool),
|
||||
"consolidation subagent should have the memories feature disabled"
|
||||
);
|
||||
assert!(
|
||||
!turn_context.config.memories.generate_memories,
|
||||
"consolidation subagent should not generate memories"
|
||||
);
|
||||
assert!(
|
||||
!turn_context.config.memories.use_memories,
|
||||
"consolidation subagent should not read memories"
|
||||
);
|
||||
assert!(
|
||||
subagent.rollout_path().is_none(),
|
||||
"ephemeral consolidation thread should not materialize a rollout"
|
||||
);
|
||||
let memory_mode = harness
|
||||
.state_db
|
||||
.get_thread_memory_mode(thread_id)
|
||||
.await
|
||||
.expect("subagent rollout should flush");
|
||||
let rollout_path = subagent
|
||||
.rollout_path()
|
||||
.expect("consolidation thread should have a rollout path");
|
||||
codex_rollout::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"));
|
||||
.expect("read consolidation thread memory mode");
|
||||
pretty_assertions::assert_eq!(memory_mode, None);
|
||||
|
||||
harness.shutdown_threads().await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user