Repository navigation
test(settlement): qualify current Host readback in full settlement chains - #6285
Conversation
Signed-off-by: song <liusongstep@gmail.com>
songoow
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | GPT-6 | OpenAI | self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Exact head: 277dab815eb8dba20ff1ca6256009589a1675a85。这是作者账户下的模型自评,不代表维护者批准或合并授权。
动机
维护结算流程的开发者需要一条能检查真实宿主读回、调度确认和重复扣费的集成测试。当前宿主读回规则合入后,三个原有结算场景仍在没有宿主记录时期待确认成功,因此主线测试失败在调度确认处。现在先证明缺失和错误读回被拒绝,再提供匹配的隔离记录,验证原确认命令只写一次并可安全重放。
本改动只修复测试输入与新增必要断言,不修改生产调度、权限、扣费或入口路由。实际 App 更新、定时唤醒与已安装启动器仍需要各自的验收;#4447 的剩余来源含义及完整主线集成验收没有因此关闭。
改动思路
复用 examples/control_plane/quota_plan_fixtures.py::write_codex_heartbeat_fixture,不新增 TOML 解析器或返回成功的模拟 reader。仅两个测试函数显式申请独立的 scheduler_host_home,给生产 resolve_codex_app_automation_rrule 和真实 CLI 子进程提供临时合成记录;其他测试不启用这个 fixture。
_prepare_scheduler_host_readback 先执行同一个原始 ACK 参数向量:第一次没有记录,第二次实际记录为不同 RRULE。两次都必须返回 typed rrule_mismatch、真实 observed 值和 written=false,独立 scheduler store 读取仍为空,已有 quota debit 仍恰为一次。随后只更新临时 manifest,交回原场景完成成功 ACK、持久化读回和原有字节级 replay 检查。这样补齐前提,也防止把缺失读回静默当成功。
具体改动
仅 tests/control_plane/test_quota_settlement_cli.py 一处变化,新增 43 行、删除 2 行;loopx/、apps/、packages/ 全部生产字节与基线相同。没有新的状态、协议、开关、CLI 或 UI。
关键内容讲解
scheduler_host_home(52 行)为该场景设置隔离的 automation 根目录和匹配的线程 ID;不读写操作者的 App 数据。_prepare_scheduler_host_readback(59 行)比较请求 RRULE 与实际 reader 看到的值,失败分支检查持久化为空和单次扣费,随后更新合成输入。它不修改生成的 ACK 命令、不传入伪造成功结果。test_standard_codex_app_settlement_is_receipted_and_idempotent保留旧 Turn 被新 guard 取代后的拒绝,以及原结算链不重复扣费的检查;新增当前 Turn 在成功 ACK 后的last_applied_rrule独立读回。test_todoless_autonomous_replan_settles_quota_refresh_spend_chain的 qualified-vision 与 missing-vision 两个分支使用同样读回前提;验收、writeback、spend、下一 Turn 和重复执行检查均保留。
规格依据:docs/architecture/rfcs/automatic-execution-admission-v0.md,固定版本 c464cf3。§5 Host contracts 要求确认前读取当前匹配宿主,缺失或不匹配不得写入;这条测试链现有正反例。§9 App honesty 的 desired/observed 拒绝语义在真实文件读回/CLI 路径上获得覆盖;实际 App API、elapsed timer 和安装采用保持其原有独立验收范围。本 PR 没有修改规格使其迁就测试。
对主干的风险
主要风险是用编造的成功读回把测试刷绿,或让共享 fixture 改变其他测试的环境。本次 helper 只写合成 manifest,当前值经生产 reader 读取,且两个错误状态必须先失败;fixture 仅由目标函数显式请求。完整测试文件与相邻宿主绑定测试 112 passed,0 skipped,覆盖 scoped fixture 之外的既有分支。另有 34 项 TypeScript 调度测试通过;Ruff、diff/compile、premerge 选择的 3 项 canary通过。
不可变基线上的原三个场景均失败,修复后均通过。开发过程曾误断言拒绝结果含 scheduler_state_mutated 顶层字段;实际拒绝契约没有该字段,已改为检查真实 scheduler_commit.observed_host_rrule、written=false 和独立存储读取,而非忽略失败或放宽生产规则。
查过现有 host-binding/launcher 覆盖和同作者批次:#6276 处理安装启动器及另一个测试文件,#6268 处理选择准入,本改动不复制其实现。现有 _write fixture 已复用,没有另加单独 smoke、运行框架或新文件。远端检查当前有排队、取消和跳过记录;本地证据独立覆盖这一测试修复,远端 CI/合并门仍须单独满足,未把取消视为通过。
我的整体评价
APPROVE,作为有界集成验证修复。 长期推进方面,它恢复了结算后调度读回和单次扣费的持续回归保护;用户体验方面没有产品入口变化,生产行为保持一致。完整 diff 只有一处测试文件,维护成本相称,未来相关改动仍复用既有 Host reader 和 typed scheduler owner。未发现当前阻塞项。
它证明的是原生 reader 对隔离合成记录的处理及真实结算 CLI 链路,不能证明实际 App API 更新、定时触发、主线已合入或 #4447 全部完成。另行组合 #6251/#6268/#6270/#6285 的私有验证分支已有相关测试通过,但那是候选组合证据,不替代这些 PR 各自的评审与正式主线验收。本结论不授权合并或部署。
English verdict: APPROVE - 277dab8. Existing settlement fixtures now exercise missing/mismatched current Host refusal, independent schedule readback and idempotent ACK without changing production behavior. 112 Python tests, 34 adjacent TS tests and selected premerge checks pass. Synthetic manifests do not qualify live App updates or timer execution; merge remains separate.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; xhigh.
APPROVE — 独立核验 277dab8,没有当前阻断项。
动机
维护结算与调度的贡献者需要完整链路能分辨真正的宿主观察和仅仅请求成功。 原三个结算测试在没有宿主记录时要求 ACK 成功,主干报 rrule_mismatch;现在先证明缺失和错误记录被拒绝,再提供匹配记录,原链继续且只扣一次。 原失败链在当前评审 head 和独立当前主干组合中恢复;撤掉匹配记录仍会失败,没有刷绿或重复扣费。 这只是测试修复,不改变生产调度,也不证明真实 App 更新、定时触发或整个 #4447 完成。 真实宿主/安装态资格与 #4447 最终集成验收继续独立开放。
改动思路
复用现有 synthetic manifest helper、实际 Host reader 和原生 CLI,分别验证拒绝、恢复和持续 replay;不增加返回成功的 reader mock 或第二份调度规则。冻结规格 docs/architecture/rfcs/automatic-execution-admission-v0.md,revision c464cf3:Host-contracts 要求当前匹配观察才能 ACK,缺失/不匹配须在写入前拒绝;App-honesty 要区分 desired/observed,真实 App 操作保持独立范围。
具体改动
完整 diff 仅 tests/control_plane/test_quota_settlement_cli.py,+43/-2;生产 loopx/apps/packages 完全相同。
scheduler_host_home是目标函数显式申请的临时环境,不是 autouse;不会把整个测试文件的宿主根改掉。_prepare_scheduler_host_readback将同一原 ACK 参数依次交给真实 CLI,观察不存在和错误周期,核对 rrule_mismatch、written=false、实际 observed 值、独立 scheduler store 为空、已有 quota debit 恰一次;最后只更新合成 manifest。- ordinary settlement 保留旧 Turn 被 supersede 的拒绝。两种 Todo-less replan 保留 vision、validation/writeback/spend、后续 Turn 和 replay;匹配成功后独立读取 last_applied_rrule,原字节稳定性断言保留。
独立完整结算文件+宿主绑定套件 112 passed、无 skip,耗时354.88秒;相邻两组 typed scheduler 30 passed,Ruff通过。冻结 base 的原三个场景 3 failed,相同 ACK 阶段;评审 head 完整通过。额外将最终匹配 manifest 写入撤掉后,原 ordinary 链仍正确失败,reader 实际观察错误周期并不写入。当前主干 509c38c502d3d0b4eafb01550efcdc4b5b5a1d17 另建隔离组合加本补丁,原三个场景 3 passed;该未提交组合不是已合入 revision。
对主干的风险
最主要风险是用伪造成功、删除断言或通用环境变化掩盖缺口。本次文件会先通过实际 reader 的两个拒绝分支,独立读 store、quota 次数和 replay 字节;mutation 又证明必须有匹配观察才能继续。只改两个测试函数的 fixture 请求,生产权限/旧身份/额度不变。查过现有 host-binding、兼容 transport 和同作者批次:既有低层测试并不替代这两条完整结算链;#6276 launcher 和 #6270 来源见证属于不同缺口,不构成同形 smoke 重复。没有另建测试框架或日志入库。
验证过程一次文件名错误未运行任何测试,独立 mutation 初次缺源码 examples 导入路径也失败;错误均保留,之后用显式路径/源码/argv/RC 记录校正,未计入通过数。未查询或等待 CI。合成文件只能证明原生 reader、结算恢复与单次扣费,不证明用户 App 定时器或安装升级成功。
我的整体评价
这是有用的内部验证修复:长期可防宿主观察缺失被刷绿,也减少维护者追查错误 fixture 的成本;生产用户步骤和执行效率保持,不以测试数证明业务收益。未来相关改动继续使用现有 helper/typed owner,无需另抽框架。#4447 完整验收和 live Host 资格仍独立;此次 review 不授予合并或升级权限。
English verdict: APPROVE — 277dab8; independent112 Python/30 TS pass, immutable base reproduces3 failures, withholding matching observation makes the repaired chain fail, and the current-main isolated combination passes3 original scenarios. Production unchanged; real App/timer qualification and merge remain separate.
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEADFor a same-repository clone whose Keep the DCO |
Retain stale-receipt refusal and share missing/mismatched Host evidence fixtures with persisted readback assertions. Signed-off-by: song <liusongstep@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; xhigh
Exact head: f6c8aae7a7e8ba917861992a1ad21eb29477bf26
动机
维护结算与定时调度测试的贡献者。
当前基线的三个结算场景已经通过;这版进一步让完整结算链先拒绝缺失、错误的宿主记录,再核对真正保存的周期和重复执行后的状态。
实际 CLI 拒绝两个错误观察且不写调度、不重复扣费;提供匹配记录后只写一次,重复执行保持原状态字节。
范围仅为现有测试的输入和断言,不改变生产调度、权限、额度或用户界面,也不证明真实 App 更新、定时触发或安装采用。
真实 App/定时器资格与 #4447 的来源整合仍由各自 owner 独立验收,本 PR 不把额外断言作为旧 ACK 修复或 issue 关闭的新前提。
当前 #4447 的 delivery status 已明确:#6344 在主干修复了原来的三项失败,#6285 是额外 fixture 复用、普通 Turn 反例和应用周期读回。我在当前不可变基线 60d833b13c85135587b725013b247e827663ffb9 实测三个原场景均通过,因此没有把历史三红当作当前阻塞,也没有将此增强设置为该 issue 的新增关闭条件。
改动思路
继续使用生产 Host reader 和已有 TypeScript 调度提交规则。测试只写独立的合成宿主 manifest,再执行原始 ACK 参数;ACK 是宿主周期更新后的确认,不能由“请求了某周期”冒充“实际已更新”。一个非自动启用的 fixture 只供目标函数申请,一个 helper 收拢重复的准备和拒绝检查;不存在新 reader mock 或并行调度规则。
规范依据:docs/architecture/rfcs/automatic-execution-admission-v0.md,不可变 revision 60d833b13c85135587b725013b247e827663ffb9,与当前 PR 中的规范字节相同。§5 Host contracts 要求确认前读取当前匹配宿主,缺失/不匹配不得写入;§9 App honesty 区分 desired 与 observed 并禁止以此宣称零成本唤醒。这两项在真实 CLI/Node/临时文件路径得到验证。§11 M2 的实际 App/timer/hook 资格在 RFC 中有独立边界,本次测试增强不完成它。
具体改动
全 diff 只有 tests/control_plane/test_quota_settlement_cli.py,+47/-37。loopx/、apps/、packages/、docs/、skills/、scripts/、pyproject 和原 heartbeat writer 的 Git tree/blob 与基线完全一致。没有新增能力、共享状态或生产开关。
scheduler_host_home(52 行)设置临时 CODEX_HOME 和绑定线程,只有普通结算与参数化 Todo-less 函数显式请求,不能改变整个文件的宿主环境。_prepare_scheduler_host_readback(59 行)依次制造缺失/错误实际记录,用原 ACK 检查 typed 拒绝、observed 值、written=false、独立 store 仍为空以及已有扣费仍一次;随后只更新临时观察。test_standard_codex_app_settlement_is_receipted_and_idempotent(2730 行)保留旧 Turn 的 stale 拒绝、新 Turn 准入和重放;新增普通链的两项错误观察、成功后的last_applied_rrule独立读回。test_todoless_autonomous_replan_settles_quota_refresh_spend_chain(5634 行)的 qualified/missing-vision 两支复用 helper,原 validation/writeback/spend、后续轮次和 scheduler bytes 不变的断言保留;没有把缺失 Vision 变成完成。
对主干的风险
最强风险是 fixture 伪造成功或删掉有效保护。本次独立完整结算文件加 Host-binding 套件 112 passed / 0 skipped,176.88 秒。额外 probe 仅将三个场景的 subprocess 入口从 loopx.cli 换成公开 loopx.entrypoint,真实 reader、Node、临时 receipt/store 全保留,3 passed。
另一个故意突变只撤掉 helper 最后的匹配 manifest 写入;原断言和真实决策不变,三个场景全部在期待成功的 ACK 处失败(2967/5813 行,实际 scheduler-ack ok=false、退出 1)。这证明测试需要实际匹配观察,不是靠构造一份成功结果刷绿。常规测试的缺失/错误读回拒绝及独立存储断言均已通过。突变失败是预期反例,不是 PR 的生产失败。
相邻 typed scheduler state/store 21 passed;Ruff、diff/compile、语义 advisory 后的完整 semantic smoke 通过;native premerge 的 4 项直接检查与 3 项 catalog canary 全通过、无 hold。当前主干的七个实际 Host reader/调度消费者与本 head 对应 blob 相同。未查询或等待 CI;这些临时合成记录没有认证 native Windows、真实 App 更新、elapsed timer、安装升级或付费模型。
现有低层 Host-binding 覆盖与这条完整结算链各司其职;作者批次中的选择准入、来源证据和 launcher 修复有不同 owning boundary,没有用新 smoke 复制它们。整个文件很大,但这次以净增十行收拢已有重复准备,不需要借机扩大模块迁移。已执行相邻重构判断:当前 scoped fixture/helper 是合适的有界收敛。
我的整体评价
APPROVE;没有当前阻塞项。 增量的正向价值在回归保护和维护效率:普通结算、重规划、后续身份与一次扣费的长链更难被错误宿主事实刷绿,重复 fixture 准备也被收拢。用户的生产操作与等待规则保持;没有测出实际业务速度、模型成本或长期运行净收益。记忆中关于 RFC 交付顺序的建议不适用于要求这份内部测试 PR 新做一个 App 旅程;当前 issue/frame 与实际正反例才决定结论。
建议更新 PR 描述中的旧 head 277dab815eb8dba20ff1ca6256009589a1675a85 和旧“三失败”背景,补充当前 f6c8/60d 的增强定位与结果,避免把已合入的修复再次计为本 PR 产物。该描述建议不否定目前已验证的增强。批准不授予 merge/升级权限,也不关闭 #4447。
English verdict: APPROVE - f6c8aae. This test-only enhancement consolidates Host fixtures and adds full-chain refusal and persisted-schedule checks; current base's three original scenarios already pass. Independent112 Python/21 TS and public-entrypoint3 pass; withholding only the matching manifest makes all3 original success oracles fail. Production unchanged; live App/timer/platform qualification and merge remain separate.
#6270 merged as 1c2542d on 2026-10-14 and #6285 merged as 5ea7497 on 2026-10-13, but RFC section 11 and the 2026-10-12 registered-source ledger (en/zh) still describe the inventory as proposed and #6285 as an open proposal. Update both language versions to the merged state and record the candidate Stage 3 readback at c185e3f: 663 domain+monitor, 706 semantic/value-note, 448 native TypeScript and 211 critical cases pass with no skips, drift smoke 26/26 with F1/F2 6/26. The failing full-suite test test_effect_interpreter_packet.py::test_real_executor_uses_verdict_and_replays_persisted_plan and the untested installed frontend/live-model/whole-tree F6 surfaces are stated explicitly. Final owner acceptance stays open; the readback is a candidate record, not acceptance. Signed-off-by: song <liusongstep@gmail.com>
After the current-Host readback requirement landed, three existing settlement CLI scenarios still expected scheduler ACK success without an observed Host schedule. They fail on current main with
rrule_mismatchand no scheduler write.Reuse the existing synthetic Codex heartbeat fixture in these scenarios. Exercise absent and mismatched observations first, checking typed refusal, no persisted scheduler state and the unchanged single quota debit. Then update only the isolated manifest, execute the original receipt-bound ACK, independently read the applied schedule, and preserve the existing byte-stable replay assertions. The ordinary scenario still rejects its superseded Turn; both Todo-less replan variants retain their full validation/writeback/spend chain.
Only
tests/control_plane/test_quota_settlement_cli.pychanges. Production Host readers, scheduler policy, receipt binding and quota authority are unchanged. This complements #6276's launcher repair; it neither duplicates that implementation nor proves an actual App update, elapsed timer, or installed launcher behavior. It removes an identified integration-fixture gap in #4447 without closing that issue's remaining source-purpose decisions or general acceptance.Validation at head
277dab815eb8dba20ff1ca6256009589a1675a85: immutable basec464cf308c3c9bad5d1109a758d30dc3620bfde4reproduced all three failures. The repaired three scenarios pass, as do 34 adjacent TS scheduler tests, Ruff and the three selected premerge canaries. The full settlement CLI and Host-binding suite passes: 112 tests, including all three originally failing paths and the new missing/mismatched-readback cases. No test is skipped. Initial fixture assertion incorrectly expected an absent top-level mutation field; replaced it with the actual typed observed RRULE plus independent persisted-state readback.