Skip to content

fix(sandbox): preserve empty Mountpoint prefixes - #4882

Closed
Hughhhhcoder wants to merge 1 commit into
openai:mainfrom
Hughhhhcoder:codex/openai-agents-python-mountpoint-empty-prefix
Closed

fix(sandbox): preserve empty Mountpoint prefixes#4882
Hughhhhcoder wants to merge 1 commit into
openai:mainfrom
Hughhhhcoder:codex/openai-agents-python-mountpoint-empty-prefix

Conversation

@Hughhhhcoder

Copy link
Copy Markdown
Contributor

Summary

This pull request fixes explicit empty prefixes being replaced by a MountpointMountPattern default for S3 and GCS mounts.

Both provider adapters used a truthiness fallback, so prefix="" behaved like None and unexpectedly mounted the configured default subtree instead of the bucket root. The adapters now use None as the sole inheritance sentinel, preserving explicit empty prefixes while keeping nonempty overrides and existing None behavior unchanged.

The regression test exercises the public Mount.apply path for both providers and verifies the final command omits --prefix for an explicit empty value while still forwarding the pattern default for None.

Test plan

  • uv run --locked pytest tests/sandbox/test_mounts.py::test_mountpoint_prefix_uses_none_as_inheritance_sentinel tests/sandbox/test_mounts.py::test_s3_mount_direct_mountpoint_fields_override_pattern_options -q
  • /usr/bin/env -u OPENAI_API_KEY OPENAI_AGENTS_TEST_IN_CODEX_SANDBOX=1 UV_DEFAULT_INDEX=https://pypi.org/simple PYTEST_XDIST_AUTO_NUM_WORKERS=4 bash .agents/skills/code-change-verification/scripts/run.sh

Issue number

N/A

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T11:34:38.759112Z b22dc70 PR opened
🔒 Security Review Completed 2026-09-05T11:39:14.278738Z b22dc70 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sylvesterkaczmarek sylvesterkaczmarek 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.

Using None as the inheritance sentinel is the right distinction here because an empty prefix has real semantics. I also like that the regression exercises Mount.apply and the final argv for both S3 and GCS rather than only checking the dataclass merge.

One consistency question: region/endpoint still use truthiness-based fallback. That is fine if empty strings are invalid for those fields; if an empty value is ever meant to explicitly clear an inherited setting, they would have the same ambiguity this PR fixes for prefix. For prefix itself, the change looks correct.

@Hughhhhcoder

Copy link
Copy Markdown
Contributor Author

Thanks for raising this. I checked the downstream semantics before keeping the change scoped to prefix: MountpointMountPattern.apply() only emits --region and --endpoint-url for non-empty values, and the provider paths likewise treat an empty endpoint as absent/default rather than as a supported explicit region or URL. An empty prefix is different: it has a concrete meaning (mount the bucket root), so it must be able to suppress an inherited --prefix. If explicit clearing of inherited region/endpoint defaults is desired later, that would need a separate configuration contract rather than treating an invalid empty region or URL as a value.

@seratch

seratch commented Sep 5, 2026

Copy link
Copy Markdown
Member

Thanks for investigating this. The empty-string fallback is real, and the patch implements the proposed distinction. However, bucket-root mounts already work by giving the mount a pattern with options.prefix=None, while retaining its region and endpoint settings.

I would close this PR for now because the report does not establish a concrete workflow where that configuration is insufficient. Changing the fallback also changes released behavior for existing configurations. We can revisit this if there is an application scenario that requires clearing an inherited prefix through the mount entry and cannot reasonably use a separate pattern.

@seratch seratch closed this Sep 5, 2026
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.

3 participants