fix: resolve PATH and health check issues for macOS GUI environment#36
Open
JoyaWang wants to merge 1 commit intomtymek:mainfrom
Open
fix: resolve PATH and health check issues for macOS GUI environment#36JoyaWang wants to merge 1 commit intomtymek:mainfrom
JoyaWang wants to merge 1 commit intomtymek:mainfrom
Conversation
macOS GUI apps (Obsidian/Electron) inherit a minimal PATH
(/usr/bin:/bin:/usr/sbin:/sbin) that doesn't include Homebrew, nvm,
bun, etc. Since the opencode script uses `#!/usr/bin/env node`,
spawning it from Obsidian fails with exit code 127 (node not found).
Changes:
- Build enhanced PATH for child processes by reusing the search
directories already defined in ExecutableResolver
- Fix health check URL to use /global/health (without base64 project
path prefix which hits the SPA catch-all and returns HTML)
- Validate health response JSON (check data.healthy === true)
- Replace btoa() with Buffer.from().toString("base64") to support
non-Latin1 characters in project paths (fixes mtymek#28)
- Increase default startupTimeout from 15s to 120s since first boot
may need 30-60s for DB migration and plugin installation
Closes mtymek#28, closes mtymek#29
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/usr/bin:/bin:/usr/sbin:/sbin) that doesn't include Homebrew, nvm, bun, etc. Since the opencode script uses#!/usr/bin/env node, spawning it fails becausenodeis not found. This PR builds an enhanced PATH by reusing the search directories fromExecutableResolver.checkServerHealth()was hitting/{base64path}/global/healthwhich is caught by the SPA router and returns HTML (not the health JSON). Changed to use/global/healthdirectly and validatedata.healthy === true.btoa()crash with non-Latin1 paths (fixes Bug: InvalidCharacterError in getUrl when using non-Latin1 characters (e.g., Chinese) #28): Replacebtoa()withBuffer.from().toString("base64")to support Chinese/Unicode characters in project paths.Closes #28, closes #29
Test plan
[OpenCode]logs~/笔记/) — should not crash/opt/homebrew/bin/opencode)🤖 Generated with Claude Code