From 0206685a78c2776bd69d16246e74a2b78cf5d894 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Fri, 1 May 2026 14:45:23 -0700 Subject: [PATCH] drop thread state duration tests --- codex-rs/app-server/src/thread_state.rs | 90 ------------------------- 1 file changed, 90 deletions(-) diff --git a/codex-rs/app-server/src/thread_state.rs b/codex-rs/app-server/src/thread_state.rs index 8321eda55f..f99d64f466 100644 --- a/codex-rs/app-server/src/thread_state.rs +++ b/codex-rs/app-server/src/thread_state.rs @@ -463,93 +463,3 @@ impl ThreadStateManager { .map(|thread_entry| thread_entry.has_connections_watcher.subscribe()) } } - -#[cfg(test)] -mod tests { - use super::*; - use codex_app_server_protocol::CommandAction; - use codex_app_server_protocol::CommandExecutionSource; - use codex_app_server_protocol::TurnStatus; - use codex_utils_absolute_path::AbsolutePathBuf; - use pretty_assertions::assert_eq; - use std::path::PathBuf; - - fn test_absolute_path(path: &str) -> AbsolutePathBuf { - AbsolutePathBuf::try_from(PathBuf::from(path)).expect("path must be absolute") - } - - #[test] - fn refreshes_running_command_durations_for_live_turns() { - let mut state = ThreadState::default(); - state - .running_command_started_at_ms - .insert("exec-call".into(), now_unix_timestamp_ms() - 1_500); - let mut turns = vec![Turn { - id: "turn-1".into(), - items: vec![ThreadItem::CommandExecution { - id: "exec-call".into(), - command: "sleep 100".into(), - cwd: test_absolute_path(if cfg!(windows) { "C:\\tmp" } else { "/tmp" }), - process_id: Some("pid-1".into()), - source: CommandExecutionSource::Agent, - status: CommandExecutionStatus::InProgress, - command_actions: vec![CommandAction::Unknown { - command: "sleep 100".into(), - }], - aggregated_output: None, - exit_code: None, - duration_ms: Some(0), - }], - status: TurnStatus::InProgress, - error: None, - started_at: None, - completed_at: None, - duration_ms: None, - }]; - - state.refresh_running_command_durations(&mut turns); - - let ThreadItem::CommandExecution { duration_ms, .. } = &turns[0].items[0] else { - panic!("expected command execution item"); - }; - let elapsed = duration_ms.expect("running command duration"); - assert!(elapsed >= 1_500, "elapsed duration should include runtime"); - } - - #[test] - fn leaves_completed_command_duration_unchanged() { - let mut state = ThreadState::default(); - state - .running_command_started_at_ms - .insert("exec-call".into(), now_unix_timestamp_ms() - 1_500); - let mut turns = vec![Turn { - id: "turn-1".into(), - items: vec![ThreadItem::CommandExecution { - id: "exec-call".into(), - command: "sleep 100".into(), - cwd: test_absolute_path(if cfg!(windows) { "C:\\tmp" } else { "/tmp" }), - process_id: Some("pid-1".into()), - source: CommandExecutionSource::Agent, - status: CommandExecutionStatus::Completed, - command_actions: vec![CommandAction::Unknown { - command: "sleep 100".into(), - }], - aggregated_output: Some(String::new()), - exit_code: Some(0), - duration_ms: Some(42), - }], - status: TurnStatus::Completed, - error: None, - started_at: None, - completed_at: None, - duration_ms: None, - }]; - - state.refresh_running_command_durations(&mut turns); - - let ThreadItem::CommandExecution { duration_ms, .. } = &turns[0].items[0] else { - panic!("expected command execution item"); - }; - assert_eq!(*duration_ms, Some(42)); - } -}