diff --git a/codex-rs/core/src/tasks/mod.rs b/codex-rs/core/src/tasks/mod.rs index 2549c4960b..e3f19363eb 100644 --- a/codex-rs/core/src/tasks/mod.rs +++ b/codex-rs/core/src/tasks/mod.rs @@ -236,7 +236,7 @@ impl Session { self.start_task(turn_context, input, task).await; } - pub(crate) async fn start_task( + async fn start_task( self: &Arc, turn_context: Arc, input: Vec, diff --git a/codex-rs/core/src/tools/handlers/mod.rs b/codex-rs/core/src/tools/handlers/mod.rs index cb3962c934..c1fa88637f 100644 --- a/codex-rs/core/src/tools/handlers/mod.rs +++ b/codex-rs/core/src/tools/handlers/mod.rs @@ -1,5 +1,5 @@ pub(crate) mod agent_jobs; -pub mod apply_patch; +pub(crate) mod apply_patch; mod dynamic; mod js_repl; mod list_dir; diff --git a/codex-rs/rollout/src/list.rs b/codex-rs/rollout/src/list.rs index f89bcf58c8..e7d3dae5de 100644 --- a/codex-rs/rollout/src/list.rs +++ b/codex-rs/rollout/src/list.rs @@ -713,6 +713,7 @@ async fn build_thread_item( { return None; } + // Apply filters: must have session meta and at least one user message event if summary.saw_session_meta && summary.saw_user_event { let HeadTailSummary { thread_id, diff --git a/codex-rs/rollout/src/recorder_tests.rs b/codex-rs/rollout/src/recorder_tests.rs index 271656f9f1..3e2ac52194 100644 --- a/codex-rs/rollout/src/recorder_tests.rs +++ b/codex-rs/rollout/src/recorder_tests.rs @@ -31,23 +31,6 @@ fn test_config(codex_home: &Path) -> RolloutConfig { } fn write_session_file(root: &Path, ts: &str, uuid: Uuid) -> std::io::Result { - write_session_file_with_user_message(root, ts, uuid, /*include_user_message*/ true) -} - -fn write_session_file_without_user_message( - root: &Path, - ts: &str, - uuid: Uuid, -) -> std::io::Result { - write_session_file_with_user_message(root, ts, uuid, /*include_user_message*/ false) -} - -fn write_session_file_with_user_message( - root: &Path, - ts: &str, - uuid: Uuid, - include_user_message: bool, -) -> std::io::Result { let day_dir = root.join("sessions/2025/01/03"); fs::create_dir_all(&day_dir)?; let path = day_dir.join(format!("rollout-{ts}-{uuid}.jsonl")); @@ -66,18 +49,16 @@ fn write_session_file_with_user_message( }, }); writeln!(file, "{meta}")?; - if include_user_message { - let user_event = serde_json::json!({ - "timestamp": ts, - "type": "event_msg", - "payload": { - "type": "user_message", - "message": "Hello from user", - "kind": "plain", - }, - }); - writeln!(file, "{user_event}")?; - } + let user_event = serde_json::json!({ + "timestamp": ts, + "type": "event_msg", + "payload": { + "type": "user_message", + "message": "Hello from user", + "kind": "plain", + }, + }); + writeln!(file, "{user_event}")?; Ok(path) } @@ -542,86 +523,6 @@ async fn list_threads_db_enabled_repairs_stale_rollout_paths() -> std::io::Resul Ok(()) } -#[tokio::test] -async fn list_threads_db_enabled_fills_page_after_filtering_empty_threads() -> std::io::Result<()> { - let home = TempDir::new().expect("temp dir"); - let config = test_config(home.path()); - - let empty_uuid = Uuid::from_u128(9015); - let valid_uuid = Uuid::from_u128(9016); - let empty_thread_id = - ThreadId::from_string(&empty_uuid.to_string()).expect("valid empty thread id"); - let valid_thread_id = ThreadId::from_string(&valid_uuid.to_string()).expect("valid thread id"); - let empty_path = - write_session_file_without_user_message(home.path(), "2025-01-03T15-00-00", empty_uuid)?; - let valid_path = write_session_file(home.path(), "2025-01-03T14-00-00", valid_uuid)?; - - let runtime = codex_state::StateRuntime::init( - home.path().to_path_buf(), - config.model_provider_id.clone(), - ) - .await - .expect("state db should initialize"); - runtime - .mark_backfill_complete(/*last_watermark*/ None) - .await - .expect("backfill should be complete"); - - let empty_created_at = chrono::Utc - .with_ymd_and_hms(2025, 1, 3, 15, 0, 0) - .single() - .expect("valid empty thread datetime"); - let mut empty_builder = codex_state::ThreadMetadataBuilder::new( - empty_thread_id, - empty_path, - empty_created_at, - SessionSource::Cli, - ); - empty_builder.model_provider = Some(config.model_provider_id.clone()); - empty_builder.cwd = home.path().to_path_buf(); - let empty_metadata = empty_builder.build(config.model_provider_id.as_str()); - runtime - .upsert_thread(&empty_metadata) - .await - .expect("state db empty upsert should succeed"); - - let valid_created_at = chrono::Utc - .with_ymd_and_hms(2025, 1, 3, 14, 0, 0) - .single() - .expect("valid thread datetime"); - let mut valid_builder = codex_state::ThreadMetadataBuilder::new( - valid_thread_id, - valid_path.clone(), - valid_created_at, - SessionSource::Cli, - ); - valid_builder.model_provider = Some(config.model_provider_id.clone()); - valid_builder.cwd = home.path().to_path_buf(); - let mut valid_metadata = valid_builder.build(config.model_provider_id.as_str()); - valid_metadata.first_user_message = Some("Hello from user".to_string()); - runtime - .upsert_thread(&valid_metadata) - .await - .expect("state db valid upsert should succeed"); - - let default_provider = config.model_provider_id.clone(); - let page = RolloutRecorder::list_threads( - &config, - /*page_size*/ 1, - /*cursor*/ None, - ThreadSortKey::CreatedAt, - &[], - /*model_providers*/ None, - default_provider.as_str(), - /*search_term*/ None, - ) - .await?; - assert_eq!(page.items.len(), 1); - assert_eq!(page.items[0].path, valid_path); - assert!(page.next_cursor.is_none()); - Ok(()) -} - #[tokio::test] async fn resume_candidate_matches_cwd_reads_latest_turn_context() -> std::io::Result<()> { let home = TempDir::new().expect("temp dir"); diff --git a/codex-rs/tools/src/tool_config.rs b/codex-rs/tools/src/tool_config.rs index c0f919bc3e..dc1c30a691 100644 --- a/codex-rs/tools/src/tool_config.rs +++ b/codex-rs/tools/src/tool_config.rs @@ -105,7 +105,6 @@ pub struct ToolsConfig { pub collab_tools: bool, pub multi_agent_v2: bool, pub hide_spawn_agent_metadata: bool, - pub request_user_input: bool, pub timer_scheduler: bool, pub spawn_agent_usage_hint: bool, pub spawn_agent_usage_hint_text: Option, @@ -148,7 +147,6 @@ impl ToolsConfig { let include_collab_tools = features.enabled(Feature::Collab); let include_multi_agent_v2 = features.enabled(Feature::MultiAgentV2); let include_agent_jobs = features.enabled(Feature::SpawnCsv); - let include_request_user_input = !matches!(session_source, SessionSource::SubAgent(_)); let include_timer_scheduler = features.enabled(Feature::TimerScheduler); let include_default_mode_request_user_input = features.enabled(Feature::DefaultModeRequestUserInput); @@ -230,7 +228,6 @@ impl ToolsConfig { collab_tools: include_collab_tools, multi_agent_v2: include_multi_agent_v2, hide_spawn_agent_metadata: false, - request_user_input: include_request_user_input, timer_scheduler: include_timer_scheduler, spawn_agent_usage_hint: true, spawn_agent_usage_hint_text: None,