Repository navigation
Check composed settlement in the native first-read tests - #9019
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.2-sol · OpenAI (runtime_reported, max)
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
原生 first-read 需要完整交付原 Turn 的结算约定,并继续支持按需打开 fallback。C1 ready guard 现将扣额折叠到组合回写,旧测试仍硬读第二条命令。同条件 File 与 SQLite 基线都误报失败,候选测试核对现有 v2 的一条组合命令和 runtime 回执。审查覆盖测试对既有命令与读回语义的验证。
改动思路 / Approach
沿用现有 File 与 SQLite 的真实 CLI fixture。原分离命令断言改为验证 v2 的组合回写和 runtime 扣额回执,分页、同一原 Turn、按需直读 fallback 和只读不扣额的验证继续执行。本次只调整原生 first-read 资格测试。先复现基线异常,再比对同一份 CLI 捕获的完整初始页、显式选择和保存的原字节,并逐项扰动新断言。
具体改动 / Changes
精确 head 13341db8c1efbaabf532534cd09f62a0d42278b6,diff base 648d06db542075dc023caeeb11ea368b35ef7ab7,1 个文件 +13/-7。逐项复核 runtime-spend-owner、exact-fallback、read-only-replay。验收约定
关键代码讲解
- 原生 guard 在 File 与 SQLite 上产生真实 v2 plan。测试断言 writeback 是 Agent 命令,quota_spend 由 runtime 持有、必须给出扣额回执,自己没有第二条调用命令。源码
- 组合命令要同时包含 settle-turn 和 settlement-receipt。初读只省略同一条 fallback 的重复展示,显式选择仍须返回原命令。源码
- 页序与原 SHA 保持匹配,读完核对原 Todo、收据、文件 bytes,并确认只发生一次准入,零扣额。源码
- 五个原有 v1 反例各自保留不同参数、顺序、未就绪、其他 effect 或未知 plan 的 fallback。另用实际捕获对新断言逐一扰动。源码
对主干的风险 / Risks
基线 File 与 SQLite 两项都在旧的 command_template 断言失败,既有五个反例通过。候选七个聚焦测试和完整 first-read/settlement 的 173 项测试通过。两种真实捕获分别拒绝六种异常计划或展现。标准预检五项直接检查通过,真实已装 Host 仍属后续验收。
语义与 CI 对齐
组合写回和 runtime 扣额同属原结算身份。初读不展示冗余命令,按需读回仍验证同一份原始捕获。
我的整体评价 / Verdict
通过本轮独立评审。原误报在两种后端可复现,修改后的断言能识别第二条扣额命令、回执缺失和意外 fallback。完整分页和只读不扣额的既有约束均在实跑中保持。
English verdict: APPROVE. The regression test now checks the shipped v2 composed settlement and preserves exact fallback, original identity, pagination, and zero debit from reads.
The native first-read tests still expect separate writeback and spend commands. The ready CLI now delivers a v2 settlement plan with one composed writeback command and a runtime-owned spend step.
Check the combined command and spend receipt on both File and SQLite, preserve the exact fallback when explicitly read, and keep the existing checks for complete first-read pagination, original Turn binding, and zero spend from reading. The legacy v1 negative controls still cover divergent fallback routes.
Both affected cases failed on the base with a missing command template. The seven focused File, SQLite, and fallback cases pass on this change, along with the quick premerge check.