Repository navigation
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.
动机
需要在命令行反复读取多个 Goal 状态的用户和 Agent。
帮助和五个全局读取命令过去先加载完整兼容 CLI;现在帮助只加载参数注册,读取走既有处理器和统一分发。
原有五个命令的参数、帮助、错误、范围和状态读回保持一致,帮助与实际读取的加载开销下降。
本改动不更改配额、权限、Todo 状态或 provider 路由,也不交付完整原生 CLI 或安装态 App。
完整原生 CLI、托管及安装态 App、长期任务收益和完整成本仍由迁移主线继续验收。
改动思路
参数注册与执行处理分开,并复用原 dispatcher,删除完整 CLI 的重复分支。 只迁移既有五个全局读取命令的参数注册和 CLI 调用路径。
正常入口先按既有命令名选择轻量 parser,再经原 guard、registry/runtime 解析与统一 dispatcher 调用原 handler。完整 parser 的兼容入口也复用相同 dispatcher,旧分支移除。注册函数搬到只定义参数的模块,旧 import 只是同一个函数的 alias;帮助不必加载 handler。解析拒绝仍回到原完整 parser 以保留诊断。
这是调用路径及代码版本生命周期的有界改进。状态和准入规则仍由既有 typed owner 决定,观察来源缺失仍明确显示;没有额外 provider、协议操作、领域状态、权限判断或同步状态副本。
具体改动
评审完整 head c984ac2fbaae3d234aad76493c0c8af69df19f93,实际 PR merge-base 为 a590609a357f7cde17289b5ceba9f85a9fcb46cc。先固定接受的 docs/architecture/rfcs/typescript-control-plane-migration-v0.md,规范修订 a590609a357f7cde17289b5ceba9f85a9fcb46cc,再读完整提案。
规范逐项映射:§2.4 复用既有 owner,未双跑语义;§2.8 以同输入基线/当前入口核验成本;§5 分开报告生产 LOC、代码搬移和兼容边界;§6 比较完整输出、真实 File/SQLite、失败恢复和反例敏感性;§7 从正常 wheel/sdist 的实际 console 执行。以上在本切片 implemented;Stage 3 的完整 native CLI/App 收敛 deferred,剩余边界如动机所述。这里不以零语义删除、目录移动或更少 RPC 宣称完成整个迁移阶段。
关键代码讲解
_build_selected_parser: 五个命令复用搬移后的同一份注册;帮助与非法参数诊断仍与完整 parser 对照。_dispatch_common_command: 实际读取在既有请求 scope 内进入原 handler,原 controller guard 和路径解析顺序保留。register_summary_all_command: 参数、默认值、选项和帮助文本的原函数 AST 完整保留。handle_summary_all_command: 原状态读取、manager-view、错误投影和格式输出的函数 AST 不变。
生产代码 +150/-136,净 +14;四个原函数 AST 完全一致,旧完整 CLI 的 11 行导入/分发退役。搬移不计作领域语义删除;旧注册 alias 对应实际 legacy export facade 调用者,随这些消费者退役而退出。新 GLOBAL_READ_COMMANDS 是已有五个命令的本地分发集合,没有新增共享协议词汇。
176 项相关 Python 测试通过;标准 premerge 的 6 项直接检查通过,19 项选中检查中 18 项通过,原输出差分红灯的独立归因见下节。
每个 PR 独立比较 40 组真实 File/SQLite CLI 结果,覆盖五个命令、四个 manager-view、单 Goal 范围、未知范围、坏参数、损坏来源和暂停/恢复。另补 cap 与新来源的反例。每个 PR 的正常 wheel、sdist 各 25 个 console 案例通过:独立环境、空 cwd、无源码 PYTHONPATH,包内生产字节和 native 根已核。注册、state 和历史源文件保持不变。
比较保留完整字段、错误全文、权限、覆盖率、新鲜度标签、持久化时间及文件/库存 revision,只规范化明确的观察时钟和观察耗时。portfolio 的来源 digest 由捕获的原始 status 重算,原始快照和 manager context 的派生身份也独立核验,再比较规范化后的含义;没有直接删掉 opaque ID 掩盖差异。
增量实验在两臂都保留 #6992 的公共 quota scope,再加入本 PR;私有组合的四份 CLI 生产文件与当前 PR 逐字一致。相同 SQLite 八 Goal 输入、相同 Python/Node、完整字节码和已热原生运行时,每臂 15 次正常入口新进程:摘要 p50 1067.82→747.14 ms、p95 1120.95→781.75 ms;帮助 p95 380.28→36.26 ms。全部输出保持一致,不重复计算 #6992 的收益。
对主干的风险
最关键的风险是代码 scope 跨请求泄漏,或入口搬移改变拒绝顺序、隐藏来源不完整和旧状态。实际负例保留:未知 Goal 的原合同是 code 0、空结果与 missing_goal_ids/不完整覆盖,不是凭空改为拒绝码;坏 registry 和无对应 mode 的 exact Todo 保持原错误;暂停后可见任务从 8 变 7,恢复后回到 8。未配置全局目录的 gates/todos 仍报来源不可用,不能称全局来源全健康。cap 下其余行明确 omitted,新注册的坏来源不会闯入已限定的 Goal 读取;显式读坏来源保持 unknown。
语义与 CI 对齐
原 main-relative premerge 仍红,未改门槛。固定较新 main 5bf58c1ca3d21919b15c662bc705c3e069bfb496,用同一完整检查分别对不可变基线与当前 head 运行,全部 15 条失败身份和细节一致:规划结构/动作摘要,以及三条 status Markdown 增长 38、允许 32 的预算。相关 status/quota/输出检查 owner 字节不变,触发与本 PR 的五个 global 命令分发分离;实际 PR 基线到 head 的完整 96 项输出差分通过。按现行评审失败归因规则,这是既有不相关红灯,保留单独集成/合并资格 hold。不能把“可 APPROVE”改写成“原 premerge 全绿”。
原生调用的方法序列保持一致;没有发起真实工作、外部 provider 投递或修改活跃 Goal。旧缺陷/私有变体会失败,当前 head 通过;包构建使用当前源码重建忽略的 Chat 资源后正常完成,最初错误构建调用和旧资源拒绝均保留。没有弱化断言、删掉失败或修改 budget。未查询、轮询或等待远程 CI。
冷原生启动、daemon RSS、PostgreSQL、Windows、安装态 App/Lark/模型以及长程净收益和完整成本仍未验证;本次不改变它们的原验收或授予推广资格。
我的整体评价
未发现本次精确 head 的阻断问题,结论 APPROVE。交付判断为 justified_increment:真实调用者获得可测的读取成本改善,边界可独立验证和回滚;不把这一结果等同整体 Stage 3、Goal 完成或模型收益。long_horizon 判为 preserved:当前状态、暂停、范围、失败恢复与后续读取语义保留;user_experience 判为 improved:同一读任务减少本地等待,无新增准备、权限或确认轮次。
参数注册与执行处理分开,并复用原 dispatcher,删除完整 CLI 的重复分支。 只迁移既有五个全局读取命令的参数注册和 CLI 调用路径。 兼容保留有真实调用方;采用现有 typed vocabulary/owner,没有新增领域状态分类或以 prose 猜测规则。保留已说明的未测边界和单独集成红灯。APPROVE 不授予合并、安装或发布权限。
English verdict: APPROVE — c984ac2fbaae3d234aad76493c0c8af69df19f93. Global reads reuse the existing selected parser/dispatcher and unchanged handler. 176 focused tests,40 full real-provider CLI pairs,50 installed console cases and isolated incremental CLI measurements pass. The original premerge remains red on15 independently matched pre-existing failures; preserve the separate integration hold.
Goal And Delivered Outcome
Five existing read commands (
goal-portfolio,global-summary,global-gates,global-todos,global-risks) currently load the complete compatibility CLI before parsing or dispatching. Their argparse registration also imports the read implementation. A caller asking for help pays for unrelated command handlers and status dependencies.Reuse the selected-command parser/shared dispatcher. Move the unchanged registration into
summary_all_registration.py, retain the old registration import as an alias, and remove the full CLI's old dispatch branch. The normal entrypoint loads only registration for help and the existing read handler for accepted commands. Full-parser callers reuse that same dispatch.Basis: TypeScript control-plane migration RFC Stage 3 caller adoption,
docs/architecture/rfcs/typescript-control-plane-migration-v0.mdata590609a357f7cde17289b5ceba9f85a9fcb46cc. Target:main. No kernel/lifecycle/default-provider completion claimed.Author Declaration
Implemented against
cli_runtime.pyselected path; oldcli.pyglobal-read branch deletedSelf-check: clean-code-guard, test-guard and docs-guard; four original function ASTs are identical after the move; CLI/real-provider/installed paths and historical import regression tested. No real model, live provider send, merge or deployment was run.
Scope And Continuation
GLOBAL_READ_COMMANDSremains a local dispatch group of existing parser command names. It does not add a command, persisted value, domain enum or shared protocol; the diff-scoped advisory finding was reviewed as local vocabulary.Validation
c984ac2fbaae3d234aad76493c0c8af69df19f93.loopx.cliimport and preserve coverage/error behaviorIncremental performance, after #6992
This is deliberately not main versus a candidate that takes credit for the already-proposed quota scope fix:
cdc0c89e13c13a7f53427b60ad881c18583d6049.loopx.cli, and help does not load the read handler.The global read's code scans fall 10 → 1 by composing the existing whole-command scope. This is additional caller scope sharing after #6992's per-decision scope, not its earlier 346 → 10 saving. No source fact or result is cached. Help text is byte-identical. Read outputs match except observation times; source fields, alerts, coverage and the local-registry global-directory warning remain visible. No complete global-inventory or all-healthy claim is made.
These are local synthetic workload measurements with prepared bytecode/native caches, not cold installation, model/task quality, token savings or the entire LoopX application. No wall-clock assertion is added to the test suite; the deterministic regression checks retired imports and actual behavior.
Reproduce the incremental comparison
Use the public synthetic
setup_goals.pyfixture setup from #6992. It creates real disposable File/SQLite stores and public Todos without executing work. Use empty fixture/evidence directories, the same Python interpreter and qualified Node, and install Python/Node dependencies in both checkouts.Create two disposable worktrees from public #6992 head
cdc0c89e13c13a7f53427b60ad881c18583d6049; cherry-pick this PR commit into only the candidate worktree. This intentionally includes the same earlier optimization on both sides. Save the following script outside both checkouts, idle unrelated work, and run sequentially:The script precompiles each package, verifies bytecode completeness and actual import origins, records every sample/output/native method, rejects an unexpected full CLI import, and stops only its owned runtime. Usage pings are disabled. Harness SHA256:
ebd2cf3d5813fd0135a34e70fee079e33d4e6cc0b9be7f36fd67e0d11ce86d31.Coverage/gaps: full repository suite, PostgreSQL, Windows, browser/model roundtrips and live provider delivery were not run. No TS domain code changed. Hosted CI and maintainer review remain separate from these local author checks.
Frontend / Visual Evidence
UI impact: none. Existing help text, flags and read output shapes remain unchanged; no new screen or capability.
Change Area
Technical Direction
Existing TypeScript control-plane migration, Stage 3. Reuse existing registration/transport/semantic owners and retire the obsolete caller branch; do not add per-field bridges.
Shared-authority RFC fixture impact
Boundary Checklist