Repository navigation
Conversation
wlmwang
force-pushed
the
fix/no_active_sandbox
branch
from
November 26, 2026 07:39
db6c4ad to
41d5b2c
Compare
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
This branch has not been deployed
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.
Fixes #3968
AgentScope Java 版本
2.1.0-SNAPSHOT问题原因
两个会话共用一个启用沙箱的 HarnessAgent 时,默认的 MessageBus 和 AsyncToolRegistry 使用空的 RuntimeContext 访问沙箱文件系统,因而会回退到 Agent 的共享沙箱引用。当短会话 B 先结束并清除该引用时,即使长会话 A 的沙箱还在运行,A 也可能在下一次收件箱检查时遇到 No active sandbox。
修复方案
参考 fix(harness): keep memory flush/consolidation IO off the per-call sandbox #3113 对 memory 的处理,沙箱模式下默认将消息和异步工具记录存放在宿主工作区的 .agentscope/bus 下,使这些跨调用的数据独立于单次调用的沙箱生命周期。
框架依次采用显式配置、DistributedStore 提供的组件和宿主工作区默认实现。中英文沙箱文档已更新。如果需要保留旧沙箱快照中的待处理消息和工具记录,需要单独迁移。
验证结果
使用真实 E2B 沙箱跑了 3 轮补丁前后对照。两组均使用框架默认装配,并固定 B 释放后 A 才继续推理。补丁前,A 每次都在检查收件箱时遇到 No active sandbox。补丁后,A 每次都能在原沙箱中继续执行并正常结束,收件箱和过期异步工具记录也能正常处理。
58 项定向回归测试全部通过,覆盖并发释放顺序、消息总线、异步工具注册表和存储配置优先级。Spotless 格式检查通过。
mvn -T1C -pl agentscope-harness -am -Dtest=SandboxControlStorageTest -Dsurefire.failIfNoSpecifiedTests=false test提交检查