Skip to content

Fix macOS packaging and agent startup in packaged app#34

Merged
DorianZheng merged 4 commits intomainfrom
worktree-agile-questing-robin
Mar 20, 2026
Merged

Fix macOS packaging and agent startup in packaged app#34
DorianZheng merged 4 commits intomainfrom
worktree-agile-questing-robin

Conversation

@DorianZheng
Copy link
Copy Markdown
Collaborator

Summary

  • Fix make package-mac reliability on Apple Silicon: remove hardcoded dual-arch targets from electron-builder.yml so the CLI flag controls which arch is built, add backgroundColor to skip the buggy APFS background.tiff code path in dmg-builder@25.1.8, and add hdiutil cleanup for stale mounts
  • Fix agent-mcp bundling: the extraResources source path was src/agent-mcp (doesn't exist) instead of src/agents/mcp where rpc.py and listener.py actually live
  • Fix DUNE_WS_URL not set in packaged app: getBackendPort() used a .port file path that broke after esbuild bundling; now uses config.port (set via PORT env var from sidecar) as primary source
  • Fix paths.ts dev-mode fallback: getAgentMcpPath() referenced the old wrong path src/agent-mcp

Test plan

  • make package-mac builds successfully (arm64 only, no hdiutil errors)
  • DMG and ZIP produced in .release/
  • rpc.py and listener.py present in Dune.app/Contents/Resources/backend/agent-mcp/
  • Backend tests pass (agent-system-prompt.test.ts)
  • Install DMG and verify agents start without DUNE_WS_URL errors

- 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.
@DorianZheng DorianZheng merged commit 4214c95 into main Mar 20, 2026
1 check failed
@DorianZheng DorianZheng deleted the worktree-agile-questing-robin branch March 20, 2026 19:26
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