core: render remote environment cwd natively (#28152)

## Why

Model-visible `<environment_context>` should match the environment of
the executor, not of the app server.

Stacked on #28146.

## What

- Keep selected environment cwd values as `PathUri` while building
environment context.
- Render cwd text using the path convention represented by the URI, with
the canonical URI as a fallback.
- Preserve compatibility with legacy `TurnContextItem.cwd` values when
reconstructing and diffing context.
- Extend the Wine-backed remote Windows test to assert that the model
sees `powershell` and `C:\windows`.
This commit is contained in:
Adam Perry @ OpenAI authored and GitHub committed 2026-06-16 16:17:47 -07:00
1 parent a34da3b295
commit 4c79527e31
25 files changed
+457 -185

No files matched your search

+22
View File
@@ -100,6 +100,28 @@ fn drive_shaped_posix_uri_is_intentionally_inferred_as_windows() {
assert_eq!(path.infer_path_convention(), Some(PathConvention::Windows));
}
#[test]
fn inferred_native_path_string_uses_the_inferred_convention() {
for (uri, expected) in [
("file:///home/alice/a%20file.rs", "/home/alice/a file.rs"),
(
"file:///C:/Users/Alice%20Smith/main.rs",
r"C:\Users\Alice Smith\main.rs",
),
("file://server/share/main.rs", r"\\server\share\main.rs"),
("file://server/", "file://server/"),
("file:///%00/bad/path/YQ", "file:///%00/bad/path/YQ"),
] {
let path = PathUri::parse(uri).expect("valid path URI");
assert_eq!(
path.inferred_native_path_string(),
expected,
"rendering {uri}"
);
}
}
#[cfg(windows)]
#[test]
fn file_uri_falls_back_for_windows_prefixes_without_a_uri_representation() {