Fix macOS packaging and agent startup in packaged app#34
Merged
DorianZheng merged 4 commits intomainfrom Mar 20, 2026
Merged
Conversation
- Remove hardcoded arch arrays from electron-builder.yml so the CLI flag (--arm64/--x64) controls which architecture is built - Add dmg.backgroundColor to skip the buggy background.tiff code path in dmg-builder@25.1.8 on APFS volumes - Add hdiutil detach cleanup in Makefile for stale mounts from previous failed builds
The source path was ../backend/src/agent-mcp which doesn't exist. The actual MCP Python files (rpc.py, listener.py) are at ../backend/src/agents/mcp. This caused the packaged app to fail when starting agents.
getBackendPort() used join(__dirname, '../../.port') which assumed the unbundled source layout (src/agents/). After esbuild bundles into dist/index.js, __dirname is dist/ so the path resolved one level too high. Fix by using config.port (set via PORT env var from the sidecar) as the primary source, falling back to the .port file with the correct relative path for dev mode. Also fix the test that expected the old wrong agent-mcp path.
The dev-mode fallback pointed to src/agent-mcp which doesn't exist. The actual MCP Python files are at src/agents/mcp, matching config.ts and electron-builder.yml.
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
make package-macreliability on Apple Silicon: remove hardcoded dual-arch targets from electron-builder.yml so the CLI flag controls which arch is built, addbackgroundColorto skip the buggy APFS background.tiff code path in dmg-builder@25.1.8, and add hdiutil cleanup for stale mountssrc/agent-mcp(doesn't exist) instead ofsrc/agents/mcpwhererpc.pyandlistener.pyactually livegetBackendPort()used a.portfile path that broke after esbuild bundling; now usesconfig.port(set via PORT env var from sidecar) as primary sourcegetAgentMcpPath()referenced the old wrong pathsrc/agent-mcpTest plan
make package-macbuilds successfully (arm64 only, no hdiutil errors).release/rpc.pyandlistener.pypresent inDune.app/Contents/Resources/backend/agent-mcp/agent-system-prompt.test.ts)