From 474aee632861e0282d412b805a0a29aecb85e59a Mon Sep 17 00:00:00 2001 From: Felipe Coury Date: Fri, 12 Jun 2026 00:30:02 -0700 Subject: [PATCH] fix(tui): adapt workspace preview to path uris --- .../src/tools/handlers/workspace_mutation.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/codex-rs/core/src/tools/handlers/workspace_mutation.rs b/codex-rs/core/src/tools/handlers/workspace_mutation.rs index 9c718d72a9..28db229bf4 100644 --- a/codex-rs/core/src/tools/handlers/workspace_mutation.rs +++ b/codex-rs/core/src/tools/handlers/workspace_mutation.rs @@ -117,9 +117,17 @@ pub(crate) async fn plan_workspace_mutation( }); }; let requested = current.cwd.join(path); + let requested_uri = + PathUri::from_abs_path(&requested).map_err(|err| WorkspaceMutationError { + code: io_error_code(&err), + message: err.to_string(), + cwd: current.cwd.clone(), + workspace_roots: current.workspace_roots.clone(), + omitted_workspace_roots: 0, + })?; let fs = environment.environment.get_filesystem(); let canonical = fs - .canonicalize(&requested, /*sandbox*/ None) + .canonicalize(&requested_uri, /*sandbox*/ None) .await .map_err(|err| WorkspaceMutationError { code: io_error_code(&err), @@ -138,6 +146,15 @@ pub(crate) async fn plan_workspace_mutation( workspace_roots: current.workspace_roots.clone(), omitted_workspace_roots: 0, })?; + let canonical = canonical + .to_abs_path() + .map_err(|err| WorkspaceMutationError { + code: io_error_code(&err), + message: err.to_string(), + cwd: current.cwd.clone(), + workspace_roots: current.workspace_roots.clone(), + omitted_workspace_roots: 0, + })?; if !metadata.is_directory { return Err(WorkspaceMutationError { code: "not_a_directory",