Repository navigation
Route replan reviews to Todo selection and preserve context mode - #8120
Conversation
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.1-sol; OpenAI; runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
在尚未选定工作的周期复盘中,调用 Heartbeat/quota 的 Agent 会先读取本次复盘,再决定执行哪个 Todo。旧路径先让 Agent 打开写回说明,说明又要求它返回 guard 选择工作;修复后直接执行本次 guard 给出的选择命令,选定后再读取绑定该 Todo 的写回说明。独立 CLI 验证已确认 off/on 两种上下文模式均走到同一 Todo、同一 Turn 的有效写回入口,并保留显式模式。本次范围是选择与写回的导航修复;不改选项资格、租约、额度或结算规则,也不交付整个 C1/C2 跨宿主推广。
改动思路 / Approach
资格与执行权限仍由既有 TypeScript guard 决定;本次只复用当前选择命令及其显式传输参数,增加第二个选择器或兼容服务反而会制造双重规则。本 PR 的边界是未绑定复盘到既有 Todo 选择,再到新绑定快照的完整 CLI 路径,附带 checkpoint 调用文字同步;不执行 benchmark。从原始请求到可用结果,无需重填已知信息或增加确认轮次。必要的 guard 资格检查仍在原 owner;单纯读取旧观察不能代替它。正向链路为当前 guard → 本次 review → 当前选择命令 → 同一 Todo/Turn 的新绑定 capture → writer。这是可独立回退的维护结果,不用完成整个上层研究项目才有价值。
具体改动 / Changes
审查全部 5 个文件的 base..head diff,head 为 dc5aeb86e1ac93a9053285408d44a388837eba8d,base 为 3c7e0935fd6697291c5c432e5267816b4a667cfa。生产改动集中在三个既有文件(+12/-5),其余是两条真实 CLI 回归及协议说明。selection_required 取自 guard 已有的明确字段,既不从自然语言猜状态,也不维护第二份 Todo 资格。显式 context_delivery=off 与省略参数不再混为一谈。
关键代码讲解
- replanView:只在既有 guard 明确要求选择 Todo 时投影选择入口。已绑定 Todo 与独立 replan obligation 继续提供写回入口;读取这一步没有权限效果。
- replanActionPacket:命令仍绑定同一个 capture;说明改成先看
review.next,避免在选择尚未完成时强行解释写回格式。actionProjection同步采用这条顺序。 - bind_capture_selection_transport:
is not None保留显式 off,也保留 on;省略时仍沿用原机器配置。原 CLI route、capture root、Turn 与 display 选项继续传递。 - capture_before_replan:checkpoint 的调用文字跟随同一
review.next。原来的完整 CLI view、preflight 顺序与恢复指令仍在,没有增加另一次 guard。
语义与 CI 对齐
验收依据是修改前的 docs/reference/protocols/turn-envelope-v0.md,spec revision:3c7e0935fd6697291c5c432e5267816b4a667cfa。Captured replan reads / 捕获后的重规划读取 → implemented:每个 Turn 先读自己的完整复盘;实际选择、lease/quota 再验证仍归原 owner,显式 route、capture 与 display 选择继续传递。实现对应上述真实入口与正反例;本 PR 同步的说明不能反过来充当独立验收依据。上下文开关、选择状态和义务均复用既有语义,不新增词表、读确认或第二个资格规则。依当前仓库规定做本地必要验证;没有查询、轮询或等待远端 CI。
对主干的风险 / Risks
最强反例是机器默认 on、调用者明确 off 的未绑定复盘,另一个方向是 stale source 或错误 Todo 被误当成当前选择。这里分别验证了模式保留与拒绝后回到合法绑定入口;不是只检查新增字段存在。
| 验证 | base | 当前 head |
|---|---|---|
| 独立真实 CLI off/on 选择反例 | 2 FAIL | 2 PASS |
| 现行协议的 checkpoint preflight 对照 | 8 PASS | 8 PASS |
| 两个宽测模块 | 19 PASS / 36 FAIL | 21 PASS / 36 FAIL |
| TurnEnvelope / progressive-context TS | 未重复整组 | 49 PASS |
独立 CLI oracle 还验证错误 Todo、错误 source hash 均拒绝,随后合法选择可以恢复到有效 writer。公开回归入口是 uv run --extra test python -m pytest -q tests/control_plane/test_replan_staged_read.py::test_review_routes_to_selection_before_the_bound_writer。checkpoint 的八格对照保留原测试全部行为断言,仅用现行 recovery.command 的 selector 读取替代已过期的 recovery.path 断言;原宽测失败仍保留。
36 项宽测失败已逐项核对完整 failing identity、message 和规范化堆栈,与 immutable base 相同;主要是旧测试索引 raw packet 字段,而当前 Host 默认输出 native navigation,另四项仍期待旧 recovery.path。规范化仅去除临时运行路径、内存地址、派生 reader 文件名及严格对应的未改动源码行号,保留真实 source hash。Python 3.14.8、59 个包及版本、锁文件、fixture 和这些失败函数的 AST 已对齐,不以相同失败数量代替归因。optional maintainability smoke 的完整输出也与 base 相同,指向未修改的既有 oversized function,未放宽阈值或新增例外。初版 reviewer oracle 曾误收集 helper tests,原运行保留;修正 collection 后的独立结果另外列出,没有删减原断言或把旧失败改成成功。额外 oracle 保留在本次本地验证,未作为新仓库测试提交,公开复现应从上述已提交测试入口开始。
strict TypeScript、配置内 17 文件 mypy、变更 Python 的 Ruff、完整 semantic vocabulary smoke、双语 RFC gate 与 diff 检查均 PASS。Goal-managed premerge 的 6 项 direct checks 与 19 项选中检查没有阻断性失败;CQR 已通过并核验当前 scope。整体 premerge 仍是 manual_review_required(exit 1),原因是 benchmark_sensitive 人工合入门槛,不能写成全部通过。
我的整体评价 / Verdict
当前 exact head 未发现新的 actionable blocking finding,结论为 APPROVE。本次具名维护任务的可观察结果已闭合;长程执行维度为 preserved:原承诺、身份、重复恢复与结算边界仍在,未据此声称更高 benchmark 分数、真实模型理解或完整成本收益。用户体验维度为 improved:少一次无效导航并保留已表达的模式,已有授权不增加确认轮次。检查的是 quota/Heartbeat 的文本与命令路径,没有改动浏览器、App 或 Lark 的渲染页面,因此本次无需截图。无新增渲染表面;真实模型理解与打包 App/Lark 使用效果未在本次验证。
选择导航复用既有命令,当前消费者共同部署;保存的旧观察继续沿自己的原始 reader 读取。保留现存诊断与 benchmark 人工合入门槛,不把代码 review、原生 merge readiness 或维护者合入授权混为一体。任何 head/base 变化需要重新核验对应差异;本 review 不执行合入。
English verdict: APPROVE — the verified bounded repair preserves the original authority and recovery contract; disclosed integration and platform limits remain.
A heartbeat can reach its periodic review before it has chosen an eligible Todo. The review used to direct the caller to the writeback reader, which told it to return to the guard to choose a Todo. The review now points directly to the current guard's selection command. The caller chooses the Todo and reads the writeback format from the new, bound decision. Reviews already bound to a Todo or a standalone replan obligation keep their existing writeback route.
The generated selection command also carries an explicit context-delivery opt-out. Previously, starting with inline output and following the emitted command on a machine with progressive reads enabled could switch the same Turn to progressive output. The guard still evaluates eligibility and owns the binding. The staged reader remains read-only.
Replaying the same two isolated decisions through the real CLI removed one pre-selection read in each case. The review and optional premature writeback together produced 8,158 and 8,163 bytes on the previous route. The review alone returned 6,736 and 6,739 bytes on the new route. The bound writeback and review facts matched for the same source. These are local CLI outputs. Autonomous model requests, fees and native task scores have not been measured with this change.
Both context modes reached the originally chosen Todo and Turn. Invalid Todo selection and a stale source hash were rejected. The TypeScript typecheck and 74 related TypeScript tests passed. The two Python suites had 39 passes and the same eight failures as the main baseline (37 passes): four preflight tests expect a different recovery representation, and four standalone replan tests supply no Stride decision. Quick premerge found zero blocking check failures and reported one inherited maintainability advisory. Benchmark maintainer review is still required.