Skip to content

unified-exec: preserve PathUri through exec-server#28681

Merged
anp-oai merged 10 commits into
mainfrom
codex/unified-exec-path-uri
Jun 17, 2026
Merged

unified-exec: preserve PathUri through exec-server#28681
anp-oai merged 10 commits into
mainfrom
codex/unified-exec-path-uri

Conversation

@anp-oai

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

Copy link
Copy Markdown
Contributor

Why

It should be possible for app-server to handle "foreign" OS paths in unified_exec working directories, allowing e.g. a Linux app-server to run processes on e.g. a Windows exec-server.

What

Convert the core unified_exec cwd values to use PathUri.

Adds fallible path conversion in several places to try to minimize the scope of this change. The only time this change suppresses errors from converting PathUri to an AbsolutePathBuf is when the turn is configured with no sandboxing at all to allow us to make progress testing without sandboxing.

Future changes to apply_patch and sandboxing will clean up these error paths.

A tool's cwd is resolved from joining a model-provided workdir to the environment's cwd. When using AbsolutePathBuf::join(), an absolute-path workdir would overwrite the environment's cwd and we would resolve permissions/sandboxing against the model-provided path. This change extends PathUri::join() to also treat an absolute rhs as an override of the base/lhs.

This also removes some coverage from the remove_env_windows tests until a follow-up converts foreign paths in command exec events correctly.

Breaking Changes

When using AbsolutePathBuf::join() for workdir resolution, we ended up resolving tilde-prefixed paths against the app-server's $HOME, e.g. ~/foo/bar becomes /home/anp/foo/bar. It's difficult to do this with PathUri joining, so after offline discussion this PR no longer implements it.

A quick check of some power users' rollouts suggests that models don't actually generate home-prefixed absolute working directories for their spawns, so this shouldn't have any real blast radius.

anp-oai added a commit that referenced this pull request Jun 17, 2026
@anp-oai
anp-oai marked this pull request as ready for review June 17, 2026 08:22
@anp-oai
anp-oai requested a review from a team as a code owner June 17, 2026 08:22
@anp-oai

anp-oai commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 086d92fa4a

ℹ️ 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/tools/events.rs
Comment thread codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs Outdated
Comment thread codex-rs/app-server/src/request_processors/thread_processor.rs
Comment thread codex-rs/core/src/tools/runtimes/unified_exec.rs
@anp-oai
anp-oai force-pushed the codex/unified-exec-path-uri branch from 18f241d to 0a89eef Compare June 17, 2026 17:23
Comment thread codex-rs/protocol/src/error.rs Outdated
Comment thread codex-rs/utils/path-uri/src/lib.rs
Comment thread codex-rs/utils/path-uri/src/lib.rs

loop {
if matches!(
wait_for_event(&test.codex, |_| true).await,

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.

uber nit: wait_for_event is already waiting internally

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah, right, thanks

@anp-oai
anp-oai force-pushed the codex/unified-exec-path-uri branch from e59c3f7 to f41fce8 Compare June 17, 2026 18:16
@anp-oai
anp-oai force-pushed the codex/unified-exec-path-uri branch from f41fce8 to 198d4b3 Compare June 17, 2026 19:17
@anp-oai
anp-oai enabled auto-merge (squash) June 17, 2026 19:17
@anp-oai
anp-oai merged commit 5867b52 into main Jun 17, 2026
31 checks passed
@anp-oai
anp-oai deleted the codex/unified-exec-path-uri branch June 17, 2026 19:36
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 17, 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