app-server: preserve legacy cwd strings in exec events

This commit is contained in:
Adam Perry
2026-06-23 01:35:47 +00:00
parent 67009bc53f
commit 1544a003db
10 changed files with 90 additions and 31 deletions
+2 -2
View File
@@ -111,7 +111,7 @@ pub(crate) async fn emit_exec_command_begin(
turn_id: ctx.turn.sub_id.clone(),
started_at_ms: now_unix_timestamp_ms(),
command: command.to_vec(),
cwd: cwd.clone(),
cwd: cwd.clone().into(),
parsed_cmd: parsed_cmd.to_vec(),
source,
interaction_input,
@@ -551,7 +551,7 @@ async fn emit_exec_end(
turn_id: ctx.turn.sub_id.clone(),
completed_at_ms: now_unix_timestamp_ms(),
command: exec_input.command.to_vec(),
cwd: exec_input.cwd.clone(),
cwd: exec_input.cwd.clone().into(),
parsed_cmd: exec_input.parsed_cmd.to_vec(),
source: exec_input.source,
interaction_input: exec_input.interaction_input.map(str::to_owned),
@@ -194,7 +194,8 @@ async fn windows_exec_server_runs_with_native_shell_and_cwd() -> Result<()> {
assert_eq!(&begin.command[1..], ["-NoProfile", "-Command", COMMAND]);
let end = end.context("exec_command should emit an end event")?;
let expected_cwd = PathUri::parse("file:///C:/windows")?;
let expected_cwd: LegacyAppPathString =
PathUri::parse("file:///C:/windows")?.into();
assert_eq!((&begin.cwd, &end.cwd), (&expected_cwd, &expected_cwd));
assert_eq!((end.exit_code, end.status), (0, ExecCommandStatus::Completed));
+6 -3
View File
@@ -437,7 +437,10 @@ async fn unified_exec_emits_exec_command_begin_event() -> Result<()> {
assert_command(&begin_event.command, "-lc", "/bin/echo hello unified exec");
assert_eq!(begin_event.cwd, PathUri::from_host_native_path(&cwd)?);
assert_eq!(
begin_event.cwd,
PathUri::from_host_native_path(&cwd)?.into()
);
wait_for_event(&test.codex, |event| {
matches!(event, EventMsg::TurnComplete(_))
@@ -508,7 +511,7 @@ async fn unified_exec_resolves_relative_workdir() -> Result<()> {
assert_eq!(
begin_event.cwd,
PathUri::from_host_native_path(&workdir)?,
PathUri::from_host_native_path(&workdir)?.into(),
"exec_command cwd should resolve relative workdir against turn cwd",
);
@@ -570,7 +573,7 @@ async fn unified_exec_respects_workdir_override() -> Result<()> {
assert_eq!(
begin_event.cwd,
PathUri::from_host_native_path(&workdir)?,
PathUri::from_host_native_path(&workdir)?.into(),
"exec_command cwd should reflect the requested workdir override"
);