Repository navigation
refactor(presentation): own the complete global-risks read in TypeScript - #7893
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.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max.
动机 / Motivation
需要跨 Goal 检查过期运行、诊断和轮询风险的操作者。原实现由 Python 归一化、合并和排序风险,再桥接封装 envelope;本次让一次 typed 请求完成风险组合,Python 继续读取状态和收据。
真实 CLI 的风险内容、排序、来源告警和 Markdown 与固定基线一致,包含 240 分钟边界、微秒、停止轮询及损坏收据恢复。不新增产品入口、权限、持久化状态或默认 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,只读 | 保留输出、来源告警与权限边界 |
该表根据 de65cbb3418dcba155dea87a670e01ab76c51c11 的源码归纳,用于解释所有权,不代替执行证据;没有另外验证图形渲染。
具体改动 / Changes
projectGlobalRisks负责完整投影;_read_host_poll_sources保留有界收据获取,typed owner 负责时刻比较、Agent 过滤、风险聚合、严重性排序与 envelope;旧 Python stale 判定已删除。- handler、词汇 owner 指向、规范路径模式一致性测试与完整输出 fixture随生产路径一起检查;双语 checkpoint 及 RFC 链接同时更新。路径模式镜像仍有跨语言正则边界,未将模式文本一致称为整个正则语言等价。
- 2.6:PASS。完整来源 envelope 的 stale/unreadable/incomplete 传播与原始预期一致;独立删去实际 CLI 响应 envelope 的变异均被断言检出。
- 6-Correctness:PASS。本 PR 21 项定向 TS 测试通过;原始 Python 选择为 165 通过、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-risks-read.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-risks p95 为 507.223 → 501.242 ms,但这个局部观察没有覆盖 warm 请求及 idle/burst 内存,不能替代完整要求。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 de65cbb3418dcba155dea87a670e01ab76c51c11 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.
de65cbb to
6a0750d
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: loopx-agent; exact head: 6a0750d44f9f2a482580048a1f20afb63c6186f6
动机 / Motivation
操作者需要跨 Goal 查看过期运行、诊断和轮询风险。原实现对风险行做归一化、合并、严重性排序和 envelope 组装时,把 stale host-poll 判定分散在 Python 辅助模块中;规则移动或修改时容易产生两套语义。这个 PR 让一次 typed 读取拥有完整风险投影,同时保持操作者看到的 JSON、Markdown、排序、来源告警和错误边界。
改动思路 / Approach
Python 继续读取状态、注册信息、持久化收据和 Markdown,TypeScript 负责风险行推导、240 分钟边界判定、Agent 过滤、聚合、严重性排序、限制和 envelope 组合。旧的 Python stale host-poll helper 与其常量被删除,使规则只有一个生产 owner。公开本地路径模式由 Python 与 TypeScript 共用一致性测试约束,避免脱敏边界在迁移后漂移。
具体改动 / Changes
关键代码讲解
projectGlobalRisks组合风险行、Agent scope、聚合、排序、限制和 envelope;冻结的 37 个特征用例保持输出兼容。_read_host_poll_sources只保留有界来源获取,stale 判定已移入 typed owner;缺少 continuation 或超过微秒边界的输入仍明确拒绝。LOCAL_PATH_PATTERNS与 Python canonical patterns 由有序 source-and-flags 测试校验,覆盖公开输出脱敏边界。
验证
- TS owner 与 handler 定向测试通过:19/19。
- Python 风险、host-poll、特征化和路径模式一致性测试通过:130/130。
npm run typecheck:control-plane通过。check_rfc_bilingual.py --base origin/main --head HEAD与git diff --check通过。- rebase 冲突只发生在双语 RFC 的检查点列表;主干 quota 条目和本 PR 条目均已保留,没有业务代码冲突。
对主干的风险 / Risks
没有发现新的阻断性功能问题。主要剩余风险是状态投影字段的兼容性、损坏收据恢复和公开路径脱敏;这些边界分别由冻结输出、错误 envelope 和跨语言模式一致性测试覆盖。性能资格按当前 owner 的决定不作为本次合并门禁,因此本 review 不把性能结论标记为已认证。发布时 CI 仍在运行;合并前会继续等待必需检查与最新 head 再读确认。
我的整体评价 / Verdict
APPROVE。完整 global-risk 读取已由单一 TypeScript owner 组合,旧的 stale host-poll 规则和 Python 风险组合代码已删除,兼容性与负向路径有当前 head 的定向证据支持。merge 仍需等待 GitHub 必需检查通过,并针对未变化的精确 head 完成 readiness 检查。
English verdict: APPROVE — the exact head preserves global-risk output and failure behavior while consolidating stale host-poll and risk composition in one typed owner. Performance qualification is explicitly outside this merge decision, and merge readiness remains contingent on required CI and exact-head checks.
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: loopx-agent; exact head: 6a0750d44f9f2a482580048a1f20afb63c6186f6
动机 / Motivation
操作者需要跨 Goal 查看过期运行、诊断和轮询风险。原实现对风险行做归一化、合并、严重性排序和 envelope 组装时,把 stale host-poll 判定分散在 Python 辅助模块中;规则移动或修改时容易产生两套语义。这个 PR 让一次 typed 读取拥有完整风险投影,同时保持操作者看到的 JSON、Markdown、排序、来源告警和错误边界。
改动思路 / Approach
Python 继续读取状态、注册信息、持久化收据和 Markdown,TypeScript 负责风险行推导、240 分钟边界判定、Agent 过滤、聚合、严重性排序、限制和 envelope 组合。旧的 Python stale host-poll helper 与其常量被删除,使规则只有一个生产 owner。公开本地路径模式由 Python 与 TypeScript 共用一致性测试约束,避免脱敏边界在迁移后漂移。
具体改动 / Changes
关键代码讲解
projectGlobalRisks组合风险行、Agent scope、聚合、排序、限制和 envelope;冻结的 37 个特征用例保持输出兼容。_read_host_poll_sources只保留有界来源获取,stale 判定已移入 typed owner;缺少 continuation 或超过微秒边界的输入仍明确拒绝。LOCAL_PATH_PATTERNS与 Python canonical patterns 由有序 source-and-flags 测试校验,覆盖公开输出脱敏边界。
验证
- TS owner 与 handler 定向测试通过:19/19。
- Python 风险、host-poll、特征化和路径模式一致性测试通过:130/130。
npm run typecheck:control-plane通过。check_rfc_bilingual.py --base origin/main --head HEAD与git diff --check通过。- rebase 冲突只发生在双语 RFC 的检查点列表;主干 quota 条目和本 PR 条目均已保留,没有业务代码冲突。
对主干的风险 / Risks
没有发现新的阻断性功能问题。主要剩余风险是状态投影字段的兼容性、损坏收据恢复和公开路径脱敏;这些边界分别由冻结输出、错误 envelope 和跨语言模式一致性测试覆盖。性能资格按当前 owner 的决定不作为本次合并门禁,因此本 review 不把性能结论标记为已认证。发布时 CI 仍在运行;合并前会继续等待必需检查与最新 head 再读确认。
我的整体评价 / Verdict
APPROVE。完整 global-risk 读取已由单一 TypeScript owner 组合,旧的 stale host-poll 规则和 Python 风险组合代码已删除,兼容性与负向路径有当前 head 的定向证据支持。merge 仍需等待 GitHub 必需检查通过,并针对未变化的精确 head 完成 readiness 检查。
English verdict: APPROVE — the exact head preserves global-risk output and failure behavior while consolidating stale host-poll and risk composition in one typed owner. Performance qualification is explicitly outside this merge decision, and merge readiness remains contingent on required CI and exact-head checks.
loopx global-risks now calls presentation.global_risks.project. TypeScript owns row derivation, stale host-poll detection, agent scoping, aggregation, ordering, limits, groups and envelope composition. Python keeps host source acquisition, persisted receipt decoding, Markdown rendering and the transport-unavailable error codec. The stale host-poll rule moves out of host_poll_receipts.py, so it has a single owner. The TypeScript copy of the public local-path patterns is tied to the Python owner by a parity test that fails on drift. Frozen characterization (37 cases) stays byte-identical and the read keeps one transaction-local crossing. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Signed-off-by: hhyykk <4408344+hhyykk@users.noreply.github.com>
cd2e0f0
6a0750d to
cd2e0f0
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: loopx-agent; exact head: cd2e0f0a97e439ab6c8f76a6e4b6db1063c1a0f2
动机 / Motivation
操作者需要跨 Goal 查看过期运行、诊断和轮询风险。原实现对风险行做归一化、合并、严重性排序和 envelope 组装时,把 stale host-poll 判定分散在 Python 辅助模块中;规则移动或修改时容易产生两套语义。这个 PR 让一次 typed 读取拥有完整风险投影,同时保持操作者看到的 JSON、Markdown、排序、来源告警和错误边界。
改动思路 / Approach
Python 继续读取状态、注册信息、持久化收据和 Markdown,TypeScript 负责风险行推导、240 分钟边界判定、Agent 过滤、聚合、严重性排序、限制和 envelope 组合。旧的 Python stale host-poll helper 与其常量被删除,使规则只有一个生产 owner。公开本地路径模式由 Python 与 TypeScript 共用一致性测试约束,避免脱敏边界在迁移后漂移。
具体改动 / Changes
关键代码讲解
projectGlobalRisks组合风险行、Agent scope、聚合、排序、限制和 envelope;冻结的 37 个特征用例保持输出兼容。_read_host_poll_sources只保留有界来源获取,stale 判定已移入 typed owner;缺少 continuation 或超过微秒边界的输入仍明确拒绝。LOCAL_PATH_PATTERNS与 Python canonical patterns 由有序 source-and-flags 测试校验,覆盖公开输出脱敏边界。
验证
- 合并 7892 后的 TS risk、summary 与 handler 定向测试通过:25/25。
- 合并后的 Python 风险、host-poll、特征化、路径模式一致性、summary 和摘要特征化测试通过:161/161。
npm run typecheck:control-plane通过。check_rfc_bilingual.py --base origin/main --head HEAD与git diff --check通过。- rebase 后双语 RFC 的 summary/gates、quota 和 risk 条目均已保留;相邻 handler 自动合并且两类投影均已注册,复验通过。
对主干的风险 / Risks
没有发现新的阻断性功能问题。主要剩余风险是状态投影字段的兼容性、损坏收据恢复和公开路径脱敏;这些边界分别由冻结输出、错误 envelope 和跨语言模式一致性测试覆盖。性能资格按当前 owner 的决定不作为本次合并门禁,因此本 review 不把性能结论标记为已认证。发布时 CI 仍在运行;合并前会继续等待必需检查与最新 head 再读确认。
我的整体评价 / Verdict
APPROVE。完整 global-risk 读取已由单一 TypeScript owner 组合,旧的 stale host-poll 规则和 Python 风险组合代码已删除,兼容性与负向路径有当前 head 的定向证据支持。merge 仍需等待 GitHub 必需检查通过,并针对未变化的精确 head 完成 readiness 检查。
English verdict: APPROVE — the exact head preserves global-risk output and failure behavior while consolidating stale host-poll and risk composition in one typed owner. Performance qualification is explicitly outside this merge decision, and merge readiness remains contingent on required CI and exact-head checks.
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: loopx-agent; exact head: cd2e0f0a97e439ab6c8f76a6e4b6db1063c1a0f2
动机 / Motivation
操作者需要跨 Goal 查看过期运行、诊断和轮询风险。原实现对风险行做归一化、合并、严重性排序和 envelope 组装时,把 stale host-poll 判定分散在 Python 辅助模块中;规则移动或修改时容易产生两套语义。这个 PR 让一次 typed 读取拥有完整风险投影,同时保持操作者看到的 JSON、Markdown、排序、来源告警和错误边界。
改动思路 / Approach
Python 继续读取状态、注册信息、持久化收据和 Markdown,TypeScript 负责风险行推导、240 分钟边界判定、Agent 过滤、聚合、严重性排序、限制和 envelope 组合。旧的 Python stale host-poll helper 与其常量被删除,使规则只有一个生产 owner。公开本地路径模式由 Python 与 TypeScript 共用一致性测试约束,避免脱敏边界在迁移后漂移。
具体改动 / Changes
关键代码讲解
projectGlobalRisks组合风险行、Agent scope、聚合、排序、限制和 envelope;冻结的 37 个特征用例保持输出兼容。_read_host_poll_sources只保留有界来源获取,stale 判定已移入 typed owner;缺少 continuation 或超过微秒边界的输入仍明确拒绝。LOCAL_PATH_PATTERNS与 Python canonical patterns 由有序 source-and-flags 测试校验,覆盖公开输出脱敏边界。
验证
- 合并 7892 后的 TS risk、summary 与 handler 定向测试通过:25/25。
- 合并后的 Python 风险、host-poll、特征化、路径模式一致性、summary 和摘要特征化测试通过:161/161。
npm run typecheck:control-plane通过。check_rfc_bilingual.py --base origin/main --head HEAD与git diff --check通过。- rebase 后双语 RFC 的 summary/gates、quota 和 risk 条目均已保留;相邻 handler 自动合并且两类投影均已注册,复验通过。
对主干的风险 / Risks
没有发现新的阻断性功能问题。主要剩余风险是状态投影字段的兼容性、损坏收据恢复和公开路径脱敏;这些边界分别由冻结输出、错误 envelope 和跨语言模式一致性测试覆盖。性能资格按当前 owner 的决定不作为本次合并门禁,因此本 review 不把性能结论标记为已认证。发布时 CI 仍在运行;合并前会继续等待必需检查与最新 head 再读确认。
我的整体评价 / Verdict
APPROVE。完整 global-risk 读取已由单一 TypeScript owner 组合,旧的 stale host-poll 规则和 Python 风险组合代码已删除,兼容性与负向路径有当前 head 的定向证据支持。merge 仍需等待 GitHub 必需检查通过,并针对未变化的精确 head 完成 readiness 检查。
English verdict: APPROVE — the exact head preserves global-risk output and failure behavior while consolidating stale host-poll and risk composition in one typed owner. Performance qualification is explicitly outside this merge decision, and merge readiness remains contingent on required CI and exact-head checks.
Goal And Delivered Outcome
loopx global-riskswas composed in Python (global_risks.py, about 1,000 lines of row derivation, aggregation, ordering, agent scoping and envelope composition). The stale host-poll rule lived separately inhost_poll_receipts.py.loopx/control_plane/presentation/global_risk_read.ts(presentation.global_risks.project). Frozen output for all 37 characterization cases is byte-identical, and the read keeps one transaction-local crossing (projection.envelope.sealis replaced bypresentation.global_risks.project).loopx-project/loopx:main. No issue closure claimed.Author Declaration
Implemented against
tests/test_global_risks_transaction_characterization.py,tests/fixtures/global_risks_transaction.json(37 cases including source errors and Agent-scope failures)global_risk_read.ts; envelope sealing composes in process through the existing ownerglobal_risk_read.test.tsstale_host_poll_riskandHOST_POLL_STALE_MINUTESremoved fromhost_poll_receipts.py; the 240-minute inclusive microsecond comparison now lives only in TSLOCAL_PATH_PATTERNS, mirroring the canonical Python patterns;tests/test_global_risks_path_pattern_parity.pycompares ordered sources and flagssemantic-vocabulary-drift-smoke.pyvocabulary_v0.jsonglobal_risksowner now points at the TSSOURCE_SURFACES; budgets unchangedledger/typescript-control-plane-migration-v0/2026-11-02-global-risks-read{,.zh-CN}.md, linked from both RFC filescheck_rfc_bilingual.py(?i:UNC),(?i:Volume),(?i:GLOBALROOT\Device\)), while the JS patterns use a whole-patterniflag. TS can therefore redact slightly more than Python (for example, upper-case POSIX prefixes), never less. The parity test normalizes exactly these three groups and documents why.Migration economics receipt
loopx/control_plane/presentation/global_risk_read.tsglobal_risks.pyand 44 lines inhost_poll_receipts.pyNo latency or long-horizon benefit is claimed.
Scope And Continuation
loopx global-risks. Rollback candidates remain an explicit omission, as before.effect_runtime_handlers.ts. Whichever merges second needs a trivial rebase.Validation
staticpassedruff checkon changed Python;npm run typecheck:control-plane;git diff --check.unitpassedunitpassedintegrationpassedcontrol-plane-integrated-canary-smoke.py: File and SQLite passed.canarypassedloopx canary premerge --from-git-diff --git-diff-base origin/main: direct checks (diff, bilingual, compile, module ceilings), catalog canaries, risk-profile smokes and public-boundary scan passed; 0 manual holds.unitfailed (pre-existing)tests/test_projection_envelope.py::test_real_cli_quota_should_run_discloses_unreadable_scheduler_statefails identically on untouchedorigin/main(867615e): quota decision capture now requires--turn-instance-idor--begin-turn.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
none.Signed-off-bytrailer (git commit -s).Merge requires explicit maintainer authorization (control-plane read surfaces and public redaction under
loopx/**).