Repository navigation
Conversation
Sandbox cleanup — review report and current validationTest-source exclusion update: Current delivery heads: XTuner Validated runtime heads before the test-only exclusion: XTuner This comment republishes the latest retained architecture/code review, Read the chronology correctly: the 15:06 static review found no confirmed PR-introduced defect in its scope. Later 16-GPU fault injection found S13 and I07 unresolved; the overall current result is 64/66 passed, not complete acceptance. Publishing the older report does not override those failures. Known limits and normal-training impactThe two failed injections do not lie on the current standard training entry's normal path. They remain real recovery limits, not evidence of a universal no-leak guarantee:
All in-job recovery executors disappearing still requires an external executor. LocalhostRunner, tools bypassing Pool, full-node power loss, throughput/peak-memory acceptance and full optimizer-update training are outside this delivery's completed acceptance. Snapshot and publication scope: the report's Dependency alignment: XTuner's validated cleanup delta starts at Retained architecture/code review — 2026-11-17 15:06summary本轮未发现可确认的本 PR 引入缺陷。 已修复前轮确认的 tokenizer 缓存身份问题,并按用户最新要求,只审查三个 PR/MR 相对直接 stack 基线新增或改变的代码及其交互;基线既有问题不再列为本轮 finding。 缓存修复覆盖 DeepSWE 和 CyberGym:显式传播预计算 tokenizer_hash;未提供时首次 hash() 计算并复用 tokenizer 指纹;cache schema 从1升至2,继续纳入 max_length、system_prompt、tools_schema。没有增加管理类、改变清理预算或提交/推送。
工作目录为三个原 cleanup worktree,完整交付96文件/86 Python;本轮缓存修复6文件。虽然阅读完整调用路径,但 finding 必须能归因于上述 diff 或其造成的行为变化,不以“文件改过”把整文件的旧问题归给本 PR。Lagent #385自身、独立429 worktree和未改变的既有业务语义不在本轮缺陷范围内。评审对象为本地源码,远端PR尚未同步这些未提交修改。 采用 improve-codebase-architecture,读取CONTEXT,以module、interface、depth、seam、adapter、leverage、locality和deletion test评估;配套codebase-design skill及相关ADR未找到。用户指定Markdown,不另生成HTML或候选确认。主审Codex的精确子型号与思考强度未由会话提供;独立审查为GPT-6.1 Sol / high。 before是直接stack基线,after是当前工作区。类图使用added/changed stereotype,流程图使用Mermaid8.8.0基础graph/subgraph/classDef;未运行旧版renderer,不宣称完成视觉验收。图示覆盖主要class/module,不把功能module误称Python管理class。 UML before this PR直接基线中,Runner 与任务共享 Ray actor,资源归属和重试在 Pool 内;CyberGym 自行补删与查询,并在阶段释放时关闭 provider。尚无本次公共账本、独立任务进程及统一退出回收器。Lagent 基线没有本次 DBox provider,CRG 基线没有本次 DeepSWE recipe。 classDiagram
class AgentLoopActor {
+generate()
}
class AgentInSandboxLoop {
+generate_sample()
-_run_item()
}
class Runner {
+run()
}
class SandboxPool {
+get()
+release_all()
-_acquire_ready()
-_release_group()
}
class SandboxSpec
class SandboxStage {
+run()
}
class Judger {
+run()
}
class SandboxProvider {
<<protocol>>
+create()
+delete()
}
class GatewayProvider {
+create()
+delete()
+get()
+aclose()
}
class SandboxClient
class OpenSandboxProvider
class OpenSandboxClient
class CyberGymRunner
class CyberGymPool
class FairAsyncTokenBucket
AgentLoopActor "1" *-- "1" AgentInSandboxLoop : per actor
AgentInSandboxLoop "1" --> "0..*" Runner : concurrent tasks in actor
Runner "1" --> "1" SandboxPool : per trial
Runner "1" --> "1" SandboxStage : infer
Runner "1" --> "1" Judger : validate
SandboxPool "1" *-- "1..*" SandboxSpec : named plans
SandboxSpec "0..*" --> "0..*" SandboxSpec : dependency config reuse
SandboxPool "0..*" --> "1" GatewayProvider : optional shared provider
SandboxPool "0..*" --> "1" OpenSandboxProvider : alternative backend
SandboxPool "1" --> "0..*" SandboxClient : owned clients
SandboxPool "1" --> "0..*" OpenSandboxClient : alternative clients
SandboxPool "0..*" --> "0..1" FairAsyncTokenBucket : shared per process and key
SandboxProvider <|.. GatewayProvider
SandboxProvider <|.. OpenSandboxProvider
Runner <|-- CyberGymRunner
SandboxPool <|-- CyberGymPool
数量关系说明:Runner→Pool 的 1:1 是一次执行关系;同一个 Runner 模板可以先后产生多个 Pool。Spec 的多对多是配置引用,不代表多个任务共同拥有一个物理沙盒;依赖只支持一层。provider 是互斥后端选择,不表示每个 Pool 同时连接两个 provider。token bucket 是每进程每 key 的共享注册表实例,不是全局 Singleton 类。 Main Flowchart before this PRgraph TD
subgraph BActor ["xtuner.v1.rl.agent_loop.sandbox_agent_loop.agent_in_sandbox_loop.AgentInSandboxLoop._run_item"]
B1["解析配置并注入原 session"]
B2["在共享 Ray actor 内执行 runner.run"]
B1 --> B2
end
subgraph BRun ["xtuner.v1.rl.agent_loop.sandbox_agent_loop.runner.Runner.run"]
B3["校验输入并构造 Pool"]
B4["infer 后执行 validate"]
B5["finally 先写最终日志,再 release_all"]
B3 --> B4 --> B5
end
subgraph BGet ["xtuner.v1.rl.agent_loop.sandbox_agent_loop.sandbox.SandboxPool.get"]
B6["读取缓存或逐项创建依赖组"]
B7["健康检查、provision、提交 group"]
B6 --> B7
end
subgraph BCreate ["lagent.serving.sandbox.providers.gateway.GatewayProvider.create"]
B8["POST 分配后返回 client 与 ID"]
end
subgraph BOS ["recipe.cybergym.opensandbox_provider.OpenSandboxProvider.create"]
B9["分配与就绪,失败自行回滚"]
end
subgraph BStage ["xtuner.v1.rl.agent_loop.sandbox_agent_loop.sandbox.SandboxStage.run"]
B10["pre hooks、entries、post hooks"]
end
subgraph BJudge ["xtuner.v1.rl.agent_loop.sandbox_agent_loop.judger.Judger.run"]
B11["验证阶段,可释放 infer 资源并另建 verifier"]
end
subgraph BRelease ["xtuner.v1.rl.agent_loop.sandbox_agent_loop.sandbox.SandboxPool.release_all"]
B12["逆序 DELETE 与 client close;错误只记录日志"]
end
subgraph BCyber ["recipe.cybergym.pipeline.CyberGymPool.release_all"]
B13["补删 owned IDs 并查询最终状态"]
B14["finally 关闭 provider"]
B13 --> B14
end
B2 --> B3
B4 --> B6
B6 --> B8
B6 --> B9
B7 --> B10 --> B11
B11 --> B12
B5 --> B12
B12 -.-> B13
图中的创建后端二选一。基线已有普通 finally、局部回滚和 CyberGym 专用补删,不能描述成“原先完全没有清理”;缺少的是统一持久所有权、任务可强制终止与退出接管。 UML after this PRclassDiagram
class AgentLoopActor {
<<changed>>
+generate()
}
class FairAsyncTokenBucket
class AgentInSandboxLoop {
<<changed>>
-_run_item()
}
class TrialProcess {
<<added>>
+run_trial_process()
+resolve_runner()
+validate_trial_budget()
}
class TrialChannel {
<<added>>
+acquire()
}
class CreationLimiter {
<<added>>
+acquire()
}
class Runner {
<<changed>>
+prepare_trial_pool()
+run_with_pool()
+run()
}
class SandboxPool {
<<changed>>
+get()
+task_scope()
+release_all()
+aclose()
}
class SandboxLifecycle {
<<added>>
+acquire_group()
-_name_locks
+release_all()
+finish()
}
class Finalization {
<<added>>
release_attempted
sealed
handed_off
completed
release_error
}
class CleanupJournal {
<<added>>
+begin_create()
+allocated()
+confirmed()
+detach()
}
class SandboxProvider {
<<changed>>
ClientT covariant
+create()
+delete()
+get()
+aclose()
}
class GatewayProvider {
<<changed>>
}
class DBoxProvider {
<<added>>
}
class OpenSandboxProvider {
<<changed>>
}
class SandboxClient {
<<changed>>
+is_pid_running()
+get_lifecycle_state()
}
class DBoxSandboxClient {
<<added>>
+get_diagnostics()
+configure_network()
}
class OpenSandboxClient {
<<changed>>
+get_diagnostics()
+configure_network()
}
class SandboxSpec
class SandboxStage
class Judger
class CyberGymRunner {
<<changed>>
}
class TrialObservation {
<<changed>>
+observe_trial()
}
class RLCyberGymTokenizeFn {
<<changed>>
+hash()
-_tokenizer_hash
}
class RLDeepSWETokenizeFn {
<<added>>
-_tokenizer_hash
+hash()
+__call__()
}
class ProcessProbe {
<<added>>
+is_running()
}
class DeepSWERunner {
<<added>>
}
class Recycler {
<<added>>
+request_recovery()
+run_batch()
}
class RunControl {
<<added>>
+training_scope()
+ray_shutdown_scope()
}
class Supervisor {
<<added>>
+main()
}
AgentLoopActor "1" *-- "1" AgentInSandboxLoop : per actor
TrialChannel "0..*" --> "0..*" FairAsyncTokenBucket : parent registry permit keys
AgentInSandboxLoop "1" --> "0..*" TrialProcess : concurrent isolated trials
TrialProcess "1" --> "1" Runner : per child invocation
TrialProcess "1" --> "1" TrialChannel : child endpoint
CreationLimiter "0..*" --> "1" TrialChannel : compatible permit adapter
Runner "1" --> "1" SandboxPool : per trial
Runner "1" --> "1" SandboxStage : infer
Runner "1" --> "1" Judger : validate
CyberGymRunner ..> TrialObservation : one scope per invocation
OpenSandboxClient "1" *-- "0..1" ProcessProbe
RLDeepSWETokenizeFn ..> AgentInSandboxLoop : rollout item configuration
RLCyberGymTokenizeFn ..> AgentInSandboxLoop : rollout item configuration
Runner <|-- CyberGymRunner
Runner <|-- DeepSWERunner
SandboxPool "1" *-- "1" SandboxLifecycle
SandboxPool "1" *-- "1..*" SandboxSpec
SandboxSpec "0..*" --> "0..*" SandboxSpec : dependency config reuse
SandboxLifecycle "1" *-- "1" Finalization : private data only
SandboxLifecycle "1" *-- "0..1" CleanupJournal
SandboxLifecycle "0..*" --> "1" SandboxProvider : dedicated or shared
SandboxLifecycle "1" --> "0..*" SandboxClient : exclusive release obligation
SandboxProvider <|.. GatewayProvider
SandboxProvider <|.. DBoxProvider
SandboxProvider <|.. OpenSandboxProvider
SandboxClient <|-- DBoxSandboxClient
OpenSandboxClient ..> SandboxClient : compatible operations without inheritance
CleanupJournal "0..*" ..> "1" Recycler : one active worker per run
RunControl "1" --> "0..*" Supervisor : head and optional peer witnesses
RunControl ..> Recycler : bounded exit handoff
图中
channel→bucket 的多对多表示多个 trial 复用父进程的多个限速 key,不是沙盒共同所有权。 每个独立 trial 一个 CPU 子进程、一个创建许可 channel endpoint;同一子进程若业务显式构造多个 Pool,可以拥有多个账本。每个 Pool 独占自己的资源释放义务,provider transport 可以共享。每个 run 至多一个持锁的活动回收链;head 和可选 peer 可以有多个退出观察者,竞争者不会同时取得同一账本所有权。它们都不是全局 Singleton 类。相同 name 的并发 get 现在在同一 Lifecycle 中串行并复用提交结果;该锁不跨 Pool 共享。
Main Flowchart after this PR黄色为改造的既有入口,绿色为新增能力,灰色为保留的业务步骤。图中 provider 是互斥后端,infer→verify 的业务顺序保留。 graph TD
subgraph FData["recipe.deepswe.xtuner_dataset.RLDeepSWETokenizeFn.hash / RLDeepSWETokenizeFnConfig.build"]
D0["构造训练 item;缓存身份包含 tokenizer 指纹和配置"]
end
subgraph FLoop["xtuner.v1.rl.agent_loop.sandbox_agent_loop.agent_in_sandbox_loop.AgentInSandboxLoop._run_item"]
L0["原 session UID;调用独立任务入口"]
end
subgraph FProcess["xtuner.v1.rl.agent_loop.sandbox_agent_loop.trial_process.run_trial_process / resolve_runner"]
P0["校验可信可重建配置与声明预算;启动 CPU child"]
P1["child 重建 Runner,模型仍经原 HTTP proxy"]
P2["等待或取消;只终止本任务进程组;确认退出"]
P3["按任务 manifest 恢复;核对结果身份与 receipt"]
P0 --> P1
P2 --> P3
end
subgraph FObserve["recipe.cybergym.metrics.observe_trial"]
O0["必需身份/开始记录/输出目录,均早于分配"]
O1["可选 usage/诊断/最终记录;普通错误不覆盖结果"]
end
subgraph FCyberRun["recipe.cybergym.pipeline.CyberGymRunner.run / _run_cybergym_trial"]
C0["观察 scope 内,标准 Runner 与总期限;保留已有错误"]
end
subgraph FPrepare["xtuner.v1.rl.agent_loop.sandbox_agent_loop.runner.Runner.prepare_trial_pool / run_with_pool"]
R0["校验与复制配置,构建 Pool;task_scope 内线性执行"]
R1["关闭 Pool,保存清理快照,再记录最终日志"]
end
subgraph FPool["xtuner.v1.rl.agent_loop.sandbox_agent_loop.sandbox.SandboxPool.get / _acquire_ready"]
G0["规划依赖、限速、健康和 provision"]
end
subgraph FLife["xtuner.v1.rl.agent_loop.sandbox_agent_loop.lifecycle.SandboxLifecycle.acquire_group"]
A0["登记获取完成信号;按 name 锁;重查准入与缓存"]
A1["创建前 intent;分配即归属;回滚后才决定重试"]
A0 --> A1
end
subgraph FJournal["xtuner.v1.rl.agent_loop.sandbox_agent_loop.cleanup.CleanupJournal.begin_create / allocated / confirmed"]
J0["OFD lease;先登记精确 manifest;持久意图与 ID"]
end
subgraph FChannel["xtuner.v1.rl.agent_loop.sandbox_agent_loop.trial_channel.serve_channel / _CreationLimiter.acquire"]
Q0["复用父 actor 共享创建许可"]
end
subgraph FProvider["lagent.serving.sandbox.providers.gateway.GatewayProvider.create / lagent.serving.sandbox.providers.dbox.DBoxProvider.create"]
V0["单 POST;早期分配通知;ready;失败保留可恢复 ID"]
end
subgraph FOpen["recipe.common.opensandbox_provider.OpenSandboxProvider.create"]
V1["线程 POST 与取消补偿;分配通知早于就绪"]
end
subgraph FInfer["recipe.cybergym.pipeline.InferStage.run"]
I0["标准业务执行后,必须停止 agent 并收集产物"]
I1["停止与收集结束,返回业务结果"]
I0 --> I1
end
subgraph FJudge["xtuner.v1.rl.agent_loop.sandbox_agent_loop.judger.Judger.run"]
B0["阶段释放、准备 verifier、执行 verify"]
end
subgraph FRelease["xtuner.v1.rl.agent_loop.sandbox_agent_loop.lifecycle.SandboxLifecycle.release_all / finish"]
S0["停止并排空获取;逆序删除+查询确认;关闭 clients"]
S1["分别记录 release、seal、handoff、transport 完成事实"]
S0 --> S1
end
subgraph FExit["xtuner.v1.rl.agent_loop.sandbox_agent_loop.run_control.training_scope / ray_shutdown_scope"]
X0["退出 stop admission → drain → 有预算补扫"]
end
subgraph FWitness["xtuner.v1.rl.agent_loop.sandbox_agent_loop.supervisor.main"]
W0["正常时只观察 driver;退出时接管同一补扫"]
end
subgraph FRecycler["xtuner.v1.rl.agent_loop.sandbox_agent_loop.recycler.request_recovery / run_batch"]
Z0["失败持久入队;固定代际范围;受限并发+退避;耗尽保留"]
end
D0 --> L0 --> P0
P1 --> R0
P1 -.-> O0 --> C0 --> R0
R0 --> G0 --> A0
A1 --> J0
A1 --> Q0
A1 --> V0
A1 --> V1
V0 --> I0
V1 --> I0
I1 --> B0 --> S0
R0 --> R1 --> S1
R1 -.-> O1
R1 --> P2
S1 -.-> Z0
P3 -.-> Z0
W0 --> X0 --> Z0
classDef changed fill:#fff2cc,stroke:#b8860b,color:#222;
classDef added fill:#e2f0d9,stroke:#548235,color:#222;
classDef business fill:#eeeeee,stroke:#777,color:#222;
class L0,R0,R1,G0,V0,V1,O0,O1,C0 changed;
class P0,P1,P2,P3,A0,A1,J0,Q0,S0,S1,X0,W0,Z0 added;
class D0 added;
class I0,I1,B0 business;
这是主干及配套 CyberGym 路径的展开图;DeepSWE 使用相同公共任务/Pool 流程,其可选 capture 独立有界。业务抛错/进程强杀不必继续执行 verify;父进程只有确认 worker 退出后才能接管 manifest,不能把强杀画成 child 继续调用 finish。
核心原理
核心实现与对应的单测缓存问题的修复与复核主要位置:CRG # 当前实现的职责示意;没有新增运行时manager
build(tokenizer, tokenizer_hash=None):
return TokenizeFn(tokenizer, tokenizer_hash=tokenizer_hash, **config)
hash():
if self._tokenizer_hash is None:
self._tokenizer_hash = tokenizer_xxhash(self.tokenizer)
return stable_hash(schema=2, tokenizer_hash=self._tokenizer_hash,
max_length=..., system_prompt=..., tools_schema=...)项目公共tokenizer_xxhash通过序列化tokenizer计算,包含chat template;没有重复实现一套词表/模板提取规则。惰性计算避免普通构造和__call__强迫save_pretrained;保留原有位置参数、config字段、task mount和judger mapping行为。实例使用期间tokenizer须保持不变,更换后重新build;上层提供hash时须与tokenizer一起更新,这与数据构建层原契约一致。 修前证据:将本轮cache增量逆向移除,得到冻结的修前dataset模块,再加载到真实XTuner JsonlDataset。两种recipe各测chat template和实际预分词规则变化,4/4在reused==fresh断言失败;不是将替身cache当作持久缓存,也不冒称命令在编辑产品前执行。修后同场景通过。
上述共24项定向测试,与recipe完整回归重合,不重复累计。独立静态复核确认:配置透传、惰性指纹和JsonlDataset键的消费相符,未发现该修复引入新问题。 本次PR新增清理能力与既有单测的对应
以上表格说明代码与单测的对应,不代表本轮重新执行全部XTuner/Lagent套件。 抽象与信息隐藏评估
没有需要新增class解决的确认问题。固定schema、纯数据记录、ctypes ABI结构和异常类型不等同新增运行时manager;完整PR新增的Lifecycle、Journal、channel等各自隐藏真实规则,本轮缓存没有再叠管理层。 新增功能守则
R1字面计数不完全满足的既有interface,不因此判为正确性缺陷;不建议合成字符串路由或增加浅class掩盖计数。未确认本次引入新的功能守则问题。 公开接口的线性业务流程评估
没有新的线性流程改进项;不为满足形式上的Composed Method继续拆一行私有转发。 单测建议已补齐这次缓存缺陷的真实消费测试,未仅验证hash字符串。保留修前冻结实现与修后日志,使旧过滤错误可复现。 后续平台验收应复用现有至少8沙盒/点矩阵,验证当前隔离/OFD组合下真实rollout→verify、跨节点owner保护和崩溃接管;完整proxy→父trace→训练字段、并发RSS和吞吐需独立测量。这些属于验收范围,不作为未证实的本PR代码缺陷。 其他 issues本轮没有其他确认的本PR引入问题。对基线既有缺陷不重新评级或列为待修项,按用户要求排除;不把未测场景、无复现的推测或字面R1例外混作finding。 验证范围与证据
|
Subsequent full GPU/sandbox report — 2026-11-17 17:35Test-source exclusion update: Current delivery heads: XTuner Validated runtime before the test-only exclusion: XTuner Current outcome: 64/66 points passed; S13 and I07 remain unresolved. The two failures are outside the current standard normal-training path, subject to the deployment and abrupt-termination restrictions explained in the adjacent review comment. All 608 resources were independently confirmed deleted, including 8 explicit external-CLI recoveries and 8 safety deletes; do not count the latter as automatic recovery. No new GPU run was performed for this publication. 16 卡沙盒清理实测报告完成时间:2026-11-17T17:35:29.808662+08:00。结论:64/66 点通过,2 点未通过,整体未通过验收。 本轮共创建 608 个去重物理沙盒,每点至少 8 个;592 个自动删除,8 个在恢复进程全灭的预期边界下由显式外部 CLI 恢复,8 个因创建响应窗口缺失 ID 而安全补删。平台独立 GET 确认全部删除,无剩余活动沙盒。 GPU 挂载环境内核验共 524 份账本,516 份完成,8 份仍未决;未决账本和回收请求保留,未手工改写为 complete。 环境与范围
未通过项S13:控制容器与 GPU 挂载环境之间的锁保护不成立。 控制容器对 8 份活动账本实际调用恢复接口,全部进入 provider 解析分支。测试 resolver 在 DELETE 前强制拒绝,实际跨环境 DELETE 为 0;随后由原 GPU Owner 正常删除资源。此结果说明该组合中不能依靠文件锁允许控制容器在线接管。两台 GPU 节点之间的双向保护、崩溃接管和竞争补扫均通过,不能据此推导控制容器也安全。具体存储桥接原因尚未定位。 I07:平台创建成功但分配回调尚未记 ID 时强杀 worker,无法自动回收。 8 次真实 POST 响应已成功,测试在回调前暂停并强杀 8 个私有 worker;8 份账本均为 creating 且资源列表为空。前台恢复结束、后台回收器耗尽 6 轮并释放 worker 锁后,8 个沙盒仍存活。仅依据本轮外部审计记录的精确 ID 安全补删了这 8 个资源;产品账本和请求队列保持未决。故障注入放大了时序窗口,本轮不估计自然发生频率。 上述两项仍是当前方案的边界,不能将本轮“平台资源最终全部删除”解释为“所有退出路径均自动兜底”。后续需分别处理跨挂载域恢复准入,以及创建请求的持久标识与平台端精确查找/幂等创建能力。 测试明细
预算与证据口径
本轮主要验证状态、归属、交接和回收行为,不将测试中的短期限写成默认长预算验收。详细覆盖以各点脚本、故障标记、账本和平台原始状态为准。 准备及统计修正均保留记录:首次启动因共享模型管理接口 HTTP 500 在创建前失败;独立进程前四项因测试 Pool 缺少 type 在创建前失败,补齐后每点以 8 个资源重跑(兄弟任务点为 16 个);TB Driver 崩溃点改以原生返回消息的 request ID 与 verify 标记核实真实模型执行;最终作业停止点因测试脚本缺少 Path 导入在创建前失败,随后用独立 16 卡作业补测。以上准备失败均未创建沙盒,未修改产品源码或删除失败记录。 补测节点 1 的附加终态审计脚本曾因缺少 Path 导入退出;节点 0 随后在 GPU 挂载环境内完成覆盖全部 608 个资源和 524 份账本的全量核验,lease 探测错误为 0。该辅助脚本错误不作为产品清理失败,也不替代原始失败记录。 最后一次实际停止的作业: 全部 GPU 作业均已核对 active=0,所有本轮自有模型路由均独立确认注销。终态 lease 采用 GPU 挂载环境内的只读核验:账本核验;控制容器只核对账本内容,不以其失效的锁探测证明远端 Owner 已退出。 关键材料 |
Agent RL sandbox cleanup — integration map
Review each repository against its stated dependency. These are companion changes, not three independently complete cleanup implementations.
v1.0.0.exp/qwen3-6-cybergym.Validated runtime combination: XTuner
9735a334, Lagent6680c358, CRG35d91eb5. Keep Draft.Test-source exclusion update: Current delivery heads: XTuner
f7554574, Lagent3a694e7e, CRGf00cc0a2. The confirmed 29 cleanup-owned test/script/fixture changes (XTuner 12, Lagent 5, CRG 12) have been reverted to their respective direct stack baselines; pre-existing baseline tests are preserved. All 33 latest local test copies, including 4 previously untracked files, are archived outside the delivery repositories. Runtime and documentation contents are byte-identical to the preceding heads; this is a test-only scope reduction, not a new experiment run. By the user's explicit scope choice, #2299 alignment is deferred: XTuner's current GitHub comparison still shows 15 inherited upstream-stack test files, outside these 29 cleanup-owned files.Expose allocations before readiness and provide reliable management operations so XTuner can recover a sandbox after command, connection or task failure. Keep provider responsibilities separate from XTuner task isolation and the run-level recycler.
Review scope and dependencies
Official target remains
InternLM/lagent:v1.0.0; published head3a694e7edepends on still-open #385, head6d007f0. Until #385 merges, the official PR also contains its prerequisite commits; review this delivery using the incremental comparison. Rebase ontov1.0.0and rerun compatibility checks after #385 lands, before Ready. The former fork PR remains superseded.Review units:
2d8fb528adds DBox transport/lifecycle prerequisites missing from #385;db91df30adds allocation callbacks and cleanup credential handling;db9e46e3hardens allocation, command/file transport and lifecycle contracts;6680c358corrects diagnostic routes and expresses provider client types. Preserve #385's adapter, request provenance andforward_timeout.Changes
on_allocatedas soon as an exact ID is available and before readiness waits; failures after sending a create request remain ambiguous unless allocation is proven absent./diagnostics/inspectand/diagnostics/events.Code entry:
lagent/serving/sandbox/providers/base.py,gateway.py,dbox.py,dbox_client.pyand shared credential/probe helpers. Training shutdown, process isolation and background retry remain in XTuner #2313.Validation
llmagent_gpu; sandbox projectailab-llmit, identitywuyihao.p. Each point used at least 8 real resources. No optimizer updates; this is two 8-GPU inference deployments, not 16-GPU distributed-training acceptance.rjob stop. Cross-GPU-node active-owner protection, crash takeover and competing recovery all passed.Known limits and normal-training impact
The two failed injections do not lie on the current standard training entry's normal path. They remain real recovery limits, not evidence of a universal no-leak guarantee:
creatingwith no IDs, so recovery could not locate these 8 resources. Only their separately audited exact IDs allowed safety deletion. Ordinary successful execution continues into the callback and records the ID; cooperative cancellation is covered separately. Abrupt termination in this narrow window can leak sandbox quota, and accumulated leaks can affect subsequent allocation. The injected window was widened deliberately; its natural occurrence rate was not measured. Resolving it requires a durable create identity plus platform-supported exact lookup/idempotency.All in-job recovery executors disappearing still requires an external executor. LocalhostRunner, tools bypassing Pool, full-node power loss, throughput/peak-memory acceptance and full optimizer-update training are outside this delivery's completed acceptance.
Reviewer guide and review report
The static review predates the two fault-injection findings; the current limitations above take precedence. No automatic merge.