Skip to content

Packaged app can detect Codex in nvm/fnm, but child-process PATH omits version manager bins #561

@brownmike

Description

@brownmike

Problem

In the packaged macOS/Linux app, Maestro can detect Node-backed CLIs like Codex from Node version manager installs (nvm, fnm, etc.), but still fail to launch them at runtime.

A common failure looks like this:

  • Maestro detects codex successfully
  • Launching a Codex session exits immediately
  • Stderr shows: env: node: No such file or directory

Reproduction

  1. Install codex under a Node version manager path such as ~/.nvm/.../bin/codex
  2. Launch the packaged Maestro app (not npm run dev)
  3. Start a Codex agent session

Expected

If agent detection finds codex, the spawned process environment should also contain the corresponding Node bin directory so the wrapper script can resolve node.

Actual

The packaged app’s spawn environment did not include detected version manager bin directories, so codex could be found but its internal node lookup failed.

Root Cause

There was a mismatch between:

  • agent detection, which probes version manager locations directly
  • child-process PATH expansion, which previously omitted those detected version manager bin directories

There was also a precedence issue when prepending PATH entries: earlier entries could be reversed unintentionally, so nvm/current/bin would not reliably stay ahead of versioned installs.

Impact

This affects packaged-app launches for Node-backed tools installed outside the default GUI PATH, especially on macOS where GUI apps do not inherit shell PATH reliably.

Fix

  • Include detected Node version manager bin directories in the shared expanded PATH
  • Preserve intended PATH precedence when prepending entries
  • Add regression tests for both:
    • the shared PATH builder
    • the child-process environment builder

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions