Repository navigation
refactor(control-plane): converge decision_scope repair hints in TypeScript and eliminate Any - #9428
Conversation
…Script and eliminate Any Signed-off-by: Codex <codex@openai.com>
Codex Review Summary: ✅ CompletedThis 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.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
Quota 准入读取所选 Todo 的权威决策来源,并将可疑的 scope 投影送回修复者。 基线由 TypeScript 计算关系,再由 Python 根据错误数组选择修复文字,几种含义相近的判定跨了两个所有者。 旧版和候选对同样的输入给出同样的准入、用户等待和修复说明。 修复计划的选择与关系判定现在位于同一个 TypeScript owner,正常组合路径仍只需一次 RPC。 本次验收限于同一修复与准入路径。打包宿主及远端 PostgreSQL 没有纳入本轮验证。 保留前置条件、恢复建议和当前 authority 也就保留了后续可验证的工作。 迁移规则
改动思路 / Approach
本 PR 限于 Todo scope 的一致性判定、修复说明与现有 Python 调用编解码。 TypeScript 以一种规则选择关系和修复计划,Python 继续输出已有的 effective_action 生产者及序列化回执。 stall_repair 仍按原流程读取已选 Todo。索引按 scope kind 建立并保留源顺序,对同 owner 的 standing authority 做一次本地工作。临时计划绑定错误签名。普通 dict、签名变化会重用同一个求值 owner。复杂度的收益以可对照的源码运行和结果回读验证。
具体改动 / Changes
精确头 3dea2e7b8f09c250fd401d847a78fc43f74c133d,基线 3347302d17195fc63fdb916f96fdd18fc00f0ebf。全五文件增 575 行、删 157 行。两个源文件处理决策和编解码,另三份测试保护一致性、运行时拒绝、有效和无效 scope 顺序、原生产词汇。覆盖 规则归属 与 真实入口对照。
关键代码讲解
decisionScopeConsistency 复用已建立的索引,同时保留严格的精确目标限制。projectDecisionScopeRepairPlan 统一克服 Python 和 TypeScript 间重复维护的修复优先级。_ConsistencyProjection 私有计划不进入公开 consistency 字段。遇到不合法的 envelope,codec 继续拒绝。 TypeScript 规则 · Python codec
对主干的风险 / Risks
PASS。真实 File/SQLite CLI 中,匹配 gate 保持等待用户。缺少 gate 或精确目标不一致时保留不同修复消息、触发条件和实际控制结果。 两个版本的退出码、真实 scope 诊断和整组修复文字一致,已分开读回两端权威 Todo 和展示状态。SQLite 的同一精确目标冲突样本中,只替换一条原因文本,原 action 不变,独立的完整原因断言拒绝变体。 Python 107 项、TypeScript 15 项及类型检查通过。源码 premerge 的 6 项直接检查和 18 项所选检查通过。 同容器范围和语义边界补充验证为 313 passed in 97.63s (0:01:37)。
语义与 CI 对齐
保留修复依据和精确 target 限制,减少重复索引及跨语言的规则分岔。 已有对应 gate 时照旧由用户决策。错误时还是原来的解释和修复条件。 在 96 个工作项的小型合成 TypeScript 对照中,两个版本结果相等,共享 owner 的 scope 检查中位数约 3.08→0.15 毫秒。另三个形状结果也相等。这是纯求值数据,不用于推断部署端到端开销。本评审验证源码 CLI、File 和 SQLite。未验证已打包宿主、远端 PostgreSQL、真实模型是否采纳指令或远端 CI。
我的整体评价 / Verdict
批准。原等待、具体修复义务和持久化边界在本地两个 provider 保持一致。单一 TypeScript owner 同时给出一致性和修复计划,留下的 Python 映射维持了现有调用和注册生产点。
English verdict: APPROVE at 3dea2e7. File and SQLite CLI parity preserves waits, complete repair guidance, and unchanged authority, with the typed decision owner consolidated.
Goal And Delivered Outcome
todo.decision_scoperepair-hint selection, hot-path consistency indexing in TypeScript, and Zero-Anytyping in the Python codec.loopx/control_plane/todos/decision_scope.pypreviously maintained a 75-line Python decision chain inbuild_required_decision_scope_repair_hintalongside the TypeScriptdecision_scope.tsrule owner, carried 44Anyannotations, anddecisionScopeConsistencyinloopx/control_plane/todos/decision_scope.tsrecomputedscopeStandingAuthorityon every open Agent Todo while rescanning all gates/actions and re-validating scope regexes inside nested(item × required_scope)loops.decision_scope.py),decision_scope.pyhadany_count=44, anddecisionScopeConsistencyperformed repeated per-item standing-authority filtering and unindexed cross-kind gate/action scans.decision_scope.tsowns repair-plan selection (operation: "repair_hint"and outerrepair_planon failedoperation: "consistency"envelopes without mutatingconsistencykeys, keepingbuild_required_decision_scope_consistency+build_required_decision_scope_repair_hintat 1 RPC on thequota should-runpath while re-querying TS if a caller passes a plain or mutated dict and preserving the registered Pythoneffective_actionproducer site);decisionScopeConsistencyindexes valid scopes bykindand lazily memoizes standing authority perowner;decision_scope.pyhasany_count=0anddict_any_count=0undermypy --strict. Proven bytests/control_plane_ts/decision_scope.test.tsandtests/control_plane/test_todo_decision_scope_runtime_boundary.py.main.Author Declaration
Implemented against
AGENTS.mdand existingtodo.decision_scopecontracts inloopx/control_plane/todos/decision_scope.{py,ts}atorigin/main.projectDecisionScopeRepairPlan,evaluateDecisionScopeinloopx/control_plane/todos/decision_scope.ts;build_required_decision_scope_consistency,build_required_decision_scope_repair_hintinloopx/control_plane/todos/decision_scope.pytests/control_plane_ts/decision_scope.test.tsandtests/control_plane/test_todo_decision_scope_runtime_boundary.pyeffective_actionproducer ownership and zero semantic vocabulary driftbuild_required_decision_scope_repair_hintinloopx/control_plane/todos/decision_scope.pypytest -q tests/architecture/test_semantic_vocabulary_drift.py tests/architecture/test_semantic_producer_binding.pykindand lazily memoize standing authority byownerindecisionScopeConsistencywith exact output/exception parityindexDecisionScopes,coveringRows,decisionScopeConsistencyinloopx/control_plane/todos/decision_scope.tstests/control_plane_ts/decision_scope.test.tsAnyannotations indecision_scope.pyloopx/control_plane/todos/decision_scope.pymypy --strict loopx/control_plane/todos/decision_scope.pyandtest_decision_scope_codec_has_no_any_annotationsnpm run typecheck:control-plane, 15 TypeScript unit tests,ruff,mypy --strict, zero-Anymodule metrics, File + SQLite real-CLI fallback/lifecycle/standing-order suites, semantic vocabulary/producer drift checks,loopx checkpublic-boundary scan,check_rfc_bilingual.py, andloopx canary premerge.Scope And Continuation
todo.decision_scopeslice. Callers such asstall_repair.pyretain their existing call signatures without modification.todo.decision_scoperepair-plan selection and codec typing are complete within this module pair.Validation
3dea2e7b8f09c250fd401d847a78fc43f74c133dfinishedsynthetic,public_fixturestaticpassednpm run typecheck:control-plane,ruff check,mypy --strict loopx/control_plane/todos/decision_scope.py,module_metrics(any_count=0,dict_any_count=0),loopx checkpublic-boundary scan, andscripts/check_rfc_bilingual.py --base origin/main --head HEAD.unitpassednode --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/decision_scope.test.ts(15 passed) andpytest -q tests/control_plane/test_todo_decision_scope_consistency.py tests/control_plane/test_todo_decision_scope_runtime_boundary.py.real_backendpassedpytest -q tests/control_plane/test_scoped_gate_fallback_cli.py tests/control_plane/test_todo_decision_scope_cli_validation.py tests/control_plane/test_todo_decision_scope_lifecycle.py tests/control_plane/test_standing_decision_order.pyacross isolated localfile_v0andsqlite_v0canonical authority stores on qualified Node 24.21.0.regression_paritypassedpytest -q tests/architecture/test_semantic_vocabulary_drift.py tests/architecture/test_semantic_producer_binding.py tests/architecture/test_semantic_python_production.pyandloopx canary premerge --from-git-diff --git-diff-base origin/mainpassed; mutation/changed-errors and malformed-runtime-response tests verify fail-closed re-evaluation without Python fallback.file_v0andsqlite_v0backends and real CLIquota should-runpaths were exercised; remote PostgreSQL authority service is unaffected by this read-only projection rule and was not separately run.See validation disclosure guidance.
Frontend / Visual Evidence
nonenoneType of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
productionScaleCoordinationFixtureverified without mutation intests/control_plane_ts/decision_scope.test.ts).todo_decision_scope_repair_plan_v0transport envelope stays betweendecision_scope.tsanddecision_scope.py.file_v0andsqlite_v0arms via real CLI/authority fixtures.Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).