Skip to content

refactor(control-plane): build scheduler commands through effect program - #2957

Merged
huangruiteng merged 1 commit into
mainfrom
codex/r3-scheduler-effect-20260808
Aug 8, 2026
Merged

refactor(control-plane): build scheduler commands through effect program#2957
huangruiteng merged 1 commit into
mainfrom
codex/r3-scheduler-effect-20260808

Conversation

@huangruiteng

Copy link
Copy Markdown
Owner

Summary

R3 replacement-first change: Codex CLI local scheduler commands are built
through EffectProgram.

  • build_codex_cli_local_scheduler_tick now models its command set as an
    ordered EffectProgram and renders the public commands mapping from it.
  • Add a focused test that proves the command mapping round-trips through
    effect_program_from_ordered_steps.
  • Refresh the maintainability baseline for bootstrap_command_pack.py after
    the R1 effect-program replacement.

No public packet behavior changes.

Validation

  • python -m pytest tests/control_plane/test_codex_cli_scheduler_effect_program.py tests/canary/test_maintainability_ratchet.py: passed.
  • codex-cli-local-scheduler-tick-smoke and
    codex-cli-local-scheduler-exec-smoke: passed.
  • loopx canary premerge --from-git-diff: passed, self_merge_allowed=true,
    0 manual holds.
  • Public boundary scan: passed.

Routing

  • continuation-policy: independent_handoff
  • excluded-agent: codex-quality-qualification
  • claimed-by: codex-side-bypass

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

Reviewed exact head dc3a359. No blocking findings.

The PR makes the Codex CLI local scheduler command set flow through
EffectProgram and refreshes the maintainability baseline after R1. Public
packet output unchanged.

Validation

  • python -m pytest tests/control_plane/test_codex_cli_scheduler_effect_program.py tests/canary/test_maintainability_ratchet.py: passed.
  • Codex CLI local scheduler tick and exec smokes: passed.
  • loopx canary premerge --from-git-diff: passed, self_merge_allowed=true,
    0 manual holds.
  • GitHub pytest, build, and dependency-review on this head: pass.
  • Public boundary scan: passed.

Merge decision: approved after reviewer.

@huangruiteng
huangruiteng merged commit 1bf0860 into main Aug 8, 2026
5 checks passed
@huangruiteng
huangruiteng deleted the codex/r3-scheduler-effect-20260808 branch August 8, 2026 20:16

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: APPROVED

head dc3a35922d8e328c41d8cd0059a2e6884dc51ad4。这是对 refactor(control-plane): build scheduler commands through effect program 的完整 PR 解读,覆盖 3 个改动文件、EffectProgram 接线、commands 输出兼容性、baseline 与测试。GitHub 不允许作者审批自己的 PR,因此以 COMMENTED 发布作者自有回退态,但评审结论是无 blocker。

动机

Codex CLI local scheduler tick 现在直接手写一个 6 键 commands dict,而仓库已经用 EffectProgram 表达有序 effect 步骤。两套表达并存会让后续 effect interpreter 无法直接把 scheduler tick 当作普通 effect 程序消费,也容易在“手写 dict”和“effect program”之间产生漂移。这个 PR 让 build_codex_cli_local_scheduler_tick 先通过 effect_program_from_ordered_steps 构造有序程序,再从这个程序渲染公开 commands 映射,保持输出不变的同时把来源统一。

改动思路

改动的核心是“替换数据来源,不换输出契约”:

  • 六个命令(visible driver run、runtime idle detector、fixture、scheduler tick、candidate、blocker writeback)被表达成 EffectProgram 的 ordered steps,execution mode 为 serial
  • commands dict 从 {step.step_id: step.command} 生成,不再手工拼写;
  • loopx/canary/module_metric_baseline.jsonbootstrap_command_pack.py 的行上限从 2234 调到 2240,匹配当前实际行数;
  • 新增一个测试,把 commands 过滤空值后重新 round-trip 成同一 EffectProgram,证明命令映射可逆。

具体改动

  • loopx/codex_cli_scheduler.py:新增 commands_program = effect_program_from_ordered_steps([...], execution_mode="serial"),并用 commands = {step.step_id: step.command for step in commands_program.steps} 替换手写 dict。
  • loopx/canary/module_metric_baseline.jsonbootstrap_command_pack.pylines 上限从 2234 调到 2240。
  • tests/control_plane/test_codex_cli_scheduler_effect_program.py:新增 round-trip 测试,验证六个命令 key、serial mode 和 command 映射一致。

关键代码讲解

  1. effect_program_from_ordered_steps():把 [id, kind, command] 的有序步骤转成 EffectProgramcommand 为 None 时仍保留 step,只是命令为空。这个 PR 正是用它统一命令来源。
  2. build_codex_cli_local_scheduler_tick():原有六个命令变量不变,新增 commands_program,最后 commands 从 program steps 派生。candidate/blocker 不存在时仍是 None,与旧 dict 行为一致。
  3. commands 映射:step.step_id -> step.command,保证 key 顺序和语义都由 EffectProgram 唯一持有,避免手写 dict 与 effect 步骤不同步。
  4. baseline:bootstrap_command_pack.py 2240 行对应 ceiling 2240,maintainability ratchet 不再误报。

正向路径

调用 build_codex_cli_local_scheduler_tick,构造六个 ordered steps;effect_program_from_ordered_steps 输出 serial EffectProgram;commands 从 program 渲染,与旧输出 key 一致。新增测试再把这些 commands round-trip 成同一 program,证明调度命令既是输出,也是 effect 程序。

负向路径

candidate_commandblocker_writeback_command 不存在时,对应 step 的 command 为 None,commands 中该 key 仍存在且值为 None;消费方不会因为“键消失”而崩溃。若 effect_program_from_ordered_steps 未来改变空命令语义,round-trip 测试会第一时间暴露。

对主干的风险

低。输出 packet 的 key 和值语义没有变化,只改变命令映射的生成来源;baseline 更新与当前文件行数一致。验证:tests/control_plane/test_codex_cli_scheduler_effect_program.pytests/canary/test_maintainability_ratchet.pytests/control_plane/test_cli_output_budget.py 共 25 passed;两个 codex-cli-local-scheduler smokes 通过;loopx canary premerge --from-git-diff 全绿,self_merge_allowed=true;ruff/diff check 通过。GitHub pytest 仍在 in-progress,但本地等价覆盖已通过。

我的整体评价

这是克制且正确的 R3 replacement-first 重构:把 scheduler tick 的命令来源统一到 EffectProgram,公开输出保持不变,并用 baseline 和 round-trip 测试把风险钉死。无 blocker,按仓库 merge policy 路由合并。


English Verdict

Approved (author-owned fallback; cannot formally approve). Head dc3a35922d8e328c41d8cd0059a2e6884dc51ad4. The scheduler command mapping now derives from EffectProgram while preserving the public packet shape; baseline and round-trip tests are included. 25 pytest, both scheduler smokes, ruff/diff checks, and canary premerge all pass. No blocking findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant