SIGN IN SIGN UP

fix: restore OpenClaw installation and automatic memory hooks (#2350)

## Description

OpenClaw 2026.9.1/2026.9.2 reject the shell installer’s legacy
`plugins.installs` records. Rebuilding a plugin registry in the gateway
process can also trigger MemOS’s duplicate-runtime guard, leaving
conversation hooks unavailable even though the Viewer and tools work.

This change removes only MemOS-owned legacy install records, detects
supported stop/validation/capability-consent commands in both
installers, and requires actual gateway health for the shell restart
fallback. Plugin CLI help is probed with plugins disabled.

The adapter shares one runtime across full registries and module reloads
while registering hooks in each host registry. Tool discovery borrows
the existing core without owning a server or service. Cross-process
locking remains in place. No dependency or package-version changes.

Related issue: #1873 (runtime-ownership context; this PR addresses
same-process registry rebuilding, not that already-closed doctor issue).

## Type of change

- [x] Bug fix
- [x] Documentation update

## How Has This Been Tested?

- [x] `npm test`: **184 files passed; 1569 passed, 3 skipped**. Added
configuration, gateway recovery, module reload and tool-discovery
regressions.
- [x] `npm run lint` passed.
- [x] Real Windows PowerShell 5.1 harness: **7 scenarios passed**
(`tests/powershell/openclaw-install-compat.ps1`).
- [x] `make format` with pinned Ruff 0.11.8: `All checks passed!`, `624
files left unchanged`.
- [x] Pre-commit checks on all changed files and `git diff --check`
passed.
- [x] Actual macOS host binaries: configuration/startup/authenticated
tool invocation passed on 2026.4.24, 2026.7.1-2, 2026.9.1 and 2026.9.2.
Full installers passed on macOS 2026.9.1 and Windows 2026.9.2.
- [x] Automatic capture and subsequent recall passed on macOS 2026.9.1
and Windows 2026.9.2. Both platforms also passed 2026.7.1-2 tests with
two separate sessions: two SQLite traces, the first turn’s unique code
present in the second model request, and exactly one runtime bootstrap.

See `apps/memos-local-plugin/docs/OPENCLAW-COMPATIBILITY.md` for
reproduction steps and platform-specific results. No Python library code
or API contracts changed.

### Known limitations

- **2026.4.24 macOS:** standard `openclaw agent` preloads the plugin in
a separate CLI process and still hits the runtime lock. Gateway
capture/recall passed only with a client-only plugin-preloading
workaround.
- **2026.4.24 Windows:** two isolated attempts failed gateway readiness;
automatic capture/recall was not reached. Sampling showed synchronous
file work in the old host’s plugin loader.

## Checklist

- [x] Self-reviewed the final changes.
- [x] Commented runtime ownership and host-version compatibility logic.
- [x] Added regression tests proving the relevant fixes.
- [x] Updated documentation in this PR; a separate MemOS-Docs change is
not applicable.
- [x] Linked related issue context without claiming to close an
unrelated issue.
- [x] Mentioned @MLittleprince, a recent local-plugin contributor, for
review.

Maintainer review and GitHub CI results remain pending; the checks above
describe completed local and machine tests.
Z
zhaxi committed
de8069428a9247bfa7a3d35f59a9b39fa8f231d2
Committed by GitHub <noreply@github.com> on 9/8/2026, 8:43:56 AM