OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: 当前多 agent 实现,未考虑多 agent 并行工作的问题。

Open xudongcc opened this issue 8 months ago • 3 comments

Bug Description

当前多 agent 实现,未考虑多 agent 并行工作的问题。

重新实现如下: https://github.com/volcengine/OpenViking/pull/597

Steps to Reproduce

  1. 同时启动多个 Agent 聊天

Expected Behavior

由于当前 client 是单例,所以会冲突。

Actual Behavior

由于当前 client 是单例,所以会冲突。

Minimal Reproducible Example


Error Logs


OpenViking Version

0.2.5

Python Version

3.10.0

Operating System

macOS

Model Backend

None

Additional Context

No response

xudongcc avatar Mar 16 '26 13:03 xudongcc

对 升级到3.13版本后 多agent导致 消息卡住了

AceInAndroid avatar Mar 17 '26 03:03 AceInAndroid

看了一下当前实现和 #597 的改动,这个 issue 应该已经被 #597 覆盖了。

#667 的根因不只是“client 是单例”,而是 openclaw-memory-plugin 里共享了可变的 agent 状态:

  • 当前实现会在 hook 中对同一个 OpenVikingClient 调用 setAgentId(...)
  • client.ts 里还缓存了和 agentId 相关的 runtimeIdentity / resolvedSpaceByScope
  • agent_end 里的 lastProcessedMsgCount 也是所有 agent 共用的

所以多 agent 并行时,确实会出现记忆空间串用、消息计数漂移、重复处理或漏处理的问题。

#597 这几个点都已经在修:

  • 去掉共享 client 上的可变 agentId 状态,改成每次请求显式传 agentId
  • tool 和 hook 都带上当前 agent 的上下文,而不是只在部分路径里切换
  • lastProcessedMsgCount 改成按 agent 隔离的 Map

所以从问题范围看,#597 可以修复 #667。建议直接关联或关闭到 #597,避免重复跟进。

Astro-Han avatar Mar 17 '26 16:03 Astro-Han

最新版本代码已做了改动,支持agent记忆隔离

Mijamind719 avatar Mar 31 '26 03:03 Mijamind719