Skip to content

fix(sandbox): keep model paths POSIX-normalized - #4416

Merged
seratch merged 6 commits into
openai:mainfrom
sylvesterkaczmarek:fix/sandbox-posix-path-normalization
Aug 15, 2026
Merged

seratch merged 6 commits into
openai:mainfrom
sylvesterkaczmarek:fix/sandbox-posix-path-normalization

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

Summary

Keep sandbox tool path handling independent of the SDK host operating system.

exec_command and view_image currently convert model-provided path strings through the host-native pathlib.Path before sandbox normalization. On POSIX hosts, a path such as src\\project remains a literal backslash-containing filename; on Windows the same input is interpreted as path separators. That conflicts with the sandbox path layer, which deliberately normalizes sandbox paths using POSIX semantics regardless of host OS.

This change passes the original strings directly into the existing sandbox path policy. The policy then performs the established backslash-to-POSIX normalization consistently for shell workdirs and image paths.

No public API or accepted path scope changes.

Test plan

Added focused regression tests asserting that:

  • exec_command(workdir="src\\project") resolves to /workspace/src/project
  • view_image(path="images\\plot.png") reads /workspace/images/plot.png

The full repository verification is left to CI because this environment cannot materialize the repository dependencies locally.

Issue number

None. Found while auditing sandbox path handling around #4401.

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

Pass raw model path strings into sandbox path normalization instead of first converting them through the host-native pathlib.Path. This keeps backslash-containing workdirs and image paths deterministic across host operating systems.

Add focused regression coverage for shell and view_image path handling.

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

Copy link
Copy Markdown

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: 361e7276ed

ℹ️ 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".

@seratch seratch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the focused fix. The view_image change looks correct, but the shell workdir fix does not yet cover UnixLocalSandboxSession.

UnixLocalSandboxSession.normalize_path() uses resolve_symlinks=True, and that branch reconstructs a native Path from the raw string. On POSIX, src\project therefore remains a literal backslash-containing path instead of resolving to src/project. The new shell regression test only uses scripted_sandbox_session, whose normalization path behaves differently.

Please normalize the model-provided workdir as a POSIX sandbox path before Unix-local host resolution, and add a regression test using UnixLocalSandboxSession that proves workdir=r"src\project" resolves beneath src/project. The view_image coverage can remain as-is.

@seratch seratch added this to the 0.21.x milestone Aug 15, 2026
@seratch
seratch enabled auto-merge (squash) August 15, 2026 00:27

@seratch seratch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you resolve the conflicts with your other PR?

Copy link
Copy Markdown
Contributor Author

Addressed the requested Unix-local path normalization in the latest commit and added the UnixLocalSandboxSession regression coverage. The review thread is resolved; ready for re-review.

@seratch

seratch commented Aug 15, 2026

Copy link
Copy Markdown
Member

@sylvesterkaczmarek the changes are fine now; I am asking to resolve the conflicts

auto-merge was automatically disabled August 15, 2026 08:53

Head branch was pushed to by a user without write access

Copy link
Copy Markdown
Contributor Author

Conflicts are resolved against current main. The PR is now reduced to the intended shell workdir POSIX normalization plus focused regression tests.

@seratch
seratch enabled auto-merge (squash) August 15, 2026 08:59
@seratch
seratch merged commit 9aba900 into openai:main Aug 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants