Repository navigation
test(control-plane): exercise native child admission with current fixtures - #5955
Conversation
Signed-off-by: hyk <4408344+hhyykk@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=xhigh
精确 head cb2176331a3941f6d7cfa2e16b44cf5292e4eaa6,不可变基线 05af21dd4cbc8256af1da9746a34abc13085cfd3。未发现阻塞项。
动机
维护 native-child 与重规划回归测试的开发者,需要这些测试真正进入选择、关闭和拒绝陈旧 successor 的分支。
原先单个 Todo 的 fixture 已被自动绑定,却还断言未绑定;现在用十五个已认领候选明确触发长链 review,再检查显式选择及原 receipt 重放,关闭前提供有证据的 Vision 路径。
独立运行确认三模块 36 项通过,并仍拒绝未选择的 native-child、新的关闭后操作和失效 successor,保持原 receipt、单次 ACK 与单次 spend。
这项测试修复不修改生产 admission、持久协议、调度权限或前端,也不声明全仓库 CI 健康。
改动思路
修复现有 fixture,让它进入原本要验证的真实分支,而不是修改生产规则或单纯把失败 exit code 改成成功。独立依据是 05af21dd4cbc8256af1da9746a34abc13085cfd3 的 docs/reference/protocols/goal-vision-replan-contract-v0.md:Replan Triggers 的十五项自身已认领推进任务阈值,Replan Output 的证据关联 Vision 出口,以及 CLI Budget 的原 Turn 身份与 successor 当前资格。配套 turn-envelope-v0.md 明确显式选择须重新核验当前资格,推荐本身不授予 settlement。
具体改动
tests/control_plane/test_native_child_replan_guard_cli.py:复用_fixture生成十五项已认领候选,核验真实selection_required和欠绑定 receipt;选择前 native-child 必须拒绝,显式选取后绑定原 Todo,同 Turn 重放保留原 identity/event。tests/control_plane/test_native_child_closeout_cli.py:关闭前提供完整、有验收摘要与证据的 Vision path,检查fresh_vision_path_outcome的持久 ACK,保留 completed/failed/cancelled 迟到结果、关闭后新操作拒绝与单次 spend,并增加单次 ACK 断言。tests/control_plane/test_replan_successor_guard_reentry.py:清除 successor claim 后一律 fail closed,且保留原 settlement identity/event;wrong-owner/deferred 与陈旧创建 ACK 仍不能接管原 Turn 或结算。
独立运行三个模块,head 36 passed /242.92s;同命令在不可变 base 原测试为 26 passed、10 failed /167.04s。逐项对应六个缺少 material Vision 的关闭案例、两个单候选 fixture 的错误未绑定假设、两个 cleared-claim 的旧成功预期;没有把该失败描述为生产缺陷。git diff base head -- loopx apps packages 为空;我独立读取原 typed replan/receipt owner 与上述接受契约,确认期望不是从新测试输出反推。Ruff 通过;premerge 4 direct +7 selected 全通过,无失败/manual hold。没有查询或等待 CI。
对主干的风险
风险集中在测试是否掩盖原身份、重复 ACK/spend 或关闭后的越权执行。本改动继续通过真实 sys.executable -m loopx.cli、隔离 File/SQLite 后端及持久历史/ledger 核验,没有 mock 关键结果,没有删除原拒绝和迟到结果断言,也不修改 active Goal。前端、Lark 和公共 CLI 生产契约没有变化,无 companion UI 缺口。未证明全仓库 CI 或 PostgreSQL 资格;本 PR 没有修改这些生产边界。
我的整体评价
APPROVE。这是有实际维护价值的现有测试修复:独立复现了旧 fixture 的十个失败,并恢复其 intended 分支覆盖;不是只增加 test count 或同形 scaffold。同作者近期相关 PR 涉及不同的 material/periodic/quota 行为,未发现本批重复灌水。未来演进检查已落实到现有共享 fixture 与更强持久断言;不需要另加一套 admission 解释器或烟雾测试。批准后仍执行原生 closeout,合并权限另行判断。
English verdict: APPROVE - cb21763; test-only repair restores actual multi-candidate admission, evidence-linked closeout and fail-closed stale-successor coverage. Independent 36-case File/SQLite CLI suite, immutable-base failure comparison, empty production diff, Ruff and 4 direct/7 selected premerge checks passed; no CI status was queried.
Native-child CLI tests assumed that a single claimed Todo leaves the Turn unbound and that unchanged Vision prose can acknowledge a long-chain replan. Current admission binds a single candidate automatically; long-chain replans require an evidence-linked path change. Those fixtures therefore missed the transitions their assertions were meant to guard.
This test-only repair uses a real multi-candidate long-chain fixture, verifies that explicit selection binds and replays the original receipt, and supplies an evidence-linked material Vision for closeout. It also expects an unclaimed successor to fail closed while retaining the original receipt. Existing late-result, post-closeout denial, single-ACK and single-spend assertions remain intact. No production rule or persisted contract changes.
Validation on main
05af21dd4cbc8256af1da9746a34abc13085cfd3plus this commit: all 36 tests in the three affected modules passed; an independent contract review also passed all 36. Risk-based premerge validation passed 4 direct and 7 selected checks. The future-facing pass strengthened the existing fixtures rather than adding a second admission model. These focused results do not establish whole-repository CI health.