Repository navigation
fix(context): recover captured replans independently of registry routing - #7703
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: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
APPROVE · c802696f752dd538b3ab92c6c37a39fe9bccc173。未发现阻断项:原始失败可复现,修复只补入口分流,原读取校验和实时命令的拒绝边界均有实际调用证据。本记录为作者自审。
动机 / Motivation
Agent 在恢复已保存的重规划材料时会遇到这处故障。 默认运行目录冲突时,旧命令先报路由冲突;修复后原命令直接读取同一捕获,坏摘要仍由原读取器拒绝。 两个模块入口完成四类补读,原身份和权威文件保持不变。 这里的“捕获”指已经保存并带有预期摘要的完整决策材料;读取它不需要重新选择当前工作。旧失败会迫使操作者反复补参数,甚至误走另一次准入,因此原地修好既有读取入口有独立价值。本 PR 不包含安装、真实 Host 采用、整个 controller 迁移或完整收益资格。 C1/C2 的完整迁移、真实 Host 采用与全成本资格仍由现有负责人继续。
改动思路 / Approach
使用现有纯读取引导分流即可修复入口,摘要和结算语义继续归 TypeScript owner。 本次仅资格化已捕获材料的源码读取路径,完整 C1/C2 退出条件保持。 两个 Python 模块入口共用 resolve_cli_registry;修改只让已存在的 replan-view 和显式 context-read 一起走纯读取分支。文件读取、摘要与上下文匹配、不同 stage 的投影继续使用原实现,其他 quota 操作仍走原路由发现。生产代码没有净增行数,也没有引入配置、状态或新的 CLI 参数;实时命令的延迟导入结构保持。
选择这条边界的原因是:固定材料读取不需要活跃 Goal registry。给每条命令补路由或增加操作说明,会把无关配置复制到调用方;要求本修复完成整个 controller 迁移,又超出了已复现缺陷的必要范围。实际子进程对照证明,使用同一显式恢复路由时,旧版和修复版的四类读取正文完全一致。
具体改动 / Changes
规范依据为 docs/architecture/rfcs/controller-executor-unified-contract-v0.md,spec_revision:a36e01c32b0a290a96466c766629a0b01850f823。本次按以下原有条款检查,没有改写规范以迁就实现:
- Differential context:同一捕获恢复不重新准入或扣额。真实 File/SQLite producer 生成材料后,两个模块入口在冲突默认根、缺失无关 registry 和 host-global selector 下完成补读,registry、状态、runtime 和捕获文件的字节快照不变。
- Captured replan review, acceptance detail and writeback readers:决策审阅与后续写回格式继续保留原身份、内容和引用。
review、writeback、acceptance、explore均经过实际读取;写回计划仍绑定原 Goal、Agent 和 Turn。缺失引用、坏摘要、源丢失或畸形、内部 obligation 不匹配及不支持的 writeback contract 版本均由原 owner 拒绝。
关键代码讲解
- resolve_cli_registry 扩展现有纯读取分类。只有精确解析出的既有命令进入该分支,
should-run、spend-slot附带 capture flags 也不会得到豁免;没有用文案或子串推断命令权限。 - read_replan_view 的实现保持原样:检查 file/hash 引用、读取原 JSON,调用既有 TypeScript
replanView。它返回观察材料和原计划,不提交计划、不修改 lease,也不创建准入、回执或 debit。 - test_replan_stages_read_original_authority_capture_without_registry 复用现有 canonical fixture 和 native CLI,补齐真实 producer 到独立 reader 的边界。另一组负例检查错误优先级,原有 session 与实时路由回归继续保留。
对主干的风险 / Risks
最危险的反例是“任何带 capture 参数的命令都跳过路由”,这会扩大到实时权威操作。修改按命令精确分类,原有实时命令负例在相同冲突条件下仍拒绝。第二类风险是读取成功却更换身份或改写原始材料;真实 File/SQLite 快照、原身份断言及相同固定捕获的完整输出对照覆盖了这个边界。所有比较均通过实际模块入口,未用活跃 Goal 做测试夹具。
| 验证 | 结果 |
|---|---|
| 聚焦与相邻 context/replan 回归 | PASS,48 项,419.65 秒 |
| 原有 CLI 分支的 immutable base/head 对照 | PASS,每臂 21 次调用;仅归一化一次性测试根目录,完整 stdout/stderr/exit 一致 |
| 相同真实捕获的四 stage、双入口对照 | PASS,每臂 8 次调用,不做内容归一化,输出一致 |
| 原缺陷敏感性 | PASS,同一最终 harness 在原 base 因默认根冲突失败,修复版通过 |
| 标准 premerge 与 exact-scope 质量门 | PASS,6 direct / 2 catalog,当前源和范围匹配 |
首次 premerge 因新工作树缺少 TypeScript 开发依赖失败;补齐仓库声明的依赖后,同一完整门通过,源代码和检查条件未改变。最初两项负例仅因断言期待了错误用词失败,已改为检查实际 schema-version 拒绝,最终完整回归通过;原失败记录保留。这些先前失败没有被标记成原本通过。
语义与 CI 对齐
本次复用已有 CLI vocabulary 和 TypeScript semantic owner,没有新增协议词汇、抬高预算或缩小扫描范围。diff advisory 未发现其支持形式中的新 carrier;完整 semantic-vocabulary 与 maintainability 检查也通过。按照当前 capability 的 wait_for_ci=false,未读取、轮询或等待远端 CI;上述状态均来自精确源码的本地执行。
我的整体评价 / Verdict
这是 justified_increment:修复后的原生读取路径已经可用,可用一个 commit 撤回,完整 C1/C2 退出条件仍保留。长程维度判断为 preserved,依据是重复冷读和原结算身份不变;尚无模型实际采用或净收益结论。用户体验判断为 improved:操作者可使用原生成命令恢复材料,无需为无关目录冲突补写路由参数。 只修改 CLI 引导分流,检查的路径没有渲染页面或控件变化。 无新增可视表面;已安装 Host 行为未在本次源码评审中资格化。
本次有界重构直接复用了既有引导分流,没有新增 helper、兼容解码器或平行 authority。已安装 Host、其他平台打包和完整成果成本仍在本次源码资格之外。作者自审不代替独立批准,也不授予 merge 或 install 权限。
English verdict: APPROVE — c802696; no blocking finding in the bounded source repair. Native File/SQLite recovery, full CLI parity, 48 tests and standard premerge passed. Author-owned review only; merge authority is separate.
Captured replan commands could fail during default registry discovery before their digest-bound reader ran, even though the saved decision needs no live Goal route. Extend the existing capture-read bootstrap boundary to
quota replan-view, including incomplete references so the reader owns their recovery errors.The existing TypeScript owner still validates hashes, context bindings and writeback contract versions. Implicit native recovery and live quota commands retain their routing checks. This repairs the existing Agent conversation recovery path; it adds no capability, setting or frontend control. The adjacent refactoring pass reuses the current bootstrap classification and preserves lazy imports for live quota callers.
Validation at
c802696f752dd538b3ab92c6c37a39fe9bccc173:a36e01c32b0a290a96466c766629a0b01850f823. Base/head comparison preserves full stdout/stderr/exit for 21 original CLI calls per arm (only disposable roots normalized), plus 8 fixed-capture staged reads per arm with no normalization.npm ci --ignore-scripts, the same full gate passed without changing source or limits. Two initial negative-test assertions expected the wrong error wording; corrected schema-version assertions passed in the complete final run. Earlier failures remain recorded.This qualifies the source repair only. Installed Host adoption, wider C1/C2 migration and complete outcome-cost qualification remain with their existing owners. Merge and installation require their separate authority.