fix(openclaw): record correct installPath for native-package installs / Mac homebrew (v4.12.7)#39
Merged
FRIDAY-Drakon merged 1 commit intomainfrom Apr 25, 2026
Conversation
β¦ (Mac homebrew) False-positive doctor "orphans" on every Mac install since v4.12.3. Reproduced on Friday/mikes-mac on every release v4.12.3 β v4.12.6. Root cause: installPlugin()'s native-package code path (the one that fires when npm-global lives in OpenClaw's search path β i.e. /opt/homebrew/lib/node_modules on Mac) recorded the WRONG installPath in openclaw.json: path.dirname(path.dirname(globalPluginPath)) β package root (wrong) path.dirname(globalPluginPath) β dist dir (right) The trusted-local-copy code path used the correct convention; only native-package was off. detectInstallState() checked `installPath/openclaw.plugin.json`, found nothing (manifest is in dist/), and returned pluginInstalled=false β false-positive orphans. Fix: - src/setup/openclaw.ts: native-package branch now passes `pluginDir = path.dirname(globalPluginPath)` to trustLocalPlugin. Matches the convention used by every other code path. Same value is logged to the user as is recorded in config. - src/setup/deep-clean.ts: detectInstallState now also checks `installPath/dist/openclaw.plugin.json` as a fallback β fleet hosts with the bad installPath stop false-flagging on next doctor run, even before they re-install. 4 new tests (1 in deep-clean, 3 in new openclaw-install-path file). 54/54 release-track tests green. Bumps to v4.12.7 across root pkg, plugin pkg, plugin manifest, lockfile. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Closes the v4.12.3βv4.12.6 Mac regression. Reproduced on Friday/mikes-mac on every release: `shieldcortex install` succeeded, plugin landed on disk, hooks installed, but `shieldcortex doctor` kept flagging `.plugins.installs/entries/allow["shieldcortex-realtime"]` as orphans. Linux fleet hosts never hit it.
Root cause
`installPlugin()`'s native-package code path (the one that fires when npm-global lives in OpenClaw's search path β `/opt/homebrew/lib/node_modules` on Mac) recorded the WRONG `installPath` in `openclaw.json`:
```text
path.dirname(path.dirname(globalPluginPath)) β package root (wrong)
path.dirname(globalPluginPath) β dist dir (right β manifest's parent)
```
The `trusted-local-copy` code path used the correct convention; only native-package was off. `detectInstallState()` checked `installPath/openclaw.plugin.json`, found nothing (manifest is in `dist/`), and returned `pluginInstalled = false` β false-positive orphans every time.
Fix
Tests
54/54 release-track tests green.
Verification on Mac after upgrade
```bash
npm install -g shieldcortex@4.12.7
shieldcortex openclaw install
shieldcortex doctor # should show "OpenClaw residue: clean (plugin + hook installed, config aligned)"
```
The defensive `installPath/dist` fallback means the doctor will report clean immediately after upgrading, without needing to re-run `openclaw install` first.
π€ Generated with Claude Code