Repository navigation
refactor(control-plane): retire dead local snapshot and standing-decision wrapper - #7870
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
loopx-agent
left a comment
There was a problem hiding this comment.
1) 问题定义(为什么改、要解决什么)
- 推进控制面减法重构,退役已由组合式
todo.read(kind: "source_fields")接管的独立standing_decision.projectRPC handler、Pythonbuild_standing_decision_authority包装函数以及无调用的coordination/local_snapshot.py。
2) 改动摘要(按模块分组)
- 控制面死代码与冗余 RPC 退役 (
loopx/control_plane/coordination/local_snapshot.py,loopx/control_plane/effect_runtime_handlers.ts,loopx/control_plane/todos/standing_decision.py,loopx/control_plane/todos/standing_decision.ts):删除local_snapshot.py(67 行),移除standing_decision.project独立 handler 与evaluateStandingDecisionProjection/build_standing_decision_authority包装层,保留核心projectStandingDecisions供todo.read内部组合调用。 - 测试与示例迁移 (
examples/control_plane/todo-standing-decision-authority-smoke.py,tests/control_plane/**,tests/control_plane_ts/**):将原直接调用build_standing_decision_authority或standing_decision.project的测试与 smoke 统一迁移至真实生产入口todo.read(kind: "source_fields")。 - 双语 RFC 与台账更新 (
docs/architecture/rfcs/**):同步更新中英文迁移主文档与2026-09-28-retirement-cadence台账。
3) 逐点审阅结论(架构、语义、正确性、测试、风险)
- 全仓引用与契约一致性:经全仓
git grep核验,todo_snapshot_from_mapping、build_standing_decision_authority与evaluateStandingDecisionProjection均已无残留调用方;测试直接覆盖组合式todo.read入口,消除了测试专用的旁路 wrapper。
4) 建议修改项(分 P0/P1/P2,带文件路径和行号)
- 无阻塞项。
5) 最终结论(Verdict)
Approved — ready to merge once CI completes (exact head 99619c84e47c7033d6731beba40ce6a814337c9f verified).
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
维护控制面和审查其变更的开发者会在旧入口已退役后仍看到这些代码与过时保留说明。 过去测试只走独立的 standing-decision 包装,生产已走组合读取;现在删除死包装,让原测试断言通过实际的组合读取验证。 调用与字符串 dispatch 搜索没有找到被删 owner 的生产消费者;同一 standing-decision smoke 在 base/head 通过,决定资格、撤销和跨 Agent 隔离保持。 本次只完成这组已无消费者代码的退役,不宣称整个 Python facade 或长程收益已资格化。
改动思路 / Approach
生产已经采用现有 typed owner,退役死包装符合迁移 RFC 的“最后一个真实消费者退出后删除”约束。保留另一份不再执行的实现只增加下一次修改的搜索和误读成本。 当前 PR 删除两个 Python 适配边界与仅供旧测试的 RPC,保留共享 standing-decision 规则和生产 todo.read。 不修改会保留已无消费者的语义和过时 checkpoint;加兼容 shim 会重新创造死入口。当前已有真实 owner,只应移除最后消费者之后的局部边界,未要求重写仍活跃的 Python I/O。 正向路径从 source_todo_fields → todo.read → projectStandingDecisions 进入既有 owner,同一源/fixture 经过真实 owner 和 CLI,得到原有正确断言结果;异常路径保留 原 typed eligibility / Todo actor-lease-completion validation,原有负向 suite 和真实 smoke 保持拒绝及恢复断言,删除死代码没有绕过拒绝。本次完整审查当前 head,没有继承先前模板审查的通过结论。
具体改动 / Changes
13 paths +79/-137;生产删除局部 adapter/handler,三个测试/示例调用改走既有组合读,RFC/ledger 两个语言配对更新。 standing_decision_source_items/共享 TS eligibility 与 chronology 保留;旧 RPC 没有独立公共或持久化 reader。 没有新状态、分类或 persisted schema。决定资格/chronology 或 Todo lease/proof 规则均沿用原 typed owner。
关键代码讲解
-
standing_decision_source_items:为组合读取解码来源 metadata。 函数 AST 保持;删除的是它外面的独立批量 RPC 包装。 输入为legacy/canonical standing-decision records,关键条件是canonical ID 不重新按 Markdown token 解码。非法/冲突决定由既有 typed owner 拒绝或诊断 -
projectStandingDecisions:拥有决定资格、先后及撤销规则。 删除独立 request decoder,规则函数保留。 输入为完整记录与 legacy ordering flag,关键条件是后发生的拒绝撤销较早允许;冲突不授予 active authority。无证据时不产生授权
规格为 docs/architecture/rfcs/typescript-control-plane-migration-v0.md,spec_revision e9eda527afd5fcb262ee7c199e1822b1a936cc24;§2.4/§8 要求以生产 caller 为依据退役,不通过改名、移入档案或永久保留 Python/TS twins 宣称完成。
- §2.4 reuse_and_retirement:implemented。已有 typed owner 继续负责决策;死包装不再构成平行 owner。 对应
source_todo_fields → todo.read → projectStandingDecisions;全仓 caller/字符串搜索与 AST audit。 - §8 source_and_behavior:implemented。只删除最后消费者已退出的代码,保留真实状态/回执/恢复消费者。 对应
source_todo_fields → todo.read → projectStandingDecisions;38 Python tests; 30 TypeScript tests; same source smoke at base/head。
对主干的风险 / Risks
最强风险是遗漏字符串/懒加载消费者,或误删真正承担授权/恢复职责的 helper;仅以净减行数无法排除它。 为区分修复与无效测试,我对不可变 base/head 执行相同输入:base 相同生产 smoke exit 0,原语义断言通过;head 同一 smoke exit 0;当前受影响 suites 全部通过。全仓检查同时搜索函数名、旧模块路径和动态 dispatch;不是只搜索 Python import。仅同名 _scope_identity 命中另一个 manager_context owner,已检查其 import,和被删 local_snapshot 无关。 决定测试包括晚发生 revoke、反序 source、canonical ID、scope 不匹配;Todo suites 保留 actor/lease/completion、archive/successor/恢复。没有新授权或受展示 limit 限制的 source 选择。
- PASSED:
same source smoke on base/head— both exit0;full semantic assertions preserved。 - PASSED:
38 Python tests; 30 TypeScript tests; same source smoke at base/head— all selected current Python/TS suites passed。 - PASSED:
whole-repo symbol search; AST compare; check_rfc_bilingual.py --base e9eda527afd5fcb262ee7c199e1822b1a936cc24 --head HEAD; git diff --check— caller/AST evidence verified;双语与 diff 见独立日志。
语义与 CI 对齐
复用既有 typed source/decision vocabulary;退役 transient private RPC 不删除持久化回执格式。RFC 英中同步修正,旧历史边界仍可追溯。 没有新增或重定义 default-off 路径;所有可达生产状态/权限保持,相关 enabled/disabled 和非法主体 suite 已执行。 独立证据覆盖当前 changed invariant;远端 CI 的其他状态与合并 readiness 另行保留,没有把检查颜色当作正确性证明。 真实 source CLI/TS 和合成隔离状态已执行;未宣称 installed 或整体长程效率资格。未触及 PostgreSQL authority store,无新增该后端义务。
我的整体评价 / Verdict
APPROVE:当前完整 diff 在所声明边界内达到 goal_achieved;long_horizon 为 preserved,原决定、租约、完成、恢复和历史读取路径保持;减少无消费者维护表面,不把减少行数当作实测长程收益。 user_experience 为 preserved,现有 CLI/Chat 调用、拒绝和恢复保留;维护者可从准确 checkpoint 找到当前 owner。 检查现有 Todo read/update、worker bridge 与 primary-action 内部调用;没有渲染展示变化,visual_review not_applicable。 生产已经采用现有 typed owner,退役死包装符合迁移 RFC 的“最后一个真实消费者退出后删除”约束。保留另一份不再执行的实现只增加下一次修改的搜索和误读成本。 当前 PR 删除两个 Python 适配边界与仅供旧测试的 RPC,保留共享 standing-decision 规则和生产 todo.read。 已做同域收口;仍有活跃调用的 decoder/trace/writer 不应为减少代码继续删除。 不把本次 review 当作合并授权。
English verdict: APPROVE — 99619c84e47c7033d6731beba40ce6a814337c9f; unreachable legacy boundaries are retired while the existing production owner and semantic checks are retained. 38 Python tests; 30 TypeScript tests; same source smoke at base/head pass.
…sion wrapper - Delete coordination/local_snapshot.py: no caller has remained since #6396 removed the last Todo mutation consumer of todo_snapshot_from_mapping. - Delete build_standing_decision_authority() and its standalone todo.standing_decision.project handler and request decoder. Production reads already reach the shared TS owner through the composed todo.read batch; tests and the example now exercise that path with the same chronology, revocation, scope and invalid-item assertions, plus a TS case for contradictory authority without explicit legacy order. - Correct the stale retention row in the retirement ledger and record the wrapper retirement in the TS migration checkpoint (EN and zh-CN). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Signed-off-by: hhyykk <4408344+hhyykk@users.noreply.github.com> Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
99619c8 to
f0e163a
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: loopx-agent; exact head: f0e163a2d90014ae67b3f7ddbb0bcb10aa3b6b9c
动机 / Motivation
维护控制面的开发者仍会看到已经没有任何生产调用的 Python snapshot 适配器和 standing-decision 包装,也可能因为过时的保留说明误以为这些边界仍承担授权职责。生产读取已经通过 todo.read 到达共享 TypeScript owner;移除死入口后,测试和示例改走真实组合读取,减少错误搜索、维护和后续双实现漂移的成本。本次只退役已无调用方的局部适配边界,不宣称整个 Python facade 或长时程收益已经完成。
改动思路 / Approach
生产路径保持不变:source_todo_fields → todo.read → projectStandingDecisions。删除的是最后调用方已经退出的 coordination/local_snapshot.py,以及只被测试使用的 build_standing_decision_authority()、独立 todo.standing_decision.project handler 和 request decoder。决策先后、撤销、scope、canonical ID 与非法输入规则继续由现有 TypeScript owner 承担;Python 只保留组合读取所需的来源解码。
具体改动 / Changes
关键代码讲解
standing_decision_source_items继续把来源记录解码给组合请求,但不再被独立批量 RPC 包装。projectStandingDecisions继续拥有决定资格、时间顺序、撤销和冲突拒绝;本次删除其独立 request decoder,没有复制规则。readTodoRuntime成为测试、示例和现有生产调用共同经过的组合读取入口,保留同一组 chronology、revocation、scope、canonical-id 和 invalid-item 断言。
验证
- 相关 TS 定向测试:87/87 通过,包含 handler 退役后必须 fail closed 的 leaf RPC 检查。
- 当前 Python decision-scope、standing-decision、user-completion 与 chat-gate 选择:127/127 通过。
todo-standing-decision-authority-smoke.py通过真实组合读取和 quota 路径。npm run typecheck:control-plane、双语 RFC 检查和git diff --check通过。- 分支已重放到最新 main
58a85d0a,并处理 main 已退役todo.public_update.plan的交叉变化;最终合并树只额外移除todo.standing_decision.project。
对主干的风险 / Risks
没有发现新的阻断性问题。最强风险是遗漏动态 dispatch、懒加载或字符串形式的调用方;全仓符号和路径搜索只剩 RFC 中的历史说明,没有可执行引用。共享 TypeScript owner、持久化记录和组合读取保持不变,因此本 PR 不改变决定权限、Todo lease、完成或恢复语义。GitHub 必需检查在新 head 上仍在运行,合并前需要等待精确 head 的检查结果。
我的整体评价 / Verdict
APPROVE。当前 head 在最新 main 上完成了无消费者边界的退役,同时保留既有生产 owner 和负向路径。原评审因 rebase 失效,本结论针对当前精确 head;合并仍需等待 GitHub 必需检查通过。
English verdict: APPROVE — exact head f0e163a2d90014ae67b3f7ddbb0bcb10aa3b6b9c retires unreachable adapters while preserving the composed production read owner and its semantic checks. Selected TS tests pass 87/87, selected Python tests pass 127/127, the real smoke passes, and required CI remains a separate merge gate.
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: loopx-agent; exact head: f0e163a2d90014ae67b3f7ddbb0bcb10aa3b6b9c
动机 / Motivation
维护控制面的开发者仍会看到已经没有任何生产调用的 Python snapshot 适配器和 standing-decision 包装,也可能因为过时的保留说明误以为这些边界仍承担授权职责。生产读取已经通过 todo.read 到达共享 TypeScript owner;移除死入口后,测试和示例改走真实组合读取,减少错误搜索、维护和后续双实现漂移的成本。本次只退役已无调用方的局部适配边界,不宣称整个 Python facade 或长时程收益已经完成。
改动思路 / Approach
生产路径保持不变:source_todo_fields → todo.read → projectStandingDecisions。删除的是最后调用方已经退出的 coordination/local_snapshot.py,以及只被测试使用的 build_standing_decision_authority()、独立 todo.standing_decision.project handler 和 request decoder。决策先后、撤销、scope、canonical ID 与非法输入规则继续由现有 TypeScript owner 承担;Python 只保留组合读取所需的来源解码。
具体改动 / Changes
关键代码讲解
standing_decision_source_items继续把来源记录解码给组合请求,但不再被独立批量 RPC 包装。projectStandingDecisions继续拥有决定资格、时间顺序、撤销和冲突拒绝;本次删除其独立 request decoder,没有复制规则。readTodoRuntime成为测试、示例和现有生产调用共同经过的组合读取入口,保留同一组 chronology、revocation、scope、canonical-id 和 invalid-item 断言。
验证
- 相关 TS 定向测试:87/87 通过,包含 handler 退役后必须 fail closed 的 leaf RPC 检查。
- 当前 Python decision-scope、standing-decision、user-completion 与 chat-gate 选择:127/127 通过。
todo-standing-decision-authority-smoke.py通过真实组合读取和 quota 路径。npm run typecheck:control-plane、双语 RFC 检查和git diff --check通过。- 分支已重放到最新 main
58a85d0a,并处理 main 已退役todo.public_update.plan的交叉变化;最终合并树只额外移除todo.standing_decision.project。
对主干的风险 / Risks
没有发现新的阻断性问题。最强风险是遗漏动态 dispatch、懒加载或字符串形式的调用方;全仓符号和路径搜索只剩 RFC 中的历史说明,没有可执行引用。共享 TypeScript owner、持久化记录和组合读取保持不变,因此本 PR 不改变决定权限、Todo lease、完成或恢复语义。GitHub 必需检查在新 head 上仍在运行,合并前需要等待精确 head 的检查结果。
我的整体评价 / Verdict
APPROVE。当前 head 在最新 main 上完成了无消费者边界的退役,同时保留既有生产 owner 和负向路径。原评审因 rebase 失效,本结论针对当前精确 head;合并仍需等待 GitHub 必需检查通过。
English verdict: APPROVE — exact head f0e163a2d90014ae67b3f7ddbb0bcb10aa3b6b9c retires unreachable adapters while preserving the composed production read owner and its semantic checks. Selected TS tests pass 87/87, selected Python tests pass 127/127, the real smoke passes, and required CI remains a separate merge gate.
Goal And Delivered Outcome
coordination/local_snapshot.pylost its last caller in refactor(authority): retire legacy Markdown mutation callers #6396, but the retirement ledger still said to keep it for Todo mutation authorization.build_standing_decision_authority()was called only by tests and one example; production reaches the same TS owner through the composedtodo.readbatch.loopx-project/loopx:main. No issue closure claimed.Author Declaration
Implemented against
e9eda527a.local_snapshot.pyhas no reference in code, tests, packaging or manifestsloopx/control_plane/coordination/local_snapshot.py(deleted)build_standing_decision_authority()and its standalonetodo.standing_decision.projecthandler and request decoder; keepstanding_decision_source_items()and the shared TS ownerloopx/control_plane/todos/standing_decision.py;loopx/control_plane/todos/standing_decision.ts;loopx/control_plane/effect_runtime_handlers.tstests/control_plane/test_standing_decision_order.py;tests/control_plane/test_todo_decision_scope_consistency.py;tests/control_plane_ts/standing_decision.test.tstodo.readpath; add contradictory-authority refusal without explicit legacy orderexamples/control_plane/todo-standing-decision-authority-smoke.py;tests/control_plane_ts/effect_runtime_fairness.test.tsdocs/architecture/rfcs/ledger/shared-goal-authority-state-provider-v0/2026-09-28-retirement-cadence{,.zh-CN}.md;docs/architecture/rfcs/typescript-control-plane-migration-v0{,.zh-CN}.mdscripts/check_rfc_bilingual.py --base origin/main --head HEADMigration economics receipt
todos/standing_decision.tsviatodo.read; lease facts with native executorslocal_snapshot.py, 33 Python wrapper/imports, 9 TS decoder/schema, 1 handler registration, 1 docstring line)local_snapshot.py, the Python wrapper and the standalone RPC are deleted nowScope And Continuation
work_items/delivery_outcome.py, was analyzed and deliberately not included. Several refusal paths (Host-result validation, the slot-accounting fallback scan, the missing-outcome refusal in refresh) cross no TS request today, so a cutover would add a cross-runtime call or reorder refusal.Validation
unitpassedunitpassedstanding_decision,effect_runtime_fairness,todo_read,decision_scope,archive_capture,todo_archive_selection: 54 passed, 0 failed.real_entrypointpassedexamples/control_plane/todo-standing-decision-authority-smoke.pythrough the composed read andquota should-run.staticpassedcheck_rfc_bilingual.py --base origin/main --head HEAD;loopx canary premerge --from-git-diff --git-diff-base origin/mainincluding the maintainability ratchet and semantic vocabulary drift; merge gate passed.legacy_source_order(for example the string"false"), while the productiontodo.readpath already treats any value other thantrueas not-legacy. That is existing production behavior, not a change introduced here.See validation disclosure guidance.
Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
none.Signed-off-bytrailer (git commit -s).