Skip to content

[Bug]: OpenViking 插件在单实例多 Agent 场景下存在 Bug #1069

@jianji112

Description

@jianji112

Bug Description

Issue: OpenViking 插件在单实例多 Agent 场景下存在 Bug

环境

  • OpenClaw: 2026.3.13
  • OpenViking 插件: remote 模式
  • Agent: main / codenu / shegmei(同一实例内)

Bug 描述

单 OpenClaw 实例配置了多个 agent,共用 OpenViking 作为 context engine。期望每个 agent 的会话独立保存,但实际只有主 agent 的数据被写入 OV。

Bug 根因

  1. 全局 agentId 无法区分多 agentplugins.entries.openviking.config.agentId 只能配一个值,所有 agent 调用 OV 时使用同一个身份。

  2. 钩子触发异常:虽然 before_prompt_buildafterTurnruntimeContext 中包含 agentId,但 OV API 调用时仍使用全局配置的 agentId("main"),导致只有主 agent 的会话被写入。

建议修复方向

插件应在 before_prompt_build / afterTurn 钩子中,优先使用 runtimeContext.agentId(而非全局配置的 agentId)作为 OV API 的身份标识,实现单实例多 agent 的会话隔离。


Steps to Reproduce

复现步骤

  1. 单 OpenClaw 实例,配置 3 个 agent(main / codenu / shegmei)
  2. 设置 plugins.slots.contextEngine = openviking,remote 模式,agentId = main
  3. 3 个 agent 均正常收发消息
  4. 向 codenu 发消息 → OV 中无新数据
  5. 向 main 发消息 → OV 中 main session 有数据

Expected Behavior

  • codenu 的消息 → OV 中 agent:codenu:* session 有记录
  • shegmei 的消息 → OV 中 agent:shegmei:* session 有记录

Actual Behavior

  • 只有 main 的消息被写入 OV,其他 agent 完全忽略

Minimal Reproducible Example

Error Logs

OpenViking Version

2026.3.13

Python Version

3.13.3

Operating System

Linux

Model Backend

None

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions