Repository navigation
test(scheduler): initialize each launcher authority only once - #7442
Conversation
Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
cocolord
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; GPT-family; OpenAI; self_reported
结论:APPROVE。现有启动器回归恢复,真实 canonical authority、初始化一次、后续更新及反例证据已闭合;未发现阻断性代码缺陷。以下平台与远端 CI 限制保留为独立合并条件,不冒充全仓验收。
动机
维护原生调度启动器的贡献者,需要测试当前宿主应用新周期后才能确认该周期。
之前重复创建同一任务存储,在启动器执行前触发冲突;修复后只创建一次所选存储,再实际运行确认、拒绝和重试流程。
现有 File/SQLite 原生启动器回归恢复,确认绑定当前宿主读回,拒绝路径仍不写入。
本 PR 只调整测试数据准备,不修改用户周期、配额、权限或生产存储规则。
这是 #7434 报告的具体 setup 问题;不处理会继续留下无法触及启动器的失败噪声,删掉测试则失去真实 source-launcher 的跨进程保障。不是仅把当前错误输出改成通过期望。
改动思路
沿用现有 write_cli_fixture 创建 owner,初次创建时选择 provider,默认继续 SQLite。canonical authority 是唯一可供任务决策使用的已初始化存储;fixture 实际提交 File/SQLite 并建立 writer fence,不用 mock snapshot 伪造成功。specific consumer 不再第二次创建相同 operation,也不再手写已由 typed capture owner 产生的 read-model schema/字段清单。没有放宽 strict JSON、允许错误重复创建或增加新的生产 helper。
实际路径为 fixture → quota should-run 发出绑定当前 Goal/Agent/Turn 的 ACK argv → 宿主 manifest 读回 → source launcher → 既有 typed ACK owner → 独立状态读回。Codex --host-match-observed 路径按已交付规则保留 Python 的 fresh App read,再进入 TS commit;并非所有 ACK 都直接 exec Node。这个步骤供应必要的当前宿主信息,不是本 PR 新增的重复确认。
具体改动
全 PR 两个 Python 测试/fixture 文件,+5/-19。没有产品代码、文档、锁文件、生成内容或自动化设置变更。
关键代码讲解
examples/control_plane/quota_plan_fixtures.py:324,444–448:write_cli_fixture新增 keyword-onlyprovider="sqlite",在六个 Goal 的初次创建中向已有initialize_canonical_authority传递该选择。已有 quota、source-entry、scheduler/state-key 等调用省略参数,仍使用 SQLite;本次参数化测试才明确选择 File/SQLite。tests/test_scheduler_native_launcher.py:265–325:test_launcher_binds_ack_to_current_host_readback将 provider 交给创建 owner,删除第二次初始化、read-model override 及相关 imports。四种宿主状态的判断没有被删除:匹配时 ACK 写入、exact replay、不扣额;不匹配/缺失/歧义时拒绝并不产生 scheduler 文件。outer-controller 强制 no-write guard 和其他默认 fixture 调用也保留。
规范依据:docs/reference/authority-operation-replay.md,spec_revision be1dc37a008be7017b64b622f653b6707df5c544;不可变合同。另核对同提交 docs/reference/source-cli-entrypoint.md 的 File/SQLite、source/console、scheduler identity/state-key 与 controller 保留要求,以及 host integration plan 对已交付 receipt-bound ACK 的描述;没有把尚未交付 plugin 阶段提升为本 PR 义务。以下是无编号规范段落的评审标签,不新增规则:
REPLAY-CONFLICT— implemented:同 ID、不同完整 body 仍须冲突;修复只避免不正确的第二次 fixture 初始化。恢复被删除的真实初始化/旧 override 后,两种 provider 都出现operation_id_exists,继而重现 strict-JSON fence 失败。LATER-STATE— implemented:旧操作不得恢复旧 head 或覆盖后续事实。独立 oracle 在初始化后先发出有效 heartbeat receipt,再真实追加和更新 Todo,运行实际 ACK/replay;完整更新后的任务、provider revision 与 scheduler bytes 均保持,spent_slots=0。HOST-ACK— implemented:既有当前宿主读回、四种状态、exact replay 和 controller no-write 保障仍由实际 Unix launcher 执行;PowerShell 执行资格单独未验证,不以代码存在或 CI 绿色冒充。
对主干的风险
最强风险是 fixture 在假 authority 上让错误拒绝“通过”,provider 没有真正选中对应 store,删去手写 metadata 后丢字段,或后续入口再次初始化抹掉更新。证据不是只有计数:实际 File/SQLite 独立读回满足 packaged canonical schema/完整字段合同,每个 Goal 初次初始化一次;随后通过真实 canonical writer 追加并更新任务,再运行实际 source ACK/replay,验证完整状态保留。metadata oracle 来自既有独立合同,不从修改后的 builder 输出生成期望。
有限验证环境:隔离 macOS、CPython 3.13.5 / Node 26.0.0;每个 test process 的 HOME、TMPDIR/TEMP/TMP、cwd 和实际加载源码均绑定不可变 base/exact head,依赖在各 worktree 通过 npm ci --ignore-scripts 固定。
- 同命令 Unix current-host cohort:head 8 passed(42.82s),base 8 failed(18.50s);失败身份均是四种 host × File/SQLite 在第二次初始化处的
invalid_legacy_writer_fence_request / value must be strict JSON,不是总数相同就推断根因。 - 当前完整 29-case 小模块:16 passed / 13 skipped(86.44s),覆盖实际 Unix dispatch、failure hint、ACK/replay 和 outer-controller;本机没有 PowerShell,13 项为真实平台 skip。
- 独立 state oracle:head 3 passed(省略参数 SQLite、显式 File、显式 SQLite);同一 oracle 的 base 默认 SQLite 1 passed。真实 schema、完整字段、一次初始化、后续 Todo 更新和 ACK/replay readback 均验证。
- 恢复第二次初始化的原生变异:两种 provider 2 个预期失败,真实 commit 显示
operation_id_exists且当前 cursor 仍是后续状态,随后 fence 严格拒绝。变异使合法旅程失败,修复 head 的合法旅程另行通过。 - 两个变更文件 Ruff、
git diff --check、bits 数组检查通过。最初 review harness 错误要求 Codex host-match 在不存在 Python 的配置上成功,head 3/base 1 项失败已保留;依据已交付入口改用原测试的默认解释器后,仅补跑上述有限 oracle。没有把它称为产品修复、放宽拒绝或抹去失败。
当前 CI 仍有 chat/dashboard browser 和聚合 checks 失败及 pending Python shards。已读 chat shard 1 的旧按钮超时、shard 2 的完整费用文案断言和聚合 dashboard-acceptance 非成功;没有不可变浏览器基线同命令复现,也不声称其他 dashboard 失败已归因、已修复或是平台 outage。这些浏览器入口不执行本次测试 factory,产品/browser owning paths 未变;changed fixture/launcher 不变量另有独立原生通过证据。因此保留明确的 CI/merge holds,而非要求这两个测试文件修复其他 UI。main ruleset 另要求 Sign-off、merge-gate、严格最新基线及当前批准;APPROVE 不等于可合并。
我的整体评价
交付判断 goal_achieved:关闭 #7434 所指的具体 setup 回归,不宣称完成跨平台或长期性能验收。long_horizon=preserved:一次初始化后,后续 canonical 更新、ACK/replay 不退回旧 head、不重复 scheduler 写入或扣额;user_experience=preserved:实际用户入口和必要 fresh-host-read authority 不变,没有新的必填步骤、确认或恢复负担。恢复测试反馈是维护收益,不是测得长期效率提升。
Doing nothing 留下坏回归;删除测试或让重复初始化成功虽然更小,却丢失真实保障或改变生产语义。现方案在既有 owner 内删除重复创建和 metadata 知识,成本与收益相称。已有 coverage 和同作者近期 batch 已扫描:#7441 是 source-drift/read-refusal 回归,与本项第二次初始化问题不同。相邻开 PR 或同作者本身不能证明 PR farming,不作动机猜测,也不强制合并独立缺陷。
bounded future-facing pass:applied,具体边界为 quota CLI fixture 创建 owner 与 scheduler consumer;一并删除相关重复初始化和 schema 知识,单一原因、可回滚,无需新框架或生产重构。未发现阻断性代码缺陷;没有新增 substring classifier、领域专用 generic obligation、默认行为或将机器义务称为 guidance。批准该精确 head,但保留 actual PowerShell/Windows、minimum-Node、全仓 CI 及 merge-gate 的未验证/等待条件。未 merge、dismiss 或修改产品。
English verdict: APPROVE - 80918d5 Restores existing native-launcher coverage by selecting real authority once; Unix/File/SQLite positive, rejection, later-state preservation and native mutation evidence are decisive, with PowerShell and remote CI/merge holds explicit.
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
动机 / Motivation
维护原生调度启动器、需要测试当前宿主确认和拒绝流程的贡献者。 测试先由公共fixture创建SQLite存储,随后又用同一operation创建一次;启动器尚未运行就触发冲突及strict-JSON错误,真实ACK与拒绝流程失去回归覆盖。 初次创建时选择File或SQLite,每个Goal只初始化一次;真实POSIX启动器的确认、拒绝、重放与controller无写保护恢复执行。 仅修复既有fixture和测试准备,不修改生产周期、配额、权限、provider语义或用户安装流程。 已读回原独立评审;其正文仍引用原提交,本次对整合main后的37ba8e81398de54759c2aca979576c3db25594ee补齐新的精确提交证据。
改动思路 / Approach
复用write_cli_fixture的创建owner,在创建时传递provider;删除consumer重复初始化与手写read-model知识,保留SQLite默认。 fixture实际提交canonical存储并建立writer fence,ACK和拒绝仍由生产owner决定。继续重复创建会隐藏启动器真正的失败;删除测试会丢失跨进程保障。当前两文件变更直接修好准备阶段,未放宽strict JSON或把第二次创建改成成功。已有默认调用继续SQLite,只有本来的参数化用例显式选择File/SQLite。
具体改动 / Changes
规格是 docs/reference/authority-operation-replay.md 的existing replay contract,并核对source-cli-entrypoint。REPLAY-CONFLICT和LATER-STATE 已实现:当前三臂oracle真实追加、更新Todo,再用原创建ID提交不同完整body,均得到operation_id_exists,完整当前读回不变。HOST-ACK-POSIX 已实现:实际模块16通过。WINDOWS-NATIVE deferred到既有Windows发布验证,当前13个skip保留。
关键内容讲解
- write_cli_fixture 增加keyword-only provider并将其交给原初始化helper;独立oracle逐个Goal追踪真实调用,三臂均各6次、每个Goal一次,实际source_authority分别符合默认SQLite、File和SQLite。
- test_launcher_binds_ack_to_current_host_readback 在初次创建选择provider,删除第二次初始化和read-model字段清单。四种宿主状态、exact replay、不扣额及controller无写断言保留。实际PR仅两文件+5/-19;main整合没有把其他主线内容带入PR差异。
对主干的风险 / Risks
当前整合提交的29-case模块为16通过/13平台skip;独立三臂oracle验证默认SQLite、显式File和SQLite,每个Goal一次初始化,后续真实Todo写入/更新保留,三种重复创建变异均被拒绝且当前head不变。Ruff、双语、diff、公开边界、严格CQR和7项premerge通过。 最强反例是fixture伪造authority或后续再次创建退回旧状态,因此当前oracle直接读取真实provider并执行create/update及重复创建变异,不只核对fixture返回值。它没有mock生产提交或ACK。与作者近期八项工作比较,注册读回、报告正文、Windows时区与本问题属于不同合同;本次在原模块删除重复知识,没有新增同形smoke或一过性脚手架。远端PR CI没有查询、轮询或等待;早先评审中的CI描述保留为历史,不代表本次观察。
我的整体评价 / Verdict
APPROVE,goal_achieved,限于关闭现有fixture重复初始化回归。long_horizon preserved,user_experience preserved:用户和生产状态机不变,贡献者重新获得真实启动器反馈;没有长程效率提升声明。bounded refactor applied:把backend选择收回既有创建owner,同时删除重复初始化及schema知识。没有新词汇、provider默认变化或额外用户操作。本机没有Windows/PowerShell,13个对应平台用例保留skip;原提交的Windows结果只作历史证据,整版发布与当前Windows制品核验仍另行完成。 合并还需即时未变head的readiness和本次维护者授权。
English verdict: APPROVE — 37ba8e81398de54759c2aca979576c3db25594ee. Single initialization through the existing fixture restores real POSIX launcher coverage.16tests and a three-arm native state/mutation oracle pass;13Windows platform skips remain explicit. Exact local premerge,CQR and boundary pass; PR CI was not consulted.
The scheduler launcher readback test initialized canonical authority twice.
write_cli_fixturealready creates each Goal in SQLite, then the test tried to create the same Goal again undercanonical-fixture. That commit returnsoperation_id_exists; passing its absent revision into fence decoding produces the misleadingvalue must be strict JSONsetup error, before either launcher is exercised.Let the existing fixture accept the requested provider at initial creation (default remains SQLite), and remove the second initialization and duplicated read-model construction. The existing File/SQLite, matching/mismatched/missing/ambiguous host, exact ack and outer-controller guard assertions remain. This reuses the canonical fixture owner instead of weakening strict JSON or making repeated creation succeed.
Fixes #7434.
Validation at signed head
80918d50e, target mainbe1dc37a0:operation_id_exists; that diagnostic is removed from the submitted diff.tests/test_scheduler_native_launcher.py: 14 passed, 15 skipped on native Windows / CPython 3.12.10, including both requested providers and the actual PowerShell launcher. POSIX launcher execution remains unqualified on this host; no Node 26 or minimum-Node equivalence is claimed.git diff --checkpass. No product source changed; no new shared vocabulary or provider contract was added. Unchanged fixture callers retain the SQLite default; the module also exercises those default callers.Author declaration: authored with OpenAI Codex under contributor direction, using disposable synthetic authority and host manifests. The related refactor removes duplicate initialization and duplicate read-model knowledge in the same owning test boundary. No real scheduler configuration, active Goal, model/benchmark job, system upgrade or self-merge. Current-head CI and independent review remain pending; maintainer merge required.
Maintainer integration validation: merged current main into this branch with a signed-off merge commit. At
37ba8e81398de54759c2aca979576c3db25594ee, the complete native-launcher module passes on macOS: 16 passed, 13 platform skips. The skips remain the Windows-only cases; the earlier Windows result above belongs to the original submitted head and is not relabeled as current-head evidence. The PR diff remains the same two fixture/test files. Exact-head review, local risk validation and merge-readiness remain separate; PR CI is not consulted.