Skip to content

refactor(presentation): compose global summary and gates in TypeScript - #7892

Merged
loopx-agent merged 1 commit into
mainfrom
codex/global-summary-gates-ts-read-20261102
Nov 2, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/global-summary-gates-ts-read-20261102

Conversation

@hhyykk

@hhyykk hhyykk commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

  • Outcome basis / optional anchor: TypeScript control-plane migration RFC: replacement-first migration of domain-neutral composition to the typed owner, with no parallel Python decision owner.
  • Goal/source and gap: loopx global-summary and loopx global-gates were composed in Python (summary_all.py, about 630 lines of lane selection, gate routing, relation calls, ordering, counting, grouping and envelope composition). The gate read also made one cross-runtime relation call per nonempty candidate (R + 1 calls).
  • Observable before → after: Python composition → two complete read projections in loopx/control_plane/presentation/global_manager_read.ts (presentation.global_summary.project, presentation.global_gates.project). Frozen JSON and Markdown output, and the order of source reads, are byte-identical. Gate reads drop from R + 1 crossings to 1.
  • Issue/task and intended base: Self-contained migration slice; base loopx-project/loopx:main. No issue closure claimed.

Author Declaration

  • Written by: model_agent: Factory Droid (lead, review and commits) with OpenAI Codex CLI (implementation).

Implemented against

Criterion Disposition Symbol / path Check
Pin complete output before moving code implemented tests/test_summary_all_transaction_characterization.py, tests/fixtures/summary_all/*.json (JSON + Markdown bytes, source-read order, early stop, unhealthy/stale/incomplete upstream envelopes) passed on unchanged Python before edits; expectations unchanged
One typed owner for composition implemented global_manager_read.ts; relation evaluation and envelope sealing compose in process through their existing owners; no standalone leaf RPC TS global_manager_read.test.ts
No duplicated gate classification implemented Python _gate_source_facts computes formal-gate rows and eligibility once, using the shared open_user_gate_todo_items owner, and the incremental scan uses the same facts for early stop. TS strictly decodes those facts and does not reclassify. TS malformed-fact rejection and source-eligibility adoption tests
Preserve early stop and read order implemented the scan still stops at the original point before further host reads characterization source-read order
Do not add a same-basename Python/TS pair implemented new module name has no Python twin; twins stay 45/45 semantic-vocabulary-drift-smoke.py
Ledger entry in both languages implemented ledger/typescript-control-plane-migration-v0/2026-11-02-global-manager-reads{,.zh-CN}.md, linked from both RFC files check_rfc_bilingual.py
  • Self-check before submission: Read the full diff. A first draft copied the Python user-gate classifier and action-kind hint list into TypeScript while Python kept its own eligibility rule for early stop. That would have left two copies of one rule, so it was replaced by the single Python source predicate described above.

Migration economics receipt

Field Result
Canonical owner loopx/control_plane/presentation/global_manager_read.ts
Legacy code deleted 629 lines of Python composition in summary_all.py
Code added 217 lines TS owner, 102 lines Python source acquisition/codecs, 2 lines handler registration
Cross-runtime calls summary 1 → 1; gates R + 1 → 1 (mixed and early-stop cases measured 2 → 1; cases without relation evaluation 1 → 1)
Product net change +321 / −629 (net −308)
Facade exit Python keeps source acquisition, the gate source predicate, text/timestamp codecs and Markdown rendering. They leave when status/quota source acquisition and user-gate classification have TypeScript owners and the CLI no longer imports the Python renderers (recorded in the ledger).

No latency or long-horizon benefit is claimed.

Scope And Continuation

  • Completed scope and remaining work: Complete for both commands. summary-all is not a registered CLI command on base or on this branch; global-summary is the supported summary command.
  • Deliberately not included: moving status/quota source acquisition or user-gate classification to TypeScript; installed-artifact or latency qualification.
  • Merge coordination: sibling migration PRs from the same batch also edit adjacent lines of effect_runtime_handlers.ts. Whichever merges second needs a trivial rebase.

Validation

  • Tested revision: 13fa1af
  • Run state: finished
  • Input classes: synthetic
Check kind Result Public-safe evidence / limitation
static passed ruff check on changed Python; npm run typecheck:control-plane; git diff --check.
unit passed Python characterization and existing summary tests: 31 passed.
unit passed TS owner, handler dispatch and handler loading: 22 passed.
integration passed Real CLI JSON and Markdown readbacks for both commands (six comparisons) match an archived base byte for byte on a synthetic canonical runtime with a fixed clock. control-plane-integrated-canary-smoke.py: File and SQLite passed on rerun (an earlier run under concurrent test load exceeded the unchanged 60 s aggregate budget).
canary passed loopx canary premerge --from-git-diff --git-diff-base origin/main: direct checks (diff, bilingual, compile, module ceilings), 10/10 catalog canaries, risk-profile smokes and public-boundary scan passed; 0 manual holds.
unit failed (pre-existing) A broader adjacent Python selection had 168 passed and 2 failed; both fail identically on untouched origin/main (867615e): a quota CLI scheduler-envelope test that lacks the required decision-capture arguments, and a steward endpoint vocabulary test that expects an older endpoint set.
  • Coverage and gaps: source-checkout qualification only; wheel/sdist and installed-host checks were not run. No PostgreSQL store behavior changes.

Frontend / Visual Evidence

  • UI impact: none. CLI JSON and Markdown output is byte-identical.
  • Before / After / First viewport / States / Source data / Attention / Craft: N/A; no UI surface change.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring (no functional changes)
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)
  • Capability or extension (providers, adapters, skills)
  • Public docs or presentation surface (README, protocols, dashboard)
  • Build, packaging, installer, or CI
  • Host or runtime integration

Technical Direction

  • Direction / acceptance reference: TypeScript control-plane migration RFC. Global summary and gates are composition over existing typed owners, so they belong in TypeScript; Python remains a source acquisition and rendering adapter.

Shared-authority RFC fixture impact

  • Production-scale fixture schema / semantic dimensions / conformance arms / three-arm rehearsal: N/A; read-only projection, no authority store or persisted format change.

Boundary Checklist

  • Reviewed diff and body for private state, credentials, raw traces, internal links and local machine paths; none included.
  • No maintainer-owned benchmark work duplicated.
  • Change remains scoped to the request described above.
  • Paired RFC and ledger files changed together (EN and zh-CN).
  • UI impact marked none.
  • Every branch commit includes a DCO Signed-off-by trailer (git commit -s).

Merge requires explicit maintainer authorization (control-plane read surfaces under loopx/**).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T11:11:55.461734Z 13fa1af PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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 loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max.

动机 / Motivation

需要跨 Goal 查看下一步和等待决定的操作者。原实现由 Python 组合摘要和门禁,并为关系和 envelope 调用 TypeScript;本次将完整组合迁入一个 typed owner,保留源侧增量读取与既有输出。

真实 CLI 的 JSON 与 Markdown、截断前计数、门禁问题和权限提示与固定基线一致,替换后的产品规则由 TypeScript 持有。不新增产品入口、权限、持久化状态或默认 provider,也不宣称性能或长程收益。本次不完成源 IO、顶层 CLI 和 Markdown 的原生化;完整性能资格仍缺少既有 §6 所要求的冷启动、warm 请求和内存证据。

审查依据为 docs/architecture/rfcs/typescript-control-plane-migration-v0.md,固定 spec_revision 867615e2c3aa2a32516a71d46f11a20d6fcb3289。本次有实际、可回滚的所有权增量;问题在于事务切换的既有交付验收尚未完成。

改动思路 / Approach

完整读取事务复用现有 envelope 与关系 owner,删除 Python 组合规则;保留的门面有实际源读取和 Markdown 调用方。本次边界是现有命令的完整读取所有权迁移;交付前仍需补齐既有性能门。

边界 固定基线 当前 head
来源读取 现有 Python IO 与 codec 保留原有读取及失败来源
组合与判定 Python 组合后调用 typed 辅助规则 一次完整 typed 投影,在进程内复用既有规则
输出与权限 JSON/Markdown,只读 保留输出、来源告警与权限边界

该表根据 13fa1af507d0c2d70bb1254f148f54aa09c39155 的源码归纳,用于解释所有权,不代替执行证据;没有另外验证图形渲染。

具体改动 / Changes

  • projectGlobalSummary 负责完整投影;projectGlobalGates 与其共享源事实、排序和 envelope,正式 gate 分类仍复用 open_user_gate_todo_items,提前停止前不额外读取后续来源。
  • handler、共享源事实与完整输出 fixture随生产路径一起检查;双语 checkpoint 及 RFC 链接同时更新。源侧谓词保留有实际其他调用者,不是第二套组合规则。
  • 2.6:PASS。完整来源 envelope 的 stale/unreadable/incomplete 传播与原始预期一致;独立删去实际 CLI 响应 envelope 的变异均被断言检出。
  • 6-Correctness:PASS。本 PR 22 项定向 TS 测试通过;原始 Python 选择为 66 通过、1 失败。两 PR 的 53 个冻结特征用例原样在固定基线通过。组合审查执行了 24 组 File/SQLite 真实 CLI JSON/Markdown 对照、22 项补充边界观察,未发现 canonical 状态变动。
  • 7:PASS(隔离构建与安装)。基线与两个 head 正常构建 Chat bundle 后均成功生成 wheel/sdist;六个隔离安装环境的 48 次读取与对应源码输出一致。首次陈旧/缺失 bundle 构建失败保留,按现有构建流程修复,没有跳过构建验证;安装探针清除了继承的 PYTHONPATH 并确认实际模块来自隔离包。
  • 6-Performance:UNVERIFIED。下面的必需证据缺口仍未消除。

对主干的风险 / Risks

[P2] 补齐这次事务切换的默认 SQLite 性能资格。 docs/architecture/rfcs/ledger/typescript-control-plane-migration-v0/2026-11-02-global-manager-reads.md 将现有命令直接切换到新 transaction,却只报告源码行为资格。既有 RFC 的 §6 明确要求每次事务切换报告 managed cold-start、warm typed request、完整事务及跨运行时次数、完整 CLI 相对固定 Python 基线,以及 idle/有界 burst 内存;默认 SQLite 还须满足未放宽的 5% 或未解释 25 ms p95 门。不声明性能收益并不能省略该交付门。

我补测的每命令/provider 七组有效完整 CLI 样本使用新隔离 runtime 上下文,尚未建立 warm PID 复用,不能作为稳态资格。SQLite global-gates p95 为 577.156 → 622.105 ms;这是 +44.949 ms 的小样本观察,不能据此断言稳定回归,也不能宣称原门已通过。File 的尾延迟增加单独保留,不把 File-only 指标当作默认 SQLite 的独立否决理由。

最小修复是为当前 unchanged head 与 867615e2c3aa2a32516a71d46f11a20d6fcb3289 补齐上述已有量测:使用相同真实合成 SQLite fixture,分开 cold 与 warm,验证 runtime PID 复用,保留完整样本与来源/传输成本;若超过门限,保留 owner review gate 并解释或修复。无需修改业务范围、预算或测试预期。

另外,Python 选择中唯一失败是 test_real_cli_quota_should_run_discloses_unreadable_scheduler_state:固定基线与当前 head 都在进入投影前因缺少 --turn-instance-id/--begin-turn 返回相同 QUOTA_VALIDATION_FAILED。测试及 quota CLI 源文件逐字节未变,故这是已独立归因的旧夹具失败;原始运行仍为 FAIL,不请求本 PR 修复无关代码。定向 premerge 的 19 项选择、typecheck、Ruff 与 diff 检查通过,未查询或等待 CI。

本次 exact-scope change-quality receipt 也保留 FAIL:必需性能验证未完成,原始相邻 Python 运行仍有上述旧失败;没有把这些状态改写为通过。

我的整体评价 / Verdict

REQUEST_CHANGES,针对未完成的既有性能验收。摘要与门禁的 owner 归属、规则删除、实际调用方和功能兼容性均有证据,未复现新的功能缺陷;无需扩大为整个迁移路线图。补齐当前 transaction 的默认 profile 资格后即可重新判断该缺口。

已检查现有 CLI dispatch、JSON 与 Markdown renderer;本次没有页面或布局改动,无需新增截图。无新增可视页面;持续运行性能仍待既有验收。保留代码回滚路径、来源失败和原有权限边界,不把 review 或测试通过当作安装主机采用、父目标验收或 merge 授权。

English verdict: REQUEST_CHANGES — head 13fa1af507d0c2d70bb1254f148f54aa09c39155 preserves tested behavior, but the existing RFC §6 default-SQLite transaction performance qualification is incomplete. Functional, negative-path and isolated artifact checks passed; the unrelated baseline fixture failure remains disclosed.

The global-summary and global-gates CLI reads now call
presentation.global_summary.project and presentation.global_gates.project.
TypeScript owns lane selection, gate routing, ordering, counting, grouping,
actions and envelope composition. Python keeps source acquisition and one
source-side gate predicate built on the shared open_user_gate_todo_items
owner, so classification is not repeated across runtimes.

Frozen JSON and Markdown characterization stays byte-identical, source
read order and early stop are preserved, and gate crossings drop from
R+1 to one.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Signed-off-by: hhyykk <4408344+hhyykk@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/global-summary-gates-ts-read-20261102 branch from 13fa1af to 7d41256 Compare November 2, 2026 16:02

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: loopx-agent; exact head: 7d41256211332ebc2e35582003f5da2dbd30c497

动机 / Motivation

操作者需要跨 Goal 查看全局摘要、下一步和等待决定的门禁项。原实现由 Python 选择 lane、组装 gate、调用关系和 envelope 再组合输出,规则和调用顺序分散在多个运行时中。这个 PR 把完整摘要与门禁读取移到同一个 TypeScript owner,使操作者继续得到原有 JSON、Markdown、排序和告警内容,同时让后续维护只需修改一处决策代码。

改动思路 / Approach

入口仍是现有 global-summary 与 global-gates CLI。Python 保留实际的状态、配额和本地源读取,以及必要的文本、时间和 Markdown 适配;TypeScript 负责 lane 选择、gate 路由、排序、计数、分组、动作和 envelope 组合。门禁的提前停止仍由 Python 源侧事实决定,避免移动读取边界后额外请求后续来源。决策关系与 projection envelope 复用现有 owner,没有新增平行服务或持久化格式。

具体改动 / Changes

关键代码讲解

  • projectGlobalSummary 在一次请求内组合 lane、计数、动作和 envelope;冻结 CLI 输出仍覆盖空源、混合 lane、重复 Goal、不可用配额和上游 envelope 状态。
  • projectGlobalGates 使用同一组源事实生成正式门禁项,并把关系调用从按候选数增长收敛到一次事务内组合。
  • _gate_source_facts 保留提前停止所需的单一源侧分类,TypeScript 只严格解码这些事实,没有复制用户门禁规则。

验证

  • TS owner 与 handler 定向测试通过:20/20。
  • npm run typecheck:control-plane 通过。
  • Python 定向运行 66 通过、1 个已知基线失败;失败测试与相关 quota 源文件相对 main 未变化,且与本 PR 改动无重叠。
  • check_rfc_bilingual.py --base origin/main --head HEAD 与 git diff --check 通过。
  • rebase 冲突只发生在双语 RFC 的检查点列表;主干 quota 条目和本 PR 条目均已保留,没有逻辑冲突。

对主干的风险 / Risks

没有发现新的阻断性功能问题。剩余风险是 CLI 输出的兼容性和门禁提前停止语义,现有冻结输出、异常源和 handler 测试覆盖了这些边界。性能资格按当前 owner 的决定不作为本次合并门禁,因此本 review 不把性能结论标记为已认证。发布时 CI 仍在运行;合并前会继续等待必需检查与最新 head 再读确认。

我的整体评价 / Verdict

APPROVE。全局摘要和门禁的组合责任已集中到 TypeScript owner,Python 只保留源读取和输出适配,功能兼容性有当前 head 的定向证据支持。merge 仍需等待 GitHub 必需检查通过,并针对未变化的精确 head 完成 readiness 检查。

English verdict: APPROVE — the exact head preserves the existing summary and gate outputs while moving their composition to one typed owner. Performance qualification is explicitly outside this merge decision, and merge readiness remains contingent on required CI and exact-head checks.

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: loopx-agent; exact head: 7d41256211332ebc2e35582003f5da2dbd30c497

动机 / Motivation

操作者需要跨 Goal 查看全局摘要、下一步和等待决定的门禁项。原实现由 Python 选择 lane、组装 gate、调用关系和 envelope 再组合输出,规则和调用顺序分散在多个运行时中。这个 PR 把完整摘要与门禁读取移到同一个 TypeScript owner,使操作者继续得到原有 JSON、Markdown、排序和告警内容,同时让后续维护只需修改一处决策代码。

改动思路 / Approach

入口仍是现有 global-summary 与 global-gates CLI。Python 保留实际的状态、配额和本地源读取,以及必要的文本、时间和 Markdown 适配;TypeScript 负责 lane 选择、gate 路由、排序、计数、分组、动作和 envelope 组合。门禁的提前停止仍由 Python 源侧事实决定,避免移动读取边界后额外请求后续来源。决策关系与 projection envelope 复用现有 owner,没有新增平行服务或持久化格式。

具体改动 / Changes

关键代码讲解

  • projectGlobalSummary 在一次请求内组合 lane、计数、动作和 envelope;冻结 CLI 输出仍覆盖空源、混合 lane、重复 Goal、不可用配额和上游 envelope 状态。
  • projectGlobalGates 使用同一组源事实生成正式门禁项,并把关系调用从按候选数增长收敛到一次事务内组合。
  • _gate_source_facts 保留提前停止所需的单一源侧分类,TypeScript 只严格解码这些事实,没有复制用户门禁规则。

验证

  • TS owner 与 handler 定向测试通过:20/20。
  • npm run typecheck:control-plane 通过。
  • Python 定向运行 66 通过、1 个已知基线失败;失败测试与相关 quota 源文件相对 main 未变化,且与本 PR 改动无重叠。
  • check_rfc_bilingual.py --base origin/main --head HEAD 与 git diff --check 通过。
  • rebase 冲突只发生在双语 RFC 的检查点列表;主干 quota 条目和本 PR 条目均已保留,没有逻辑冲突。

对主干的风险 / Risks

没有发现新的阻断性功能问题。剩余风险是 CLI 输出的兼容性和门禁提前停止语义,现有冻结输出、异常源和 handler 测试覆盖了这些边界。性能资格按当前 owner 的决定不作为本次合并门禁,因此本 review 不把性能结论标记为已认证。发布时 CI 仍在运行;合并前会继续等待必需检查与最新 head 再读确认。

我的整体评价 / Verdict

APPROVE。全局摘要和门禁的组合责任已集中到 TypeScript owner,Python 只保留源读取和输出适配,功能兼容性有当前 head 的定向证据支持。merge 仍需等待 GitHub 必需检查通过,并针对未变化的精确 head 完成 readiness 检查。

English verdict: APPROVE — the exact head preserves the existing summary and gate outputs while moving their composition to one typed owner. Performance qualification is explicitly outside this merge decision, and merge readiness remains contingent on required CI and exact-head checks.

@loopx-agent
loopx-agent merged commit d69524e into main Nov 2, 2026
6 of 7 checks passed
@loopx-agent
loopx-agent deleted the codex/global-summary-gates-ts-read-20261102 branch November 2, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants