Skip to content

fix(openclaw-plugin): avoid shared mutable agent client state#867

Open
ningfeemic-dev wants to merge 1 commit intovolcengine:mainfrom
ningfeemic-dev:fix/openclaw-plugin-agent-scoped-client
Open

fix(openclaw-plugin): avoid shared mutable agent client state#867
ningfeemic-dev wants to merge 1 commit intovolcengine:mainfrom
ningfeemic-dev:fix/openclaw-plugin-agent-scoped-client

Conversation

@ningfeemic-dev
Copy link

Problem

The OpenClaw plugin currently reuses a shared OpenVikingClient and switches identity via mutable setAgentId(...) calls.

Under concurrent multi-agent usage, that can leak agent context across requests.

Fix

Use agent-scoped client instances instead of mutating a shared client instance:

  • keep local process reuse
  • keep shared startup/pending coordination
  • return a distinct client per agentId
  • stop switching a shared client with setAgentId(...) in hot paths

Why this is needed

This is an isolation fix, not a refactor.

It reduces the risk that:

  • agent A reads agent B memories
  • agent A writes/extracts into agent B space
  • recall/capture becomes nondeterministic under concurrency

Validation

  • minimal plugin typecheck passed:
    • ./node_modules/.bin/tsc -p tsconfig.json --noEmit

@CLAassistant
Copy link

CLAassistant commented Mar 22, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

Failed to generate code suggestions for PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants