Skip to content

app-server: preserve remote environment cwd#28146

Draft
anp-oai wants to merge 10 commits into
mainfrom
codex/app-server-remote-environment-cwd
Draft

app-server: preserve remote environment cwd#28146
anp-oai wants to merge 10 commits into
mainfrom
codex/app-server-remote-environment-cwd

Conversation

@anp-oai

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

Copy link
Copy Markdown
Collaborator

Why

App-server environment selections can target an OS different from the app-server host. Applying host-native path rules at the API boundary rejects or rewrites a Windows cwd before it reaches a Windows exec-server, so a remote turn cannot reliably preserve its selected working directory and shell.

This is stacked on #27819, which provides host-independent path rendering. It is okay for the earlier exec-server cwd fix to remain visible in this diff.

What

  • Carry exec-server and turn-environment cwd values as PathUri until the execution or sandbox boundary.
  • Accept environment-native cwd strings in app-server thread/start and turn/start, infer their absolute path convention, and convert them to PathUri before core selection validation.
  • Use the selected remote environment's shell and cwd for unified exec.
  • Extend the Wine-backed Windows environment test through typed app-server thread/turn requests and a real PowerShell command that verifies C:\windows is the execution cwd.
  • Seed a remote AGENTS.md fixture and pin the thread-start metadata fields that still use host fallback values, with separate follow-up TODOs.

Testing

  • bazel test //codex-rs/core/tests/remote_env_windows:smoke-test --test_output=errors
  • just test -p codex-app-server
  • just test -p codex-app-server-protocol
  • focused codex-core environment-selection tests

@anp-oai anp-oai force-pushed the codex/app-server-remote-environment-cwd branch from 2ea8378 to 0899d52 Compare June 14, 2026 02:08
);
}

#[test]

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.

for human reviewers: this layer can't enforce that absolute paths are required anymore, this is moved to a thread start test

Comment thread codex-rs/app-server/tests/suite/v2/thread_start.rs
Comment thread codex-rs/app-server/README.md Outdated
Comment thread codex-rs/core/src/environment_selection.rs Outdated
Comment thread codex-rs/core/tests/remote_env_windows/remote_env_windows_test.rs
anp-oai added a commit that referenced this pull request Jun 14, 2026
Comment thread codex-rs/core/tests/remote_env_windows/remote_env_windows_test.rs
@anp-oai anp-oai marked this pull request as ready for review June 14, 2026 03:20
@anp-oai anp-oai requested a review from a team as a code owner June 14, 2026 03:20
@anp-oai anp-oai marked this pull request as draft June 14, 2026 03:20
@anp-oai anp-oai removed the request for review from a team June 14, 2026 03:20

@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: 167b3b9a5a

ℹ️ 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/exec-server/src/protocol.rs
let cwd_uri = PathUri::from_abs_path(&cwd);
Self {
) -> std::io::Result<Self> {
let cwd = cwd_uri.to_abs_path()?;

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.

P2 Badge Preserve remote cwd URIs until target-host launch

to_abs_path() parses cwd_uri using the current host's path rules, so a Linux/macOS app-server rejects a Windows UNC URI before it can reach a remote Windows exec-server. That makes the remote exec path non-portable; keep the URI until the target-host launch boundary. guidance

Useful? React with 👍 / 👎.

Comment thread codex-rs/app-server-protocol/Cargo.toml
@anp-oai anp-oai force-pushed the codex/cross-platform-path-rendering branch from 3971173 to b19077b Compare June 14, 2026 05:09
Base automatically changed from codex/cross-platform-path-rendering to main June 14, 2026 05:26
@anp-oai anp-oai force-pushed the codex/app-server-remote-environment-cwd branch from 167b3b9 to 5baa76a Compare June 14, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant