chore: adapt command cwd layer to current APIs

This commit is contained in:
Adam Perry
2026-06-16 17:45:42 +00:00
parent 4a4c8fad12
commit 7da4e6a9ae
11 changed files with 22 additions and 46 deletions
@@ -2338,11 +2338,7 @@ mod tests {
fn command_execution_completion_item(command: &str) -> CommandExecutionCompletionItem {
CommandExecutionCompletionItem {
command: command.to_string(),
cwd: ApiPathString::from_abs_path(
&test_path_buf("/tmp").abs(),
PathConvention::native(),
)
.expect("API cwd"),
cwd: ApiPathString::from_abs_path(&test_path_buf("/tmp").abs()),
command_actions: vec![V2ParsedCommand::Unknown {
command: command.to_string(),
}],
+1 -2
View File
@@ -6,7 +6,6 @@ use codex_app_server_protocol::ThreadRealtimeStartedNotification;
use codex_protocol::protocol::RealtimeConversationVersion;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::ApiPathString;
use codex_utils_path_uri::PathConvention;
use pretty_assertions::assert_eq;
use serde_json::json;
use tokio::time::Duration;
@@ -17,7 +16,7 @@ fn absolute_path(path: &str) -> AbsolutePathBuf {
}
fn api_path(path: &str) -> ApiPathString {
ApiPathString::from_abs_path(&absolute_path(path), PathConvention::native()).expect("API path")
ApiPathString::from_abs_path(&absolute_path(path))
}
fn thread_realtime_started_notification() -> ServerNotification {
@@ -77,6 +77,7 @@ use codex_protocol::models::ImageDetail;
use codex_protocol::openai_models::ReasoningEffort;
use codex_protocol::user_input::MAX_USER_INPUT_TEXT_CHARS;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::ApiPathString;
use core_test_support::responses;
use core_test_support::skip_if_no_network;
use pretty_assertions::assert_eq;
@@ -2440,10 +2441,7 @@ async fn turn_start_updates_sandbox_and_cwd_between_turns_v2() -> Result<()> {
unreachable!("loop ensures we break on command execution items");
};
let second_cwd = codex_utils_absolute_path::AbsolutePathBuf::from_absolute_path(second_cwd)?;
assert_eq!(
cwd,
ApiPathString::from_abs_path(&second_cwd, PathConvention::native())?
);
assert_eq!(cwd, ApiPathString::from_abs_path(&second_cwd));
let expected_command = format_with_current_shell_display("echo second turn");
assert_eq!(command, expected_command);
assert_eq!(status, CommandExecutionStatus::InProgress);
@@ -34,7 +34,6 @@ use codex_features::FEATURES;
use codex_features::Feature;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::ApiPathString;
use codex_utils_path_uri::PathConvention;
use core_test_support::responses;
use core_test_support::skip_if_no_network;
use pretty_assertions::assert_eq;
@@ -171,10 +170,7 @@ async fn turn_start_shell_zsh_fork_executes_command_v2() -> Result<()> {
assert!(command.contains("sleep 0.01"));
assert!(command.contains(&release_marker.display().to_string()));
let workspace = AbsolutePathBuf::try_from(workspace)?;
assert_eq!(
cwd,
ApiPathString::from_abs_path(&workspace, PathConvention::native())?
);
assert_eq!(cwd, ApiPathString::from_abs_path(&workspace));
mcp.interrupt_turn_and_wait_for_aborted(thread.id, turn.id, DEFAULT_READ_TIMEOUT)
.await?;