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

+3 -2
View File
@@ -1765,15 +1765,16 @@ async fn resume_candidate_matches_cwd(
if let Ok((items, _, _)) = RolloutRecorder::load_rollout_items(rollout_path).await
&& let Some(latest_turn_context_cwd) = items.iter().rev().find_map(|item| match item {
RolloutItem::TurnContext(turn_context) => Some(turn_context.cwd.as_path()),
RolloutItem::TurnContext(turn_context) => Some(&turn_context.cwd),
RolloutItem::SessionMeta(_)
| RolloutItem::ResponseItem(_)
| RolloutItem::InterAgentCommunication(_)
| RolloutItem::Compacted(_)
| RolloutItem::EventMsg(_) => None,
})
&& let Ok(latest_turn_context_cwd) = latest_turn_context_cwd.to_abs_path()
{
return cwd_matches(latest_turn_context_cwd, cwd);
return cwd_matches(latest_turn_context_cwd.as_path(), cwd);
}
metadata::extract_metadata_from_rollout(rollout_path, default_provider)