#500: design-consensus 编排重设计 — phase9-router 唯一派发 owner,删 wakeup-runner 双重派发#501
Conversation
…er 双重派发 落地 #500 r4 consensus(structural framing,no-new-schema): - phase9-router 成为唯一 design-consensus worker intent owner,新增 META_RESOLVED:re-design → marker.round+1 三路 solver route - 删除 wakeup-runner 的 dispatch_design_consensus(消除双重派发 helper_exit:3) - wakeup-runner 只保留 closed action apply(drop→close、consensus→implement) - dispatch_consensus_implementation readiness 后转 crnd:phase:implementing - 无新增 schema(复用 HARNESS_SPAWN_INTENT) 修复 headless P0:reflector META_RESOLVED 无 consumer + phase9-router/wakeup-runner 双重派发致 0-codex 死锁。14 文件 +207/-282;verification 471 tests 全绿。 共识由 controller 手动驱动 design-consensus r1→r4 达成(daemon 停止期间)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🤖 architect review 通过: #396 边界收窄,无架构阻断TL;DR
详细说明我检查了实际三点 diff、 关键证据是 没有发现新增 📎 完整 codex 原始输出(存档备查)---
pr: 501
role: architect
head_sha: e733b1ac6b4c21520f16fa79aa09ad21e84b9fd2
verdict: approve
---
## Verdict
approve: no architectural concerns from the CLAUDE.md/AGENTS.md compliance angle; the PR narrows wakeup-runner authority and keeps the new design-consensus continuation on the phase9-router deterministic route.
## Evidence
- No reject findings. `CLAUDE.md:40` requires controller-runtime exceptions to stay narrow, durable, non-generic, and forbids `.refactor-loop/host.env` as host production SSOT; the PR removes `dispatch_design_consensus` from #396 wakeup-runner allowed actions while keeping #396 helper actions closed and validated.
- `skills/codex-refactor-loop/authorizations/runtime-exceptions.md:204-208` mirrors the narrowed #396 surface: `wakeup-runner` consumes only closed action projection, rejects generic command fields, and no longer lists `dispatch_design_consensus`.
- `skills/codex-refactor-loop/SKILL.md:511` and `skills/codex-refactor-loop/scripts/codex_refactor_loop/phase9/router.py:700-744` put `META_RESOLVED:re-design` on the router-owned source-adjacent solver-triplet route, matching the single-mainline/daemon-first boundary instead of reintroducing a wakeup-runner redispatch path.
- `skills/codex-refactor-loop/scripts/codex_refactor_loop/wakeup_plan.py:86-97` and `wakeup_runner.py:61-79` keep `dispatch_design_consensus` out of the executable #396 action/helper allowlists; router-owned completed-marker evidence is downgraded to status-only before runner application.
- Old/New pattern comment policy check: the net diff adds no new `Refactor (...)`, `Old pattern`, or `New principle` source comments; existing historical comments are unchanged context.
- No host-specific architecture grep checks, host proto policy, or external repo list were set in the environment, so no additional host-specific findings were applied.
⟦AI:AUTO-LOOP⟧
REVIEW_DONE:501:architect:approve⟦AI:AUTO-LOOP⟧ |
🤖 Tests review: reject,缺一个新增生命周期写失败分支测试TL;DR
详细说明
缺口是失败路径: 建议补一个 📎 完整 codex 原始输出(存档备查)---
pr: 501
role: tests
head_sha: e733b1ac6b4c21520f16fa79aa09ad21e84b9fd2
verdict: reject
---
## Verdict
Reject: test coverage misses the new lifecycle-write failure branch added to `dispatch_consensus_implementation`.
## Evidence
- `skills/codex-refactor-loop/scripts/codex_refactor_loop/controller_actions.py:727` now calls `_move_issue_to_implementing_phase(number)` before creating the worktree, rendering the implement prompt, and appending the `HARNESS_SPAWN_INTENT`; `controller_actions.py:766` adds the helper that runs `gh issue edit`, appends `CONTROLLER_ACTION_BLOCKED:phase-transition:dispatch-consensus-implementation:issue:<N>` on nonzero exit, and returns the failed exit code.
- `skills/codex-refactor-loop/scripts/test_controller_actions.py:837` covers only the success path by asserting `gh issue edit` is called and implementation dispatch continues. The existing negative tests at `test_controller_actions.py:930` and `test_controller_actions.py:951` assert validation/readiness failures happen before any `gh` call, but there is no test where `gh issue edit` returns nonzero and dispatch must stop before `fresh_safe_worktree`, `render_template`, or `HARNESS_SPAWN_INTENT`.
- The rest of the design-consensus routing changes have behavior/source-regression coverage: `test_phase9_router_daemon.py:1835` covers reflector `META_RESOLVED:re-design` -> source-adjacent next-round solver intents, `test_phase9_router_daemon.py:1851` covers restart dedupe through the ledger, `test_wakeup_plan.py:1445` and `test_wakeup_plan.py:1455` cover router-owned completed markers becoming status-only, and `test_wakeup_runner.py:856` covers stale `dispatch_design_consensus` actions being rejected.
## What would change your verdict
Add a `test_dispatch_consensus_implementation_phase_transition_failure_blocks_before_worktree`-style test that makes `self.actions.gh` return nonzero for `issue edit`, asserts the return code is propagated, asserts the blocked pending event is written, and asserts `fresh_safe_worktree`, `render_template`, and `HARNESS_SPAWN_INTENT` do not run.
⟦AI:AUTO-LOOP⟧
REVIEW_DONE:501:tests:reject⟦AI:AUTO-LOOP⟧ |
🤖 Quality review 通过TL;DR
详细说明我看了三点 diff 和关键 touched files 的完整上下文。
验证方面, 📎 完整 codex 原始输出(存档备查)---
pr: 501
role: quality
head_sha: e733b1ac6b4c21520f16fa79aa09ad21e84b9fd2
verdict: approve
---
## Verdict
Approve: the PR is readable and focused, removes the old wakeup-runner design-consensus redispatch surface cleanly, and keeps the new router-owned continuation path small with reachable helpers and explicit route names.
## Evidence
- `skills/codex-refactor-loop/scripts/codex_refactor_loop/phase9/router.py:315` calls the new `_dispatch_reflector_routes`, and `router.py:700` keeps the new `META_RESOLVED:re-design` path as one direct, named route rather than a broad redispatch helper.
- `skills/codex-refactor-loop/scripts/codex_refactor_loop/wakeup_runner.py:61` removes `dispatch_design_consensus` from `SUPPORTED_CONTROLLER_ACTIONS`, and `wakeup_runner.py:77` leaves only `spawn_codex_harness_background` in the spawn-batch action set; no dead private dispatch helper remains in the runner.
- `skills/codex-refactor-loop/scripts/codex_refactor_loop/wakeup_plan.py:86` removes `dispatch_design_consensus` from `RUNNER_NAMED_HELPER_ACTIONS`, and `wakeup_plan.py:2161` uses a small, business-named helper to mark router-owned design-consensus markers status-only.
- `skills/codex-refactor-loop/scripts/codex_refactor_loop/controller_actions.py:727` reaches the new `_move_issue_to_implementing_phase` helper before worker intent creation, and the helper at `controller_actions.py:766` is narrowly named around the lifecycle phase transition it performs.
- I found no new single-implementer abstraction, commented-out code, filler self-doc comments, or unrelated drive-by cleanup that would change the quality verdict under `HOST_REFACTOR_COMMENT_POLICY=none`.
- Verification note: `git diff --check origin/auto-refact-dev...origin/refactor/iter500-issue-500` passed. A local narrow unittest run against the current `auto-refact-dev` checkout reported 2 `test_phase9_router_daemon.py` errors because the checked-out file still used ambient `CONSENSUS_RND_HOST_ENV`; the PR head version changes that constructor call to pass `env={"REPO_ROOT": str(repo_root)}`, so I did not treat that checkout mismatch as a PR quality finding.
⟦AI:AUTO-LOOP⟧
REVIEW_DONE:501:quality:approve⟦AI:AUTO-LOOP⟧ |
🤖 fix-codex 已补上 tests reject 要求TL;DR
详细说明本轮只有 tests reviewer 给出 验证结果:编译通过;目标测试通过;完整 📎 完整 codex 原始输出(存档备查)# Fix report for PR 501 round 1
## Applied
- (A) skills/codex-refactor-loop/scripts/test_controller_actions.py:889: added a behavior test for `dispatch_consensus_implementation` when the issue phase-transition `gh issue edit` fails. The test propagates the nonzero return code, asserts `CONTROLLER_ACTION_BLOCKED:phase-transition:dispatch-consensus-implementation:issue:413` is written, and asserts `fresh_safe_worktree`, `render_template`, and `HARNESS_SPAWN_INTENT` do not run. Addresses reviewer:tests evidence #1.
## Rejected as false positive
- None.
## Blocked (cannot fix this round)
- None.
## Build status
- build: pass (`python3 -m compileall skills/codex-refactor-loop/scripts skills/sshx -q`)
- tests: pass
- `python3 -m unittest skills/codex-refactor-loop/scripts/test_controller_actions.py -k phase_transition_failure` passed.
- Initial prompt-literal discover command failed because exported `CONSENSUS_RND_HOST_ENV=.config/consensus-rnd/host.env` leaked into temporary test repos where that relative file is not readable; every reported traceback had `LoopContextError: CONSENSUS_RND_HOST_ENV is not a readable file: .config/consensus-rnd/host.env`.
- Re-run with host facts sourced and only the locator unset passed: `source /Users/auric/consensus-rnd/.config/consensus-rnd/host.env; unset CONSENSUS_RND_HOST_ENV; python3 -m unittest discover -s skills/codex-refactor-loop/scripts -p "test_*.py" && python3 -m unittest discover -s skills/sshx/tests -p "test_*.py"` — codex-refactor-loop 1342 tests OK (skipped=1), sshx 13 tests OK.
## Recommendation for next round
- expect approve/merge: the only reject demand was covered directly, with no false positives or blocked items.
refactor self-doc: not applicable (HOST_REFACTOR_COMMENT_POLICY=none)
⟦AI:AUTO-LOOP⟧
FIX_DONE:501:round-1:applied-1:rejected-0:blocked-0⟦AI:AUTO-LOOP⟧ |
…lure-branch test tests reviewer reject:新增 label transition(gh issue edit→implementing)只测 success path,缺 gh issue edit 返回 nonzero 时 dispatch stop before worktree/render/intent 的 failure-branch test。本 fix 补该测试。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🤖 测试角度 review:approveTL;DR
详细说明这轮 diff 的测试覆盖到位。
📎 完整 codex 原始输出(存档备查)---
pr: 501
role: tests
head_sha: c1009920cd7da68874817b758672b37b6b204a9c
verdict: approve
---
## Verdict
Test coverage and test quality are adequate for the diff.
## Evidence
- `skills/codex-refactor-loop/scripts/test_controller_actions.py:873` verifies the new `dispatch_consensus_implementation` phase transition adds the managed/implementing/auto label bundle before spawning implementation work, while preserving prompt rendering and spawn-intent output.
- `skills/codex-refactor-loop/scripts/test_controller_actions.py:889` covers the new failure branch: a failed issue phase transition blocks before worktree creation or prompt rendering and emits `CONTROLLER_ACTION_BLOCKED:phase-transition:dispatch-consensus-implementation:issue:413`.
- `skills/codex-refactor-loop/scripts/test_phase9_router_daemon.py:1845` covers the new `META_RESOLVED:re-design` router behavior by asserting source-adjacent `r5` solver triplet dispatch, exact ledger keys, and no accidental `r6` route.
- `skills/codex-refactor-loop/scripts/test_phase9_router_daemon.py:1851` covers restart idempotence for the new re-design route by asserting a fresh router tick does not duplicate dispatch intents.
- `skills/codex-refactor-loop/scripts/test_wakeup_plan.py:1445` and `skills/codex-refactor-loop/scripts/test_wakeup_plan.py:1455` cover the wakeup-plan contract change: router-owned design-consensus completed-marker evidence becomes status-only, loses runner authority, and keeps forbidden command fields out of projected actions.
- `skills/codex-refactor-loop/scripts/test_wakeup_runner.py:794` covers the removed wakeup-runner `dispatch_design_consensus` execution path by asserting stale redispatch actions fail closed as `unsupported_controller_action:dispatch_design_consensus` without launching a supervisor.
- Source-regression coverage is present in `skills/codex-refactor-loop/scripts/test_wakeup_plan.py:2255`, `skills/codex-refactor-loop/scripts/test_runtime_exception_authorization_sources.py`, and `skills/codex-refactor-loop/scripts/test_skill_reference_anchors.py`, locking the status-only/router-owned boundary and removal of `dispatch_design_consensus` from the #396 wakeup-runner allowlist.
- Diff scan found no added `[Skip]`/manual-test bypass, no test pacing `sleep`/`delay`, and no assertion weakening pattern that would reduce coverage quality.
## What would change your verdict (only if comment or reject)
N/A
⟦AI:AUTO-LOOP⟧
REVIEW_DONE:501:tests:approve⟦AI:AUTO-LOOP⟧ |
🤖 Quality review approveTL;DR
详细说明我按 PR head 结论是代码质量角度可过。 📎 完整 codex 原始输出(存档备查)---
pr: 501
role: quality
head_sha: c1009920cd7da68874817b758672b37b6b204a9c
verdict: approve
---
## Verdict
Approve: the PR simplifies ownership by deleting the wakeup-runner design-consensus redispatch path, keeps the new router continuation small and named in existing route vocabulary, and does not introduce quality-level dead code or over-engineering.
## Evidence
- skills/codex-refactor-loop/scripts/codex_refactor_loop/wakeup_runner.py:61 removes `dispatch_design_consensus` from the supported runner action set, and the dispatch table at line 612 no longer carries a parallel private router implementation.
- skills/codex-refactor-loop/scripts/codex_refactor_loop/wakeup_plan.py:86 removes `dispatch_design_consensus` from `RUNNER_NAMED_HELPER_ACTIONS`; completed design-consensus markers are normalized to status-only in `_close_projection_action` at line 2121 via `_design_consensus_marker_is_router_owned`, which is clearer than the prior terminal-only suppression helper.
- skills/codex-refactor-loop/scripts/codex_refactor_loop/phase9/router.py:700 adds `_dispatch_reflector_routes`, a 45-line route with explicit business names (`META_RESOLVED:re-design`, `redesign_to_next_solvers`, `target_round = marker.round + 1`) and reuses the existing ledger, terminal gate, source-open gate, prompt, and spawn helpers.
- skills/codex-refactor-loop/scripts/codex_refactor_loop/phase9/router.py:746 extends `_directly_handled` with the same `redesign_to_next_solvers` fallback keys, keeping fallback idempotency co-located with the other direct route checks instead of adding a second abstraction.
- skills/codex-refactor-loop/scripts/codex_refactor_loop/controller_actions.py:766 adds `_move_issue_to_implementing_phase`; it is private, directly called before worktree creation at line 727, and its name describes the lifecycle transition rather than using a generic helper name.
⟦AI:AUTO-LOOP⟧
REVIEW_DONE:501:quality:approve⟦AI:AUTO-LOOP⟧ |
🤖 Architect review approve: #501 未发现架构阻塞TL;DR
详细说明这次改动把 我重点看了一个有副作用的点: 📎 完整 codex 原始输出(存档备查)pr: 501
|
✅ review-gate 共识达成 → merge
合并 #500:phase9-router 唯一 design-consensus owner、删 wakeup-runner 双重派发、META_RESOLVED:re-design→marker.round+1、consensus→implementing label。修复 headless P0 双重派发 + reflector META_RESOLVED 无 consumer 死锁。 🤖 controller |
摘要
落地 #500 design-consensus 编排重设计(r4 consensus,structural framing,no-new-schema)。
问题(headless P0 死锁): phase9-router 和 wakeup-runner 双重派发 design-consensus(ledger 42 次 helper_exit:3),reflector META_RESOLVED 在 headless 无 consumer(ledger handled=0) → 0-codex 死锁。
方案:
META_RESOLVED:re-design→marker.round+1三路 solver routedispatch_design_consensus(消除双重派发)dispatch_consensus_implementationreadiness 后转crnd:phase:implementing范围
14 文件 +207/-282(删除为主):router.py +66、wakeup_runner.py -105、wakeup_plan.py、controller_actions.py +25、6 test 文件、CLAUDE/SKILL/runtime-exceptions 文档。
验证
verification_hints 全套(
test_phase9_router_daemon test_wakeup_plan test_wakeup_runner test_controller_actions test_runtime_exception_authorization_sources test_skill_reference_anchors)— 471 tests OK。共识来源
design-consensus r1→r4(controller 手动驱动,daemon 停止期间),judge:
META_JUDGE_DONE:consensus:structural:no-new-schema删除runner复派并固定re-design为marker.round+1。逐层收敛:r1 方向 → r2 schema → r3 no-new-schema+删runner → r4 re-design marker.round+1。Closes #500
🤖 controller / codex-refactor-loop #500 落地
⟦AI:AUTO-LOOP⟧