Repository navigation
Exercise routed hard-lease settlement and replay - #8852
Conversation
Follow the composed writeback for a hard lease and inspect the runtime-owned quota receipt. Keep the legacy split route under test and prove that both settle the original Turn once through the selected CLI. 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)
评审提交 33f359cdc13024eec3c31f2d82564a656ebe6ee7,原 PR base 为 59e68906d4082f43fae52e4219e374c5e97539a9。最新主干 cac86bbad92ba99c3430b3f7eaa9632727573821 的原测试文件与该 base 一致。
动机 / Motivation
维护显式指定 LoopX CLI 的宿主和包运行者。
旧测试把每个 settlement step 当成 agent 的 shell 命令。Hard lease 的 debit 已由 runtime 执行,旧测试读不到 command_template,四个组合在真正写回和重放之前停止。 CLI 选错安装会影响实际恢复和结算。同一非默认 console alias,真实 quota 准入后执行原生成命令,读取原 step receipts,并重试两种委派模式。现在两种 CLI 名称都走到实际写回和扣额。File、SQLite 的 hard lease 与 soft claim 都只追加一次,重放按原身份返回。
本地验证涵盖两个存储后端、POSIX console alias 与隔离的 Core wheel。Windows console route 和已部署宿主未纳入。
改动思路 / Approach
从现有 typed plan 取得 owner=agent 的命令。Hard lease 执行原生成 refresh-state --settle-turn --settlement-receipt 并核对三个回执。Soft claim 执行同一原 route 的 owed command。复跑实际命令,检查状态、效果身份和原事件计数。 测试使用真正的 console alias 和一个会写标记并失败的默认 loopx,可检测命令意外落入默认运行时。
具体改动 / Changes
改动限于 tests/control_plane/test_cli_program_route.py,新增 47 行、删除 9 行。既有 docs/reference/protocols/turn-envelope-v0.md 对照三个要求。 原契约
- originating-cli-route。组合结算继续使用发出该命令的 CLI 实现。 当前测试通过。
- original-effect-once。原轮的组合回写只追加一次,精确重试保留原身份及回执。 当前测试通过。
- ordinary-split-route。普通 refresh 保留原有分步结算。 当前测试通过。
关键代码讲解
test_generated_commands_stay_on_candidate_through_once_only_settlement。保留错误 Todo 恢复和生成 route 断言。Hard lease 从实际组合回写读出原串联回执,soft claim 从返回的 owed route 拿到下一命令。最后同时核对一个 writeback、一个 debit、原结算状态及没有默认 console 标记。 测试- 组合结算 plan owner。原 owner 决定哪些步骤拥有 argv。只执行 agent 的命令能检验现有流程,而 runtime 的 debit 必须在原回写结果中读回。 类型与 owner
对主干的风险 / Risks
- 基线同环境 37 项通过、四项 hard lease 因
KeyError: command_template失败。候选在同一文件通过 41 项。另有 97 项相邻结算与租约恢复回归通过。先用未投影的 Todo 调真实 guard,拒绝且零 heartbeat 回执、零 debit。运行原 recovery 后,最终重复结算无新增事件。旧主干 hard lease 四种组合均在读command_template时失败。 - 用同一精确 checkout 构建 Core wheel,实际环境运行两种名称及两个后端的全部 8 个结算组合通过。Quick premerge 的四项直接检查及 Python 编译均通过,最新主干合并树无冲突。
我的整体评价 / Verdict
通过当前提交。它让此前中断的四种 hard lease 路由走到真实结算,也保留 soft claim 的单次写入与结算回放断言。该修改应留在现有端到端测试,验证原入口和实际事件,避免维护第二套 smoke。
English verdict: APPROVE on 33f359cdc13024eec3c31f2d82564a656ebe6ee7. The routed test executes both composed and split settlement, confirming one writeback and one debit through exact replay on File and SQLite.
Problem
The routed CLI regression tests assumed that every settlement step supplied a shell command. The current hard-lease plan runs the quota debit inside the generated writeback command and returns the spend receipt as a runtime-owned step. All four hard-lease cases stopped at
KeyError: command_templatebefore testing settlement or replay. Composed settlement contract in #8396Change
Execute the generated writeback through the selected CLI for a hard lease. Check the validation, durable writeback and spend receipts against the original effect identity, then retry the same command and verify that the receipts are identical. Keep the soft-claim test on its existing split writeback and spend route. Both routes must record exactly one writeback and one debit, and the test still poisons the ambient executable so an escaped command fails.
Validation
59e68906d4before the test correction. The focused route, native settlement and generated-command suites passed 102 cases on this commit.loopx-corewheel. Two additional installed Core composed-settlement cases passed with default and explicit invocation routes.