Skip to content

fix(desktop): start the app from Finder, with the installation's Bun on its PATH - #881

Open
dustywusty wants to merge 1 commit into
mainfrom
dustywusty/desktop-app-bun-on-path
Open

dustywusty wants to merge 1 commit into
mainfrom
dustywusty/desktop-app-bun-on-path

Conversation

@dustywusty

Copy link
Copy Markdown
Collaborator

What this changes

Opened from Finder or the Dock, the desktop app stops at Start with "OpenBot did not start". The technical details say:

app stopped straight away (exit status: 127). Last from app.log:
$ bun scripts/serve-or-build.ts && bun serve.ts
/bin/bash: bun: command not found
error: script "serve" exited with code 127

Every process the desktop starts now gets the directory of the Bun it installed first on its PATH (stack::bun_command, used by spawn_host_process). The rest of PATH is kept after it.

Root cause

  • How: the desktop starts the server, worker and browser by running its own Bun on a file (openbot-engine/bun-1.4.3/bun src/index.ts). It starts the app differently: bun run serve, a package script. That script is bun scripts/serve-or-build.ts && bun serve.ts, which runs bun again by name through the shell. The child inherits the desktop's PATH. An app opened from Finder has macOS's minimal /usr/bin:/bin:/usr/sbin:/sbin, which has no bun. So only the app died, with 127.
  • Where it entered:
  • Evidence: reproduced with a desktop build opened with open, on a Mac whose bun is a mise shim (not on the system PATH). The app log is quoted above. The server and worker started; only the app failed.
  • Why it went undetected:
    • Desktop runs during development are tauri dev from a terminal, and that PATH has the developer's bun.
    • The host-process tests compile a fixture bun and pass a test PATH. None starts the real serve script with the minimal PATH an app gets from Finder.
  • How this prevents recurrence: a_host_process_finds_the_installations_own_bun_by_name checks that a host process's PATH starts with the installation's Bun directory and keeps the rest. With the PATH line removed, it fails (a host process is given a PATH).

Not affected: #832's branch, where #852 replaced the host processes with containers.

Where it runs

  • New state that outlives a request? None. Desktop only; the environment of a spawned process.
  • What happens on the second replica? Not applicable.
  • Anything serialised? No.
  • Anything fanned out to a browser? No.
  • New listener, port, or schedule? No.

Boundary and audit

  • Unchanged; no server code touched.

Changelog

  • A line in CHANGELOG.md under Unreleased ("The desktop app starts OpenBot when it is opened from Finder").

Proof

  • The new test fails without the change and passes with it.
  • From desktop/src-tauri: cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings and cargo test --locked --lib --bins pass on macOS arm64. Windows and Linux left to CI.
  • The same change in a local desktop build, opened from Finder: see the comment below once checked.

…on its PATH

The app runs as a package script (`bun run serve`), and that script runs `bun` again by name. A
desktop app opened from Finder or the Dock has the system's minimal PATH, which has no `bun`, so
the app exited with status 127 at Start ("bun: command not found"). The server and worker run Bun
on a file and were unaffected.

Every host process now gets the directory of the Bun this installation downloaded first on its
PATH, with the rest of PATH kept after it (`stack::bun_command`).
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-29T08:55:38.249391Z 3058e82 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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