Repository navigation
fix(control-plane): keep invalid vision outcome recoverable - #8958
Conversation
Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
There was a problem hiding this comment.
Reviewer: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; runtime_reported; effort=max
动机 / Motivation
受影响的调用者:通过 refresh-state 提交 material closeout 并沿原 settlement identity 恢复 checkpoint 的 CLI/managed Agent。 修改前后的场景:非关闭 Vision 的 wait/ask_human/stop 路径曾被记为 satisfied,随后 outcome qualification 拒绝且 checkpoint-context 无法补记;head 将其保留为 missing_required。 可观察结果:同一 Goal/Agent/Todo/Turn 可取得 checkpoint-context,以证据判断补记 no_change,并安全重放,不另建工作 Turn 或产生额外 spend。 本次不包含:不放宽 outcome qualification、终态授权、收据新鲜度或 quota;不改变无 path、outcome_gap、in-flight 的兼容行为,也不安装或发布运行时。 这是在原契约中复现的具体缺口,不能用通过测试的数量替代这一行为判断。
评审先读 pre-change 契约 docs/reference/protocols/goal-vision-replan-contract-v0.md,固定 revision d519e985b2d6c6722a0c39d316c7138a03a2b32e,再读完整 diff。逐项核对的 criterion_id 为:Valid checkpoint decisions / missing_required;Read basis for checkpoint-only recovery / original identity;Read basis for checkpoint-only recovery / idempotency。以上条目在当前 head 的真实读取/恢复路径中得到验证;原先的权限、状态来源和结算要求保留。无 path 或缺少其他资格组件仍须由原 qualification 规则处理;本次只修复显式非法 path outcome 的恢复分类。
改动思路 / Approach
沿用 buildVisionCheckpoint / materialOutcomeCheckpointFailures 所在的既有 owner:refresh-state → shared TypeScript buildVisionCheckpoint → durable original writeback → checkpoint-context → checkpoint read receipt → original supplement/replay。以现有 closed lifecycle 和三种 continuation outcome 判断 material checkpoint 是否可满足;新 patch 和 unchanged 基线复用同一个 helper。Python 后续资格检查仍保留,checkpoint satisfied 也不能替代完整 outcome qualification。
复用搜索覆盖 base/head 的相关 provider、projection、checkpoint 和消费者。原 read-context 新鲜度、identity、补记提交和 replay owner 均未被替换;新增常量只是当前 TS owner 的局部合法子集,不是新的共享协议 vocabulary。 同域简化已经体现在共享条件/helper 中;为这项修复进一步拆模块或迁移无关 owner 没有必要。
沿用既有 owner,以直接条件/helper 完成这项有界修复。 架构边界:不放宽 outcome qualification、终态授权、收据新鲜度或 quota;不改变无 path、outcome_gap、in-flight 的兼容行为,也不安装或发布运行时。
具体改动 / Changes
完整检查了 4 个文件(+155/-8),生产入口 loopx/control_plane/goals/vision_checkpoint.ts 与 tests/control_plane/test_refresh_checkpoint_recovery.py 的回归分开判断。另检查了 TypeScript checkpoint 回归和 contract-health 中唯一的失效 import 删除;后者不改变运行行为。
独立验证:73 项 Python 检查、27 项 TypeScript checkpoint 测试、control-plane typecheck,以及六个独立的真实 File/SQLite CLI 恢复与重放探针全部通过。同一 synthetic harness 在不可变 base 与当前 head 执行,base 的六个独立非法路径 CLI 案例全部在原缺陷断言失败:checkpoint 错报 satisfied,context 无法补记;head 的对应反例通过。56 组完整 TypeScript checkpoint 对照中,50 组相同,六组为预期的非法 material patch/unchanged 改动;另验证了六组真实 CLI 在 base/head 的原身份恢复。TypeScript 矩阵比较完整 checkpoint JSON,未归一化决策或诊断。六个额外 CLI 案例分别覆盖 File/SQLite × wait/ask_human/stop,修复后补记沿同一 settlement identity,精确 replay 不再 append,spend 保持 0;这是未另发 spend 的恢复验证,不虚称完整生产扣次测量。
standard premerge 的 5 项直接检查和 10 项选中检查全部通过,变更 Python 文件的 Ruff 通过,CQR cqr_c6a3a7ffd911250e980d 有效。首次 standard premerge 因缺少本次精确 diff 的 CQR 保持阻断,完成独立质量判断并记录后重新运行通过。未查询、轮询或等待 CI;作者提到的历史 CI 原因只作为来源陈述,不冒充本次独立根因结论。
对主干的风险 / Risks
最强负例是 非关闭 material closeout 中的 wait/ask_human/stop 不能认证 checkpoint,但应能沿同一身份修复并重放。更严格的 missing_required 仅覆盖非关闭 material closeout 的显式非法 outcome;合法 outcome、终态、outcome_gap、in-flight 和无 path 的兼容返回逐项与 base 比较,不能把收据存在或指令建议误报成 outcome 已验收。
无 path 或缺少其他资格组件仍须由原 qualification 规则处理;本次只修复显式非法 path outcome 的恢复分类。 不把本地 correctness 改进扩写成模型遵从、长程收益、全成本、安装或发行资格。无新的可视页面、首屏或导航变更;本次未验证 installed App/Lark/browser presentation。回滚为撤销这项有界源码修复;执行/合并/安装权限仍由原 owner 决定。
我的整体评价 / Verdict
当前 head e2995555ef120ca3549ce408f0b915253c09f93f 未发现阻塞问题,APPROVE。该结论覆盖这里独立验证的修复边界;不授予 merge/admin bypass,也不表示当前线上运行时已采用。无 path 或缺少其他资格组件仍须由原 qualification 规则处理;本次只修复显式非法 path outcome 的恢复分类。
English verdict: APPROVE — e299555; no blocking finding. Real File/SQLite recovery, 56 checkpoint comparisons and standard premerge passed; installed/model qualification remains unverified.
A material closeout could persist an explicit
path_delta.outcomesuch aswait,ask_human, orstopas a satisfied Vision checkpoint even though outcome qualification only acceptscontinue,no_change, orreplan. The later qualification failure left the committed Turn unable to use checkpoint supplement recovery.This change marks that explicit invalid path decision as
missing_requiredwithpath_outcome_valid, so the same settlement identity can obtain checkpoint context and supplement a valid decision without another quota spend. It keeps existing behavior for packets without a path delta, closed lifecycle states, in-flight continuation, and administrativeoutcome_gapreporting.Validation:
npm run typecheck:control-planeloopx canary premerge --from-git-diff --tier quickgit diff --checkCI follow-up: current
maincontained a stale unused import intest_contract_health.py, which caused the repository-wide Ruff job to fail before affected suites could run. The second signed commit removes only that import; the full Ruff target and all 21 contract-health tests pass locally.