Repository navigation
refactor(todos): retire legacy Python bridge adapters - #7307
Conversation
Signed-off-by: aihop <4408344+hhyykk@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
动机
维护 Todo 迁移的开发者在核对列表和下一步动作时,仍需分辨已经没有生产调用的 Python 适配层。
此前普通 JSON 列表已由 TypeScript 完成投影,但旧 Python 包装、导出和适配器测试仍留在树中;本次删除这些死路径,真实列表与任务续行继续走已有所有者。
已验证的收益是移除重复维护面并保留调用者语义;本次没有证明更少的运行时往返,也没有完成整体性能资格。
本次不改变任务优先级、接收者范围、完成与续行规则、持久化格式或执行权限,也不宣布整个 TypeScript 迁移完成。
改动思路
既有 TypeScript 读事务已经拥有完整来源、选择和最终投影;删除无人调用的 Python 适配比增加兼容分支更符合单一规则所有者。 当前边界是退役死适配层并保持公共 CLI 与持久化绑定语义;不把负行数或单次延迟观察当整体迁移验收。
普通 todo list --format json 已把 json_references=true 送进读事务,并在 TypeScript 内生成响应内引用。因此,原 Python 条件因已有 todo_list_record_references 而跳过。这里删的是过期路径,不能据此声称运行时调用由两次降为一次。保留 Python 的来源解析、错误包装和输出,保留真正有调用者的 handoff writer;完整来源、筛选、展示上限和最终上下文投影继续由既有 TypeScript 所有者负责。未发现另一套需独立部署的 Python 包装调用者;不添加新适配器或配置层。
具体改动
接受依据为 docs/architecture/rfcs/typescript-control-plane-migration-v0.md,固定版本 666b4b6fa5f27e85aa2157cc13f1091f002478dd。逐项映射:
- Todo read transaction source checkpoint:implemented。完整来源、筛选与最终公共结果仍在同一个读事务;279 条记录的普通、Agent、角色、完成项、限制、薄读和精确读均经真实 File/SQLite CLI 对照。
- 2.4 Replacement, not production dual-running:implemented。基础树搜索显示两份 Python 模块的使用只剩移除的导出和适配器测试;删除六个 lazy exports、两个 daemon handlers,同时保留现有 TypeScript 纯逻辑及实际 handoff writer。
- Caller-observable semantic parity is a promotion gate:implemented。22 个固定输入对照保留完整字段、诊断、计数与权限语义,只排除 envelope 的三个观测时间位置;另用临时语义变异确认真实 CLI 测试会发现投影丢失。
关键代码讲解
handle_todo_list_command保留参数校验、list_goal_todos、统一错误和打印出口,删除结果到手后的第二次投影候选分支。薄读、精确读和失败分支并未另加回退。todoListPayload先从完整来源生成各角色结果,再按精确读、薄读、JSON 引用分支完成输出并封装 coverage;精确正文仍须从唯一来源行恢复。它是此次删除成立的关键既有所有者。projectTodoContextPage继续产生响应内的无损引用与精确上下文。临时绕过这一分支后,真实 CLI 消费者测试因缺少todo_list_record_references失败;恢复原源码后同一测试通过。
生产部分删除 321 行,其中 Python 319 行;三个测试文件清理直接依赖旧适配器的断言,并保留 status compactor 和公共任务完成/下一步写回的检查。不是用减少行数代替语义验证。
对主干的风险
没有发现由本次改动引入的阻塞问题。 最强反例是普通小样例通过,而角色筛选、限制、缺失/精确读或任务续行仍依赖旧包装。独立执行的 22 个基线/当前 CLI 对照一致,40 项 TypeScript 检查与 typecheck 通过;公共 Python 组当前为 69 passed / 4 failed,基线为 72 passed / 4 failed。四个失败测试身份及 CanonicalAuthorityRequired 原因一致,均为未迁移 canonical authority 的旧 fixture;三项通过数差异来自被删除的适配器测试。File/SQLite 的已迁移路径、损坏来源拒绝和恢复、接收者范围、完成和 stale-basis 并发拒绝另有通过证据。
原生 premerge 的 6 项 direct 通过、18 项 selected 中 17 项通过;输出预算检查仍失败。再直接执行完整 differential,固定基线与当前头完整重现相同的 25 个失败项及数值细节,涉及未改动的 quota should-run 内容;没有放宽预算或压掉指令来取绿。预合并门仍是 FAILED,应由其原所有者处理,不能写成全部检查通过。当前改动的 Ruff 通过。未查询、轮询或等待远端 CI。
语义与 CI 对齐
此次复用既有语义词表,未增加 Enum、协议版本或持久化字段。公共读的错误与继续执行条件没有删改;canonical 来源不可用时仍 fail closed。作者早前的完整 TypeScript 运行在 rebase 前中止,不能充当本头通过证据;本评审没有把整体迁移、跨主机安装或性能资格补记为完成。
我的整体评价
APPROVE,针对 ca585ca4e8e21797e1cd5179f6ed0b93961fc261 的代码评审结论;预合并失败仍保留。 长程续行和用户体验均判断为 preserved:任务选择、完成写回与错误恢复仍由既有所有者承担,调用者无需增加任何准备、声明或确认回合。完整 JSON/薄读/Markdown 的公共路径保持;没有渲染界面改动,视觉评审不适用。架构上,退役无调用者的包装已经是同域、可回滚的简化,无需为了本次维护另造阶段或任务。仍未验证当前完整 TS 大套件、真实 PostgreSQL、已安装主机及速度收益;这些限制与已通过的变更语义检查分开记录。批准评审不授予合并、绕过或撤销其他评审的权限。
English verdict: APPROVE at ca585ca4e8e21797e1cd5179f6ed0b93961fc261. The dormant Python adapters can be retired while the existing TypeScript read owner preserves the public CLI contract. Reviewer-executed File/SQLite comparisons and focused native tests passed; four legacy fixture failures and all 25 output-budget differential failures reproduce unchanged on the immutable base. The premerge gate remains failed; no latency or whole-migration qualification and no merge authorization are implied.
Summary
read_transaction.tsalready appliesprojectTodoContextPagefor JSON reference reads.list_projection.pyandnext_action_runtime.py, their six lazy exports, and the two unusedtodo.next_action.*handlers. Keptnext_action.tscore logic and its direct tests.handoff_note.py; it still has live Python callers.Measurements
todo.read). The JSON response already containstodo_list_record_references, so the Pythontodo.context.pagebranch was skipped on the real CLI path. The claimed 2→1 reduction was not reproducible; latency differences cannot be attributed to removing a live bridge.Validation
666b4b6fa:npm run typecheck:control-planepassed; Todo TypeScript tests passed (33); affected Python/CLI tests passed (217), with 4 previously failing baseline fixtures deselected; semantic architecture tests passed (674);ruff check,git diff --check, and the added-line path/credential scan passed.npm run test:control-planeran before rebase and did not complete. It was stopped after 30 minutes with one pending/cancelled test atdelegation_preview_bridge.test.ts; at stop, the runner reported 5474 passed and 76 skipped. The full suite was not rerun on this exact head.The ordinary CLI was already using the TypeScript projection. This PR removes the dormant Python branch and retires legacy Python bridge code; it does not demonstrate a live 2→1 request reduction.