🐛 fix(ipc): resolve socket path mismatch for CLI inside .app bundle#52
Merged
vaayne merged 1 commit intovaayne:mainfrom Apr 12, 2026
Merged
🐛 fix(ipc): resolve socket path mismatch for CLI inside .app bundle#52vaayne merged 1 commit intovaayne:mainfrom
vaayne merged 1 commit intovaayne:mainfrom
Conversation
The mori CLI binary lives at Contents/MacOS/bin/mori inside Mori.app.
For this secondary executable, Bundle.main.bundlePath returns the
directory (Contents/MacOS/bin/), not the .app bundle root — so the
old hasSuffix(".app") check failed and the CLI looked for the
socket at ~/Library/Application Support/Mori-Dev/mori.sock instead
of ~/Library/Application Support/Mori/mori.sock.
Fix MoriPaths.isBundledApp to walk up the executable's resolved path
looking for a .app ancestor, correctly identifying both the main app
and any CLI tools shipped inside the bundle. Adds 14 test assertions
covering bundle detection, build-directory exclusion, and env overrides.
vaayne
approved these changes
Apr 12, 2026
Owner
vaayne
left a comment
There was a problem hiding this comment.
Looks good. I verified the bundle-path root cause, checked the updated MoriPaths detection logic, and ran mise run test:ipc locally. The fix correctly handles secondary executables inside Mori.app while preserving dev-build exclusion behavior.
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.
Fix:
moriCLI IPC socket path mismatchProblem
The
moriCLI could not communicate with the running Mori.app. Commands likemori project listfailed with:The IPC server was healthy (direct socket connection worked), but the CLI was looking for the socket in the wrong directory.
Root Cause
MoriPaths.isBundledApprelied onBundle.main.bundlePath.hasSuffix(".app")to decide whether to use the production directory (~/Library/Application Support/Mori/) or the dev directory (~/Library/Application Support/Mori-Dev/).This works for the main app executable (
/Applications/Mori.app/Contents/MacOS/Mori), whereBundle.main.bundlePathcorrectly returns/Applications/Mori.app. But for themoriCLI binary at/Applications/Mori.app/Contents/MacOS/bin/mori, macOS setsBundle.main.bundlePathto the directory containing the executable (.../Contents/MacOS/bin/), not the.appbundle root. Since that path does not end with.app,isBundledAppreturnedfalse, and the CLI resolved the socket to~/Library/Application Support/Mori-Dev/mori.sock— which does not exist.Fix
Restructured
isBundledAppto also walk up the executable path (with symlinks resolved) looking for a.appancestor directory. This correctly identifies both the main app and secondary executables (like the CLI) shipped inside the bundle, while still excluding dev builds in.build,.build-cli, andDerivedData.Changes
MoriIPC/MoriPaths.swift— RewroteisBundledAppto check executable path ancestors in addition toBundle.main.bundlePath. ExtractedisInAppBundle(_:)andisInBuildDirectory(_:)as internal helpers.MoriIPCTests/main.swift— Added 14 assertions coveringisInAppBundle,isInBuildDirectory, env-var overrides, and the bug scenario (CLI atContents/MacOS/bin/mori).Testing