Skip to content

[Bug] Windows Desktop terminal command reports machine-path-conflict when new terminals already select the Desktop ocx #6854

Closed

Description

@lidge-jun

Client or integration

Other

Area

Platform (Windows / macOS / Linux)

Summary

On Windows the Desktop terminal command (#6816) reports phase: partial with machine-path-conflict when the Machine Path contains a directory with ocx.cmd, even when new terminals actually select the Desktop's ocx.exe first. machine_conflict() (desktop/src-tauri/src/cli_command_windows.rs:805-846) expands each Machine Path entry with ExpandEnvironmentStringsW inside the Desktop process, whose environment already has every variable resolved. Windows builds a new logon environment differently: on the affected machine the Machine Path is REG_EXPAND_SZ and contains %NVM_HOME%;%NVM_SYMLINK% (nvm-windows), and fresh processes keep those two entries literal, so nvm4w's ocx.cmd only arrives through the User Path — after the Desktop's entry. The CLI page therefore shows a conflict that does not exist, and a user may "fix" a working setup.

Reproduction

  1. Windows 11 with nvm-windows: Machine Path (REG_EXPAND_SZ) contains %NVM_HOME%;%NVM_SYMLINK%, both defined as machine variables; C:\nvm4w\nodejs holds an npm-installed ocx.cmd; the User Path also lists C:\nvm4w\nodejs.
  2. Run the Desktop's terminal-command reconcile for an eligible install (reproduced at module level: perform_selected with Action::Reconcile from an interactive scheduled task in session 1, against a staged copy of the installed opencodex-desktop.exe and ocx.exe).
  3. Status: {"enabled":true,"configured":false,"phase":"partial","issues":["machine-path-conflict"]}; HKCU Path now starts with the Desktop directory, REG_EXPAND_SZ kept, notifyPending:false.
  4. Open a new Windows Terminal tab with --reloadEnvironment, an Explorer-launched cmd, or a Task Scheduler cmd, and run where ocx: the Desktop's ocx.exe is listed first, ahead of C:\nvm4w\nodejs\ocx and ocx.cmd; echo %PATH% shows %NVM_HOME%;%NVM_SYMLINK% literal in the Machine part.

Version

dev d17a9f2 (2.82.0); installed Desktop 2.77.0

Operating system

Windows 11 Pro build 26200, x64

Provider and model

Not provider-specific

Logs or error output

PLAN {"changeKinds":["registry-expand"],"issues":["machine-path-conflict"], ...}
new Terminal tab, after the write:
PATH=C:\WINDOWS\system32;...;%NVM_HOME%;%NVM_SYMLINK%;...;C:\Users\<user>\ocx-probe-desktop;...;C:\nvm4w\nodejs;...
where ocx:
C:\Users\<user>\ocx-probe-desktop\ocx.exe
C:\nvm4w\nodejs\ocx
C:\nvm4w\nodejs\ocx.cmd

Screenshots and supporting files

Probe record: devlog/_plan/261010_cli_path_crossos_probe/029_wp3_outcome.md (rows W3-W5). Direction to evaluate: decide the conflict from the PATH a fresh logon process would get (for example CreateEnvironmentBlock for the current token with bInherit = FALSE, then the first directory holding ocx.{exe,com,cmd,bat}), and check that choice against real new-terminal results before adopting it. An entry that stays unexpanded in that block cannot shadow the Desktop.

Redacted configuration

Not applicable (no OpenCodex configuration involved).

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    on Oct 9, 2026
  2. added
    cli
    platform
    on Oct 9, 2026
  3. lidge-jun commented on Oct 10, 2026

    @lidge-jun
    OwnerAuthor

    Fixed on dev by #6888 (squash 84b9e88286). The Desktop terminal command now evaluates machine-path-conflict against a fresh-logon PATH built with CreateEnvironmentBlock, after the HKCU PATH commit. It only reports a conflict when a competing ocx actually comes before the Desktop one. On Windows build 26200 the fix passed clippy with -D warnings and cargo test cli_command 30/30, and a fresh-logon probe confirmed the PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcliplatform

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions