Repository navigation
fix(cli): guard local plugin state writes at command boundaries - #168757
Merged
Merged
Conversation
Keep existing Gateway lifecycle routes and require offline state ownership for local plugin and hook mutations, updates, registry repair, and marketplace snapshot writes.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here. Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update. Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it. |
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 11, 2026
…claw#168757) Guard local plugin install and hook fallback, uninstall, enable/disable, registry repair, updates, marketplace snapshot writes, and hook configuration writes with the existing local-state owner. Preserve existing Gateway lifecycle RPC routes and offline behavior; refuse local writes while the Gateway owns state with stop-and-rerun guidance. Reuse effect-time ownership checks without adding cancellation settlement, compensation, fencing, or a new lease protocol. A Gateway starting mid-command is covered by the existing guard at the effect. Supersedes openclaw#168420. Focused remote tests cover the command boundaries and existing migration 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.
Problem
A separate CLI process must not change plugin installation records, registry state, or plugin configuration while a Gateway owns local state. Some plugin commands already delegate mutations to the Gateway, but local fallbacks and standalone updates can still write beside it.
Supersedes #168420.
Design
Reuse the command-boundary
runWithLocalStateOwnerguard from #168417. Existing install, uninstall, enable/disable, and reload Gateway routes remain unchanged. Local mutation paths acquire the existing offline owner and carry its assertion to existing effect callbacks. There is no new routing protocol, compensation, cancellation settlement, lease mechanism, or fencing.Guarded paths:
hooks installalias.plugins registry --refresh.plugins updateand the deprecatedhooks updatealias.plugins marketplace entrieswhen fetching andplugins marketplace refresh, because both can persist feed snapshots.entries --offlinestays read-only.hooks enableandhooks disableconfiguration writes.A running owner produces actionable stop-Gateway-and-rerun guidance; routed lifecycle commands continue to use their existing Gateway methods. Offline behavior is preserved. Update and marketplace refresh now save for the next Gateway start instead of writing locally then requesting a runtime refresh.
Accepted edge case: a Gateway starting mid-command is covered by the existing ownership guard at the effect. We do not add compensation or a second admission protocol around that race. Existing in-process Gateway callers retain their current owner.
Proof
The requested Codex P1 autoreview completed with no actionable findings.
eac4c5d985671dcd3e29592af79718d794c7f1ef: 12 test files, 227 tests passed with--maxWorkers=1(154.38 s wall time; Vitest runner 153.69 s).0ac0b6fd583e62d6103c48bb77e40f98e2d78ea7: https://github.com/openclaw/openclaw/actions/runs/38102314276.check:changedon0ac0b6fd583e62d6103c48bb77e40f98e2d78ea7passed formatting, every ratchet, production typechecking, and all core test typechecking groups. It stops only on Knip's existingsrc/gateway/server-instance-runtime.types.ts: GatewayApprovalEventPublisherV2unused export. The identical finding was independently reproduced on mainbbd2daf8b6def57eb0ac47c5e270c9b39cc168e6; this PR does not touch that file.Production delta: +193 / -156 lines (37 net), excluding tests, test support, and docs. The oversized runtime file does not grow.
Plugin loading is untouched, so the published-driver update cell is not required for this change.