app-server: preserve command item cwd

This commit is contained in:
Adam Perry
2026-06-16 17:39:01 +00:00
parent bd47c95c4c
commit 4a4c8fad12
36 changed files with 154 additions and 65 deletions
@@ -2439,7 +2439,11 @@ async fn turn_start_updates_sandbox_and_cwd_between_turns_v2() -> Result<()> {
else {
unreachable!("loop ensures we break on command execution items");
};
assert_eq!(cwd.as_path(), second_cwd.as_path());
let second_cwd = codex_utils_absolute_path::AbsolutePathBuf::from_absolute_path(second_cwd)?;
assert_eq!(
cwd,
ApiPathString::from_abs_path(&second_cwd, PathConvention::native())?
);
let expected_command = format_with_current_shell_display("echo second turn");
assert_eq!(command, expected_command);
assert_eq!(status, CommandExecutionStatus::InProgress);
@@ -32,6 +32,9 @@ use codex_app_server_protocol::TurnStatus;
use codex_app_server_protocol::UserInput as V2UserInput;
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;
@@ -167,7 +170,11 @@ async fn turn_start_shell_zsh_fork_executes_command_v2() -> Result<()> {
assert!(command.contains("/bin/sh -c"));
assert!(command.contains("sleep 0.01"));
assert!(command.contains(&release_marker.display().to_string()));
assert_eq!(cwd.as_path(), workspace.as_path());
let workspace = AbsolutePathBuf::try_from(workspace)?;
assert_eq!(
cwd,
ApiPathString::from_abs_path(&workspace, PathConvention::native())?
);
mcp.interrupt_turn_and_wait_for_aborted(thread.id, turn.id, DEFAULT_READ_TIMEOUT)
.await?;