Skip to content

[codex] exec-server honors remote environment cwd and shell#28122

Merged
anp-oai merged 13 commits into
mainfrom
codex/turn-environment-cwd-path-uri
Jun 14, 2026
Merged

[codex] exec-server honors remote environment cwd and shell#28122
anp-oai merged 13 commits into
mainfrom
codex/turn-environment-cwd-path-uri

Conversation

@anp-oai

@anp-oai anp-oai commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Why

Next slice needed to make progress on the remote_env_windows test is to support passing a Windows cwd for the remote environment and using that environment's native shell. This lets the test run a real Windows process instead of only recording an early path or shell mismatch.

What

  • change TurnEnvironmentSelection.cwd from AbsolutePathBuf to PathUri
  • convert local cwd values to URIs when constructing selections
  • preserve a remote primary cwd instead of replacing it with the local legacy fallback
  • prefer the selected environment's discovered shell for unified exec, falling back to the session shell when unavailable
  • convert back to a host-native absolute path at current native-only consumer boundaries
  • reject or deny unsupported foreign cwd values at the existing request-permissions boundary, with TODOs for its future migration
  • extend the hermetic Wine test to execute Windows PowerShell in C:\windows and verify successful process completion
  • record the current app-server rejection against the same Wine-backed remote Windows fixture when its cwd is supplied as a native Windows path

@anp-oai anp-oai marked this pull request as ready for review June 13, 2026 22:12
@anp-oai anp-oai requested a review from a team as a code owner June 13, 2026 22:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 846637c561

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core/src/environment_selection.rs
Comment thread codex-rs/protocol/src/protocol.rs
@anp-oai anp-oai changed the title [codex] Carry turn environment cwd as PathUri [codex] Honor remote environment cwd and shell Jun 13, 2026
Comment thread codex-rs/protocol/src/protocol.rs
@anp-oai anp-oai changed the title [codex] Honor remote environment cwd and shell [codex] exec-server honors remote environment cwd and shell Jun 14, 2026
Comment thread codex-rs/core/tests/remote_env_windows/remote_env_windows_test.rs Outdated
Comment thread codex-rs/core/tests/remote_env_windows/remote_env_windows_test.rs Outdated
shell_mode_for_environment(&turn.unified_exec_shell_mode, environment.as_ref());
// Remote environments may use a different OS and must build commands with their native
// shell; fall back to the session shell when the environment did not report one.
let shell = turn_environment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we use shell snapshot for local because of this/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is (sadly) done in a different place.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like unified_exec only wraps local environment execs in snapshots. Seems like we might need to figure out whether we want shell snapshots for remote environments but that's a later problem I think

Comment thread codex-rs/core/src/environment_selection.rs Outdated
@anp-oai anp-oai force-pushed the codex/turn-environment-cwd-path-uri branch from bf1245b to 4f6dd50 Compare June 14, 2026 05:27
@anp-oai anp-oai enabled auto-merge (squash) June 14, 2026 05:32
@anp-oai anp-oai disabled auto-merge June 14, 2026 05:40
@anp-oai anp-oai enabled auto-merge (squash) June 14, 2026 06:07
@anp-oai anp-oai merged commit efbd00f into main Jun 14, 2026
31 checks passed
@anp-oai anp-oai deleted the codex/turn-environment-cwd-path-uri branch June 14, 2026 06:07
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants