Expand ~ in MDM workspace write roots#15351
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/core/src/config/service.rs
Line 618 in 42d1050
read() now accepts MDM ~/... paths via deserialize_merged_config_toml, but apply_edits() still runs validate_config(), which deserializes with plain try_into() and no AbsolutePathBufGuard. That makes behavior inconsistent: the same managed config can be read successfully, then any write fails with ConfigValidationError (e.g. AbsolutePathBuf deserialized without a base path).
ℹ️ 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".
|
@codex address that feedback |
Summary
Testing
Committed on the current branch and created a follow-up PR message with |
ee06025 to
2cf2738
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75947d8963
ℹ️ 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".
|
Addressing the earlier Codex review note about
So managed |
ddfc21a to
0b61e45
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
rreichel3-oai
left a comment
There was a problem hiding this comment.
Few open questions! Looks like the actual logic is functional
| }) | ||
| .await?; | ||
|
|
||
| let mut saw_patch_begin = false; |
There was a problem hiding this comment.
What are these changes actually testing with this PR? These seem unnecessary?
There was a problem hiding this comment.
These are changes that are needed for CI related to Mac changes to go green. The x86 macOS Bazel failure is stalling because shell_snapshot.rs submits the turn with approval_policy: AskForApproval::Never, but the test process is running under managed config that only allows OnRequest. The turn gets rejected up front in the session settings path in codex.rs line 2319, emits an Error event, and never reaches the shell tool or intercepted apply_patch path. The test then keeps waiting for TurnComplete or patch events until its timeout, which makes it look like a slow shell snapshot problem :(
| "once_cell", | ||
| "rustix 1.1.3", | ||
| "windows-sys 0.61.2", | ||
| "windows-sys 0.52.0", |
There was a problem hiding this comment.
Why are we downgrading Windows versions here?
There was a problem hiding this comment.
Removed from this PR. That lockfile churn came from an unrelated tar bump and re resolution, not from the MDM path fix itself, so I dropped it while narrowing the branch back to the bug fix only.
176fc97 to
0b61e45
Compare
efd250f to
e6923b1
Compare
Co-authored-by: Michael Bolin <bolinfest@gmail.com>
e6923b1 to
d806b22
Compare
| )); | ||
| } | ||
| if let Some(config) = managed_config_from_mdm { | ||
| let managed_config = |
There was a problem hiding this comment.
Hmm, I'm debating whether we should do this or bring back your alternative path guard that honors ~ but not ./.
This is certainly simpler.
I don't know if there's a valid use case to specify a relative path in an MDM config. In the worst case, it could be an attack vector, but because MDM should be set by a trusted person, I guess I'm not that worried about that.
Maybe please just add a comment that we use codex_home as the base so that ~ and ./ are honored using our AbsolutePathBufGuard logic, though in practice, we expect ~ to be used but not ./.
There was a problem hiding this comment.
Sounds good. Following up with a comment.
Summary
writable_roots = ["~/code"]expands the same way as file backed configconfig_loader; the current net diff is onlyconfig_loader/mod.rsplus focused regression tests inconfig_loader/tests.rsandconfig/service_tests.rsresolve_relative_paths_in_config_toml(...)is already used in several existing configuration paths, including CLI overrides, file-backed managed config, normal config-file loading, project.codex/config.tomlloading, and role config loadingValidation
cargo fmt --all --checkcargo test -p codex-core managed_preferences_expand_home_directory_in_workspace_write_roots -- --nocapturecargo test -p codex-core write_value_succeeds_when_managed_preferences_expand_home_directory_paths -- --nocapture