Skip to content

Conversation

@cpjet64
Copy link
Contributor

@cpjet64 cpjet64 commented Oct 29, 2025

Problem & intent

Before/After

  • Before: helper dir was prepended to PATH.
  • After: helper dir is appended to PATH (Rust arg0 + Node wrapper), preserving user/tool precedence.

Scope of change

  • Files: codex-rs/arg0/src/lib.rs, codex-cli/bin/codex.js
  • No changes in rmcp-client (env passthrough/aliasing removed from this branch).

Security effects

  • None. Only PATH order for a temp helper dir changes; no broadened privileges.

Testing evidence

  • Builds locally; linted with just fmt.
  • No behavior change to network/sandbox; CLI path search order verified manually.

Roll‑back plan

  • Revert this branch; no schema or API impact.

cpjet64 and others added 15 commits October 23, 2025 17:20
Context:
* Address open issues related to PATH/PATHEXT and Windows env propagation.
* Prepending to PATH changed users' tool precedence (e.g., virtualenv). MCP servers on Windows missed critical env vars (COMSPEC, SYSTEMROOT, etc.).

Change:
* Append apply_patch temp dir to PATH instead of prepending (arg0, Node wrapper).
* Expand Windows DEFAULT_ENV_VARS for MCP client to include COMSPEC, SYSTEMROOT, PROGRAMFILES, APPDATA, etc.

Risk:
* Low: only affects PATH ordering (preserved) and adds allowed env passthrough. No privilege broadening.

Tests:
* Existing rmcp-client unit tests pass.

Verification:
* Ran cargo fmt.
* Built and ran tests: `cargo test -p codex-rmcp-client` (all passed). `cargo check -p codex-arg0` OK.
Context:
* Some Windows programs (incl. MCP servers/plugins) read canonical `Path` key.
* Users had to manually set PWSH/POWERSHELL; include when present.

Change:
* In rmcp-client env builder, ensure `Path` mirrors `PATH` on Windows.
* Add PROGRAMW6432, POWERSHELL, PWSH to the default pass-through list.

Risk:
* Low; only adds env keys when available. No privilege expansion.

Tests:
* Added Windows unit test verifying PATH/Path aliasing.

Verification:
* cargo fmt; cargo clippy -p codex-rmcp-client; cargo test -p codex-rmcp-client (all ok).
- Conditionally declare `mut` only on Windows in env builder.
- Remove unnecessary `clone()` flagged by clippy.

Validated with: cargo clippy -p codex-rmcp-client -D warnings.
- On Windows, if only `Path` is provided (extra env/whitelist), ensure `PATH`
  is set to the same value (and vice versa). Avoids HashMap ordering races.

Validated: clippy clean, rmcp-client tests pass.
…tils to upstream\n\nKeep only PATH precedence change in arg0 and Node wrapper; move env var/alias changes out of this branch.
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