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

+13
View File
@@ -164,6 +164,19 @@ impl PathUri {
}
}
/// Renders this URI using the native path syntax inferred from its shape.
///
/// This is independent of the current host: a Windows URI renders with
/// Windows separators on every host. If the convention cannot be inferred
/// or the URI cannot be represented using that convention, the canonical
/// URI string is returned instead.
pub fn inferred_native_path_string(&self) -> String {
self.infer_path_convention()
.and_then(|convention| LegacyAppPathString::from_path_uri(self, convention).ok())
.map(LegacyAppPathString::into_string)
.unwrap_or_else(|| self.to_string())
}
/// Returns the decoded final URI path segment, or `None` for the URI root
/// or an opaque fallback URI created by [`Self::from_abs_path`].
///