Repository navigation
fix(benchmark): preserve checkpoint capture windows and recover mailbox reads - #6454
Conversation
…ent mailbox reads Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6-astra; OpenAI; runtime_reported; reasoning_effort=high
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机
启用自动 checkpoint 的长程任务操作者会遇到存档中断。交接窗口尚有余量时,旧实现可能在 10 秒就放弃封存;一次交接文件读取失败还会停止整个存档线程。新实现传递剩余时间,并允许有限次数的只读重试。隔离验证证明:超时后释放 worker,旧捕获身份不能重放,后续新边界仍能成功存档。不修改评分、提交机会、模型策略或默认开启状态,也不宣称已经证明大规模长期运行收益。真实长程源的后续自然 checkpoint 和大历史文件延迟仍需部署后验证。
本评审针对 bdce91f114e7a609e45d7f4ff9c156ba2c95662d。规范依据是基线 f43732cd7deaefe574d39b8449e9d5fc2ee41543 的 benchmark/README.md,Controller-only native capsule transport 小节。三个验收项是 barrier-release(只释放自己建立的暂停)、first-attempt-identity(失败身份不能用于捕获更晚状态)、optional-capture-continuation(失败不得补发模型或评测预算)。这些名称仅用于映射原文条款,不是新增协议标识。
改动思路
复用既有文件封存和原生评测 owner,仅修正 provider 的时间传递及只读重试。本 PR 交付可独立回滚的捕获传输修复;真实长程存档验收仍归实验控制器。控制器把交接窗口的剩余时间传给 worker,worker 再把同一截止时间逐步消耗到原生捕获与 TypeScript 文件封存。捕获时间耗尽不能成为遗留暂停容器的理由,所以清理保留独立、有限的传输时间。这个区别保护源任务继续执行,不增加研究或评测预算。
不采用全局提高 Effect 超时的方案,因为其他调用方不应承担额外等待,也不能借此修复监控线程退出。不引入通用重试框架,因为捕获可能已经提交;只对读取交接文件发生的 ReadError 做最多两次重试。持续错误仍终止并写入原有失败记录。普通文件错误、路径越界、错误身份和不一致源状态不会被这个分支吞掉。
具体改动
关键代码讲解
benchmark/edgebench/checkpoint_controller.py:185的capture在入口校验时间预算,通过_remaining给 HTTP、probe 和 capture 传递剩余时间,禁止把窗口重新计满。产物仍由原有 typed artifact owner 生成和验证,权限及原生机会的决定权没有迁移。benchmark/edgebench/checkpoint_worker.py:149的capture_worker将 Docker 读取、准备见证比对、原生胶囊及外层封存串到同一预算,且与原始 handoff 截止时间取较早者。异常仍进入finally,恢复自己负责的暂停;已有或竞争方的暂停继续按原规则拒绝。barrier-release 与 first-attempt-identity 均由真实 Docker 的失败及恢复测试覆盖。benchmark/edgebench/checkpoint_supervisor.py:70的_run保留现有 request digest 去重,仅对尚未开始捕获的 archive read 错误计数。成功读取或文件不存在会清零,第三次连续错误保留显式失败。optional-capture-continuation 的测试包含一次读取故障后成功封存、持续故障保持可见,以及超时失败后用不同身份成功捕获。
共四个文件,生产代码新增 42 行、删除 11 行,其余主要是回归覆盖。没有新增配置、持久化格式、枚举或 Python 决策 owner。相邻的小型重构仅复用剩余时间计算,避免为了两个调用者引入更大的框架。
对主干的风险
主要风险是允许单次文件操作使用剩余窗口后,暂停可能比原来的隐式 10 秒更久;这必须被原始 handoff 边界约束,不能把捕获请求变成额外研究时间。清理失败仍是人工恢复条件,测试不能把它写成成功。真实 Docker 与原生 HTTP、TypeScript 文件封存的 58 项验证全部通过,包含暂停响应丢失、其他控制者已建立的暂停、取消、身份重复、源变化和冷却保留;评分使用合成实现,没有付费模型调用。
同一新增回归在不可变基线上确实失败两项:一次 ReadError 后拿不到捕获回复,耗尽时间后没有抛出超时。修复提交全部通过。关闭/开启 checkpoint 的入口对照在基线和提交上各通过 4 项;入口测试的执行与安装部分为替身,只证明现有开关路由隔离,实际启用后的捕获由前述真实集成覆盖。PR 保留默认关闭,没有共享 prompt 或自动加载指令变化。依据当前 Goal 的评审策略未查询或等待远端 CI;本地针对性验证和 diff 检查已完成,合并资格另行判断。
我的整体评价
未发现阻塞项,支持这批传输修复进入后续资格化。长程连续性和操作者体验在本次覆盖的失败后继续场景中改善:不需要新增设置、重新注册评测或重启模型;一次可恢复的读故障不再永久丢失后续存档。该结论不等于证明全部长程问题已关闭。大历史的实际捕获耗时和下一次自然完整 checkpoint 仍需部署后验证;尤其不能把更大的允许等待时间本身当作效率提升。现有共享语义与持久化格式保持不变,本地计时和异常重试边界有明确归属,规模与收益相称。
English verdict: APPROVE - bdce91f. Remaining-window propagation and bounded read-only mailbox recovery are scoped to explicit checkpoint capture. Real Docker/native HTTP/typed-artifact validation: 58 passed; entry parity: 4 passed on each revision; both regressions reproduced on baseline. Sustained large-history capture and runtime rollout remain separate acceptance work.
Checkpoint capture passed the caller timeout to native HTTP but left artifact probing and sealing on the Effect transport’s default 10-second budget. A valid capture window could therefore fail prematurely; an unrelated transient Docker mailbox archive read could then permanently stop the optional checkpoint poller.
Share the remaining capture window across worker transport, native capture and artifact calls. An expired window stops further capture work while preserving bounded writer-barrier cleanup and the original non-retryable capture identity. The supervisor passes its actual handoff remainder and retries at most two failed mailbox reads; persistent archive errors remain visible. Capture stays opt-in.
Validation: 58 tests passed in 110.54 seconds with isolated real Docker workers, actual native checkpoint HTTP endpoints and the TypeScript artifact owner (synthetic grading, no model calls). Coverage includes source mismatch, expiry, native admission failures, lost pause replies, foreign barriers, cleanup, a later fresh successful point after failure, transient mailbox recovery and persistent failure. These checks establish transport behavior, not sustained experiment utility or large-history capture latency.
Placement/future-facing pass: keep Docker/HTTP transport in the existing benchmark provider, reuse the typed artifact owner, and share only the adjacent remaining-window calculation. No new state vocabulary, authority owner, frontend setting, scoring or submission behavior. CLI capture uses the same provider; frontend/Lark entry points are unchanged. Runtime rollout and sustained natural checkpoint readback remain separate from this proposal.