Repository navigation
fix(refresh): reject malformed vision before outcome refinement - #7578
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
把成果要求与 Vision 一起写回的 CLI 调用方一轮同时更新成果要求和 Vision 时,旧路径先提交成果再发现 Vision 无效,修正输入后原 CAS 已过期;新路径先拒绝畸形输入,原 operation 和 provider revision 可直接重试。仅报告“写回失败”会掩盖已经发生的成果修改,让一次输入纠正变成额外状态核对。
无效 JSON、path outcome 和 inline 超预算输入均不改变 provider/要求/投影;仅修正 Vision 后同一 operation applies once then replays。不包含全局安装、真实模型调用、新执行授权、调度器、合并或付费执行。
改动思路 / Approach
这是组合入口的一次纯校验调用,复用现有 typed rule,不执行 IO;依赖当前状态的政策判断和回执恢复仍归原 writer。只有同时提供 outcome update 和 Vision 才执行 preflight,校验在 refine_goal_outcome 之前;JSON 和 inline 先归一成同一 packet。
预检使用现有 prepare_vision_refresh,不合并当前 Vision,也不要求依赖历史的 path delta,因此不会另造第二套状态判断。真正的 refresh_state_run 之后仍执行原来的 merge、replan 和政策校验。本 PR 只提前拒绝 outcome refinement 前的畸形输入,后续 stateful failure 保留原有 outcome receipt 语义。
具体改动 / Changes
完整 diff 为两路径 +55/-0,其中 13 行 production 代码复用现有纯 validator,其余是真实 File/SQLite 的拒绝与重试回归。实施前已核对 Vision/replan contract 与 goal acceptance input/error boundary,spec_revision:1a7234c2afcc3fd7897b63d5bab78d3e6a9f7959。
原文无 criterion ID,reviewer labels 的对应为:VR-budgets 既有字段/列表/总预算拒绝,VR-input-parity JSON/inline 一致校验,VR-no-effects 无效输入无 durable prefix,VR-retry 原 CAS/operation 正确重放,VR-stateful-boundary 后续失败与已提交回执仍由原 owner 负责;五项在本 head 均 implemented。没有把新测试自己的断言提升为规范,也未引入新的预算或输入分类启发式。
关键代码讲解
handle_refresh_state_command在两个输入都存在时,先以准确 Goal/Agent 调用 prepare,再进入可能持久化的 refinement;错误沿现有 CLI 边界返回。缺少任一输入的原分支不增加校验阶段。prepareVisionRefresh是未改动的 TS owner,继续校验字段、身份、path 形状和预算;preflight 只复用其纯 prepare 阶段。真实写回仍提供当前 Vision、merge 和策略参数,预检结果不会充当最终接受证明。
对主干的风险 / Risks
最强反例是“CLI 已拒绝,但 provider revision 与成果要求悄悄变化”。独立测试对 wrong Goal、非法 path outcome、inline 421/420 超预算三类输入,在 File/SQLite 上比较完整 canonical inspect和原 state 文件;base 的 6 项均暴露修改,新 head 的 6 项全部保持原状态。仅纠正 Vision 后,同一 operation/CAS 先 applied 后 replayed,outcome revision 仍为 1。47 条实际 composition/native retry 回归也通过,包含 dry run、合法输入及后续写回故障。
首版独立 probe 使用了不存在的 inline 参数,两个解析失败不具资格;更正为既有 --vision-acceptance 后才得到上述 matched base/head 结果,原失败保留。
标准 premerge:6 项 direct check 通过,5 项 selected check 中 4 项通过。FAIL 保留:quota_should_run/multi_agent/json emitted 25836 chars; baseline ceiling is 25500。相同 required 命令在 immutable base 同样失败,固定 fixture 的 96 项完整 CLI 观察无新增 semantic/structural/growth differential;该场景不经过本次 combined-input seam。独立变化不变量已有反例与正向证据,所以此 red check 归为 pre-existing unrelated,不据此否定本修复,也不放宽预算或把 CQR/merge gate 改绿。
后续依赖当前状态的写回失败仍可能发生;它保留已经提交的 outcome receipt,不承诺跨两个阶段的事务原子性。正式运行采用和长期成本收益未测。没有查询、轮询或等待远端 CI。
我的整体评价 / Verdict
批准准确 head fe3196c6ecdcdb750948a47fd0250410ac4644df。long_horizon 的局部改善是输入纠正后沿原事务继续、要求与来源不丢失;user_experience 的改善是只纠正坏输入,不另建 operation、不重输已知要求或追加确认。13 行代码直接复用已有 typed owner,范围相称,无新状态、Enum、兼容层、配置或执行授权。
只改 CLI handler 顺序和回归测试,没有改变可渲染的产品界面。后续依赖当前状态的写回失败仍可能发生;它保留已经提交的 outcome receipt,不承诺跨两个阶段的事务原子性。正式运行采用和长期成本收益未测。预算/CQR 和独立的合并资格保持原边界。
English verdict: APPROVE the exact-head input-ordering fix; preserve the unrelated budget failure and existing stateful writeback limits.
A batched
refresh-statecould commit outcome refinement before rejecting a malformed vision packet. Correcting the packet then encountered a changed basis even though no valid writeback had completed.Validate the supplied vision through the existing typed owner before outcome mutation. The original packet still goes through state-dependent refresh validation; this does not claim atomicity across later state or delivery failures. No new state vocabulary or authority is introduced.
Validation: 47 tests passed across outcome refinement, real CLI outcome/replan composition and native retry (including File/SQLite, invalid identity/length/list bounds, unchanged provider revision, corrected same-identity retry and replay). Ruff, diff hygiene, compile, bilingual, maintainability and semantic checks passed. Premerge remains failed on the CLI output budget: the base and candidate both emit 25,836 characters against the existing 25,500 ceiling for multi-agent quota. The unrelated budget is unchanged.
Scope: CLI composition through the existing goal outcome/vision owners; no new capability or frontend workflow. Review and merge qualification remain open.