Skip to content

Plugin: handle stale binding conflicts after plugin reinstall or move #17

@huntharo

Description

@huntharo

Problem

If the plugin is uninstalled from one path and reinstalled from another, a previously bound conversation can get into a bad split-brain state:

  • the plugin's local state says the conversation is not bound
  • but OpenClaw core still rejects a new bind because the conversation is already bound

The user needs an explicit overwrite-or-cancel path when this happens.

Repro

  1. Install the plugin from path A and bind a conversation.
  2. Remove it.
  3. Reinstall from path B.
  4. Run /codex_status in the previously bound conversation.
  5. The plugin may report "not bound", but binding again is rejected because core still has a binding record.

Current Findings

  • The plugin only hydrates approved binds from its local pending-bind path; it does not have a true overwrite/conflict flow.
  • The plugin SDK surface exposed here only gives us bind, unbind, and resolveByConversation for runtime conversation bindings.
  • OpenClaw core/plugin binding tests explicitly show that persistent approvals do not carry across plugin roots even when pluginId stays the same.
  • That makes plugin-move/reinstall behavior especially likely to surface as path/root identity drift.

Proposed Scope

  • Detect when a conversation already has a runtime binding that conflicts with the plugin's local state.
  • Distinguish "same plugin, new path/root" from unrelated binding ownership.
  • Offer an explicit overwrite/detach/cancel prompt.
  • Likely requires at least some OpenClaw core/API work so the plugin can inspect and replace the existing binding safely.

Source Notes

  • Plugin bind request path: src/controller.ts:3044
  • Plugin local binding storage: src/state.ts:147
  • Plugin SDK runtime binding surface: src/openclaw-plugin-sdk.d.ts:158
  • OpenClaw conversation runtime helpers: /Users/huntharo/github/openclaw/src/plugin-sdk/conversation-runtime.ts:1
  • OpenClaw binding record helpers: /Users/huntharo/github/openclaw/src/bindings/records.ts:12
  • OpenClaw test: persistent approvals do not carry across plugin roots: /Users/huntharo/github/openclaw/src/plugins/conversation-binding.test.ts:289

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions