Fix #1873: fix: openclaw doctor reports DuplicateOpenClawRuntimeError (false positive)#1874
Open
Memtensor-AI wants to merge 1 commit into
Open
Fix #1873: fix: openclaw doctor reports DuplicateOpenClawRuntimeError (false positive)#1874Memtensor-AI wants to merge 1 commit into
Memtensor-AI wants to merge 1 commit into
Conversation
…rror Add diagnostic mode detection to skip runtime lock acquisition when openclaw doctor is running alongside the gateway. Changes: - Add skipLock parameter to AcquireOpenClawRuntimeLockOptions - Modify acquireOpenClawRuntimeLock to return no-op lock when skipLock=true - Add isDiagnosticMode() helper checking OPENCLAW_DIAGNOSTIC_MODE env var and process args - Update register() to detect diagnostic mode and skip lock acquisition - Add unit tests for diagnostic mode skipLock behavior - Add integration test verifying doctor can run alongside gateway Fixes #1873
5 tasks
Collaborator
Author
|
Collaborator
Author
✅ Automated Test Results: PASSEDAll tests passed (35/-542 executed, 613 skipped). memos_local_plugin/smoke: 0 passed, 578 skipped, memos_local_plugin/contract: 35 passed, 35 skipped. Duration: 4s Branch: |
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.
Description
Summary
Successfully fixed the false positive
DuplicateOpenClawRuntimeErrorreported byopenclaw doctorwhen the OpenClaw gateway is running with memos-local-plugin.Root Cause
The runtime lock mechanism in
apps/memos-local-plugin/adapters/openclaw/runtime-lock.tswas designed to prevent duplicate OpenClaw gateway instances from running simultaneously. However, it didn't distinguish between:openclaw doctordiagnostic process (should be allowed)When
openclaw doctortried to load the plugin while the gateway was running, it attempted to acquire the same runtime lock and was blocked with a false positive error.Solution Implemented
Added diagnostic mode detection that allows read-only processes like
openclaw doctorto skip runtime lock acquisition:Runtime Lock Enhancement: Added
skipLock?: booleanparameter toAcquireOpenClawRuntimeLockOptions. When true,acquireOpenClawRuntimeLock()returns a no-op lock handle that doesn't create lock files or block.Diagnostic Mode Detection: Added
isDiagnosticMode()helper function that detects diagnostic processes via:OPENCLAW_DIAGNOSTIC_MODEenvironment variable (set to "1" or "true")Plugin Registration Update: Modified the
register()function to detect diagnostic mode and passskipLock: trueto lock acquisition, with appropriate logging.Changes Made
Modified Files:
apps/memos-local-plugin/adapters/openclaw/runtime-lock.ts: Added skipLock parameter and no-op lock handlingapps/memos-local-plugin/adapters/openclaw/index.ts: Added diagnostic mode detection and integrationapps/memos-local-plugin/tests/unit/adapters/openclaw-runtime-lock.test.ts: Added unit tests for skipLock behaviorapps/memos-local-plugin/tests/integration/diagnostic-mode.test.ts: New integration test verifying doctor can run alongside gatewayTest Coverage:
Verification
The fix is backward compatible and maintains all existing security properties:
Usage
Users can now run
openclaw doctorwhile the gateway is active. The diagnostic process will automatically detect it's running in diagnostic mode and skip lock acquisition. Alternatively, users can explicitly setOPENCLAW_DIAGNOSTIC_MODE=1to force diagnostic mode.Related Issue (Required): Fixes #1873
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Executor did not report tests.
Checklist
@MatthewZhuang, @CarltonXiang, @syzsunshine219 please review this PR.
Reviewer Checklist