Skip to content

Packaged Nightly plugin processes lose PATH for node and gh #2343

Closed

Description

@pixexid

Problem

A packaged macOS bb Nightly launched from the GUI can inherit a restricted PATH:

/usr/bin:/bin:/usr/sbin:/sbin

The server and plugin children then cannot resolve ordinary user-installed tools. In the affected case, a plugin-spawned Nightly CLI reports env: node: No such file or directory, and gh cannot be resolved. The same tools resolve from an interactive agent shell.

This leaves queue readers and Companion blind while the interactive shell still appears healthy.

Reproduction

  1. Launch the packaged Nightly from the GUI rather than an interactive terminal.
  2. Use a plugin path that spawns the bundled CLI and an external node or gh child.
  3. Observe the missing-command failures.
  4. Run the equivalent command from an interactive shell and observe that both tools resolve.

Expected behavior

Packaged GUI/server/plugin processes should receive a deterministic, usable user-tool PATH, or should use explicit validated executable paths. If a required executable is unavailable, the affected reader should report a visible degraded state rather than silently appearing healthy.

Implementation clue

The desktop source already probes a login shell for packaged macOS launches and falls back to the inherited environment on failure or timeout. The plugin child inherits the server environment. Please make PATH propagation deterministic and add a regression test covering the packaged-child environment and the missing-executable/degraded-state path. Preserve fail-closed behavior; do not make command discovery depend on a shell watcher.

Related historical reports include #1545 and #1388, but neither covers this packaged-Nightly plugin/Companion failure.

AGENT GENERATED

Stable/Nightly bundle comparison

Static extraction from installed stable 0.39.0 and Nightly 0.39.1-nightly.32633481796.1 rules out a Nightly build-target omission:

  • both app.asar bundles call ensurePackagedUserShellPath(...) unconditionally at the start of runDesktopApp();
  • the call sites are byte-identical;
  • the complete desktop-shell-path implementations are byte-identical (SHA-256 fe1bab92b8032da3f978c217e3c54fbcfb2bca7e98ee030f21975c1c889e949b);
  • the only gates are platform (darwin or linux) and app.isPackaged;
  • on macOS the implementation runs /bin/zsh -ilc 'printf "%s" "$PATH"' with a 2,000 ms timeout, then preserves the inherited PATH on any error, signal, nonzero status, or empty output.

Both app bundles pass codesign --verify --deep --strict; this is not a missing or invalid app signature.

A no-restart reproduction using each app's signed Electron executable in Node mode, with the same restricted inherited PATH, returns the same result for stable and Nightly:

  • spawnSync /bin/zsh ETIMEDOUT
  • status 13
  • empty stdout

The equivalent login-shell command outside that Electron path completes and resolves both node and gh. The running Nightly desktop, bridge, server, and host daemon therefore retain /usr/bin:/bin:/usr/sbin:/sbin because the packaged shell probe times out and takes its fallback path.

This narrows the defect to runtime PATH acquisition, not build-target gating. The packaged path repair needs a deterministic method that does not discard a valid user PATH merely because interactive shell startup exceeds two seconds (for example, a larger/tested bound or a non-interactive shell-environment resolver), with regression coverage for timeout fallback and child inheritance.

Activity

  1. added theissue type on Aug 25, 2026
  2. added
    desktop
    host
    on Aug 25, 2026
  3. SawyerHood commented on Aug 27, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2343.html

    • Verdict: PARTIALLY REPRODUCED · root-cause confidence: medium
    • Root cause (short): The shared probe can time out after shell exit when a child holds its pipe, then discard valid PATH data.
    • Proposed fix: Use an asynchronous probe with marked output. Stop on shell exit after a short pipe-drain limit. Accept complete marked output. Add a no-output fallback. Merge user and system path entries. Show a degraded state. Add real-process and macOS tests.
    • Caveats: This Linux host could not run the signed macOS Nightly through the Dock. The test proves a shared code failure only. It does not prove the reported macOS cause. origin/main is newer, but the affected files did not change. No open pull request links to the issue. Closed PR fix(desktop): load the packaged shell PATH deterministically #2415 did not merge.

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at the base commit, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by GPT-5.6-Sol

  4. added
    partial-repro
    on Aug 27, 2026
  5. ymichael commented on Nov 17, 2026

    @ymichael
    Collaborator

    Fixed by #6194: there's now one shared PATH resolver with fallback directories, and it probes again when a command is missing. The remaining .zshrc timeout case is tracked in #6586. Closing.

    AGENT GENERATED

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

    desktophostpartial-repro

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions