Repository navigation
refactor(todos): retire Python summary display rules #7411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8d284ae
refactor(todos): retire Python summary display rules
hhyykk e629c11
fix(todos): keep the registered scoped-decision receipt version in su…
hhyykk 377c167
docs(todos): record summary qualification and preserve failed cohorts
huangruiteng 11bd498
docs(todos): retain qualification lineage across the main rebase
huangruiteng a8c1690
Merge current main into PR 7411 and reconcile qualification checkpoints
loopx-agent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
...script-control-plane-migration-v0/2026-10-26-todo-summary-display-projection.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Todo summary-display projection retirement (2026-10-26) | ||
|
|
||
| | Boundary | Delivered evidence | | ||
| | --- | --- | | ||
| | Goal/source | Existing TypeScript migration T3/T4 transaction payoff; baseline `c6462f902`. One read-only summary-display slice, with no new capability, RPC operation, provider or runtime. | | ||
| | Observable gap | Python still selected summary/planning sources, normalized display declarations and assembled handoff displays before asking the typed quota owner to select lanes. | | ||
| | Single owner | `todos/context_projection.ts` now owns standalone summary compaction, source order/deduplication, ready-successor overlays and terminal-inclusive frontier preservation through the existing `todo.context.page`. `todos/read_codec.ts` reuses `handoffSource`; quota planning composes the display in process before lane decisions. Both complete planning decisions remain independent. | | ||
| | Retired symbols/callers | Python `_compact_todo_summary_item_record`, `_refs`, `_TEXT_FIELDS` and `handoff_context_source` are deleted. The bodies of `compact_todo_summary_items`, `todo_summary_source_items` and `todo_planning_source_items` become transport facades. `todo_index.py` sends raw record facts for both handoff stages. Existing `todo_summary.py` compact/open callers reach the same raw-fact adapter through `attach_todo_handoff_notes`; they require no new decision branch. `quota_selection.py` removes its display-source join and sends raw display facts. | | ||
| | Retained Python placement | `summary_item.py` retains public import signatures, source-key compatibility exports, empty/bounded transport, response validation and `todo_text_content_revision`. `handoff_note.py` retains generic JSON conversion with Python string/repr facts for tuples, sets, floats and other non-JSON scalars, batching/private snapshots, rejection propagation and mutable-row attachment identity. Existing handoff-gate source IO/compatibility remains. No Python decision fallback or per-field RPC is added. | | ||
| | Facade deletion condition | Delete the summary/handoff transport facades and their raw-fact request carriers after the last Python display, index, quota, management and planning callers consume the existing typed owners in process. Delete `todo_text_content_revision` only after its last compatibility caller exits. This does not retire the other context-page callers, delegation facts, Turn recovery or monitor-poll facades. | | ||
| | Formats/rollback | No persisted format, authority, CAS, writer fence, lease, receipt, provider selection or default changes. Rollback is a code-only revert; no data migration. | | ||
|
|
||
| ## Cost and real-path evidence | ||
|
|
||
| Production source: `summary_item.py` 329 → 100 lines, `handoff_note.py` 150 → | ||
| 112 lines; Python −273 net, TypeScript +157 net, production −116 net. The seven | ||
| production files total 242 added / 358 deleted lines. The related refactoring | ||
| pass reuses the existing handoff/read codecs rather than introducing another | ||
| owner or RPC leaf. Larger caller retirement is deferred to the existing exits. | ||
|
|
||
| One real-CLI trace per command and fixture size (N=1/N=3) gives: | ||
|
|
||
| | Command | Crossings base → candidate | Stdout bytes N=1 | Stdout bytes N=3 | | ||
| | --- | --- | --- | --- | | ||
| | `agent-context --phase before_plan` | 1 → 1 | 1885 → 1885 | 2247 → 2247 | | ||
| | `agent-context --phase after_delegate_result` | 3 → 3 | 1612 → 1612 | 1612 → 1612 | | ||
| | Same result phase with a Turn identity | 3 → 3 | 2594 → 2594 | 2594 → 2594 | | ||
| | `quota should-run` | 75 → 74 | 25520 → 25520 | 25904 → 25904 | | ||
|
|
||
| The estimated 73-crossing target is **not met**: the first (empty user) planning | ||
| call has no display rows and therefore no preceding display RPC to remove. | ||
| Only the nonempty Agent planning display crossing is retired. Do not remove a | ||
| second planning decision or absorb an unrelated caller to manufacture the | ||
| estimate. Fewer crossings do not certify latency improvement; the matched | ||
| 25-run performance comparison remains external qualification. | ||
|
|
||
| The pre-cutover synthetic quota Todo rows and their Python display results are | ||
| pinned in `tests/control_plane_ts/fixtures/todo_summary_display.json`. An external isolated-runtime replay with Python/Node wall clocks pinned matches | ||
| all eight complete CLI outputs byte for byte, including `context_id`, against | ||
| the base Python owners. Independent TS cases cover nested-field precedence, | ||
| legacy identity, Unicode and credential | ||
| exclusion before truncation, bounded/public-safe blocked causes, open-advancement | ||
| hint visibility, normalized declarations, last-outcome precedence, ordered source | ||
| deduplication, explicit false readiness and terminal frontier fields. Python | ||
| retains real File/SQLite CLI recovery, mutation-identity, large/oversize transport | ||
| and fail-closed adapter tests, including tuple/set/float facts. | ||
|
|
||
| Focused validation: 89 TS tests pass; typecheck, changed-Python ruff, configured | ||
| mypy (17 files), diff whitespace and the semantic advisory pass. The requested | ||
| Python set reports 467 passed and one temporary-path depth skip, with four | ||
| existing legacy-path failures (three quota legacy-provider | ||
| cases and `test_absent_fence_preserves_legacy_path_without_starting_typescript`), | ||
| reproduced with the base Python owners in the same environment. These remain | ||
| failures, not passing skips. The configured mypy list does not cover the changed | ||
| Python modules. Real installed-wheel qualification, the minimum Node lane and | ||
| isolated PostgreSQL CI are unverified here; no PostgreSQL code is changed. This | ||
| source checkpoint does not certify full CI, installed delivery or a latency gain. | ||
|
|
||
| Review correction: summary display now preserves the canonical `decision_scope_outcomes[*].schema_version` as `todo_decision_scope_outcome_v0` by reusing the completion writer’s shared constant, replacing the unregistered `decision_scope_outcome_v0`; TS regression and File/SQLite `quota should-run` coverage were added. | ||
52 changes: 52 additions & 0 deletions
52
...-control-plane-migration-v0/2026-10-26-todo-summary-display-projection.zh-CN.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Todo 摘要展示投影退役(2026-10-26) | ||
|
|
||
| | 边界 | 交付证据 | | ||
| | --- | --- | | ||
| | 目标/来源 | 既有 TypeScript 迁移 T3/T4 事务收益;基线 `c6462f902`。仅一个只读摘要展示切片,不新增 capability、RPC 操作、provider 或 runtime。 | | ||
| | 可观察缺口 | Python 仍在选择摘要/规划来源、规范化展示声明,并在请求 typed quota owner 选择 lane 前组装 handoff 展示。 | | ||
| | 唯一 owner | `todos/context_projection.ts` 通过既有 `todo.context.page` 统一负责独立摘要压缩、来源顺序/去重、后继就绪覆盖以及含终态的 frontier 字段保留。`todos/read_codec.ts` 复用 `handoffSource`;quota planning 在进程内先组合展示再决定 lane。两次完整规划决策保持独立。 | | ||
| | 删除的符号/调用方 | 删除 Python `_compact_todo_summary_item_record`、`_refs`、`_TEXT_FIELDS`、`handoff_context_source`。`compact_todo_summary_items`、`todo_summary_source_items`、`todo_planning_source_items` 的实现缩为传输 facade。`todo_index.py` 的两个 handoff 阶段改传原始记录事实。`todo_summary.py` 既有 compact/open 调用经 `attach_todo_handoff_notes` 使用同一原始事实适配器,无需新增决策分支。`quota_selection.py` 删除展示来源 join,改传原始展示事实。 | | ||
| | 保留 Python 的放置依据 | `summary_item.py` 保留公开导入签名、来源 key 兼容导出、空批次/有界传输、响应校验及 `todo_text_content_revision`。`handoff_note.py` 保留通用 JSON 转换,为 tuple、set、float 及其他非 JSON 标量提供 Python string/repr 事实,并保留分批/私有快照、拒绝传播及可变行 attachment identity。既有 handoff-gate 来源 IO/兼容适配保留。不新增 Python 决策回退或逐字段 RPC。 | | ||
| | Facade 删除条件 | 最后一个 Python 展示、索引、quota、管理及规划调用方改为在进程内消费既有 typed owner 后,删除摘要/handoff 传输 facade 及原始事实请求载体。`todo_text_content_revision` 仅在最后一个兼容调用方退出后删除。本切片不退役其他 context-page 调用方、委派事实、Turn recovery 或 monitor-poll facade。 | | ||
| | 格式/回滚 | 不改变持久化格式、authority、CAS、writer fence、lease、receipt、provider 选择或默认行为。仅回退代码即可,无需数据迁移。 | | ||
|
|
||
| ## 成本与真实路径证据 | ||
|
|
||
| 生产源码:`summary_item.py` 从 329 降至 100 行,`handoff_note.py` 从 150 | ||
| 降至 112 行;Python 净减 273 行,TypeScript 净增 157 行,生产代码净减 | ||
| 116 行。七个生产文件共增加 242/删除 358 行。相关重构复用既有 handoff/read | ||
| codec,不新增 owner 或 RPC leaf。更大范围调用方退役沿用既有退出条件。 | ||
|
|
||
| 对每条命令、每个夹具规模(N=1/N=3)各执行一次真实 CLI 跟踪,结果如下: | ||
|
|
||
| | 命令 | 跨运行时调用:基线 → 候选 | Stdout 字节 N=1 | Stdout 字节 N=3 | | ||
| | --- | --- | --- | --- | | ||
| | `agent-context --phase before_plan` | 1 → 1 | 1885 → 1885 | 2247 → 2247 | | ||
| | `agent-context --phase after_delegate_result` | 3 → 3 | 1612 → 1612 | 1612 → 1612 | | ||
| | 同一 result 阶段,带 Turn identity | 3 → 3 | 2594 → 2594 | 2594 → 2594 | | ||
| | `quota should-run` | 75 → 74 | 25520 → 25520 | 25904 → 25904 | | ||
|
|
||
| 预估的 73 次目标**尚未达到**:首次规划针对空 User 来源,没有展示行,因此原本 | ||
| 就不存在可删除的前置展示 RPC。仅退役非空 Agent 规划的展示调用。不得通过删除 | ||
| 第二次规划决策或合并无关调用方来凑足预估。调用减少不证明延迟改善;同条件 | ||
| 25 次性能对照仍由外部独立验收。 | ||
|
|
||
| 退役前的合成 quota Todo 行及其 Python 展示结果固定在 | ||
| `tests/control_plane_ts/fixtures/todo_summary_display.json`。在外部隔离 runtime 中固定 Python/Node 墙钟后,八条完整 CLI 输出与重放基线 | ||
| Python owner 的输出逐字节一致(包括 `context_id`)。独立 TS 用例覆盖 | ||
| 嵌套字段优先级、旧 identity、Unicode 与截断前凭据排除、有界且公开安全的阻塞 | ||
| 原因、仅 open advancement 可见的 hint、声明规范化、同 scope 最后 outcome 优先、 | ||
| 有序来源去重、显式 false readiness 以及终态 frontier 字段。Python 保留真实 | ||
| File/SQLite CLI 恢复、可变行 identity、大/超大传输及 fail-closed 适配测试, | ||
| 包括 tuple/set/float 事实。 | ||
|
|
||
| 聚焦验证:89 个 TS 测试通过;typecheck、变更 Python 的 ruff、配置内 mypy | ||
| (17 个文件)、diff 空白检查和语义 advisory 通过。要求的 Python 集合为 467 个通过、1 个临时路径深度限制的 skip,并存在四个 | ||
| 既有 legacy 路径失败(三个 quota legacy-provider 用例,以及 | ||
| `test_absent_fence_preserves_legacy_path_without_starting_typescript`),在相同 | ||
| 环境加载基线 Python owner 后复现。它们仍是失败,不计为通过的 skip。mypy | ||
| 配置文件列表不覆盖本次修改的 Python 模块。真实 installed-wheel、最低 Node | ||
| 版本及隔离 PostgreSQL CI 尚未验证;未修改 PostgreSQL 代码。本源码检查点不 | ||
| 认证完整 CI、已安装交付或延迟收益。 | ||
|
|
||
| 审查修正:摘要展示复用 completion writer 的共享常量,将 `decision_scope_outcomes[*].schema_version` 保持为 canonical 记录中的 `todo_decision_scope_outcome_v0`,替换未注册的 `decision_scope_outcome_v0`;新增 TS 回归测试及 File/SQLite `quota should-run` 覆盖。 |
73 changes: 73 additions & 0 deletions
73
.../typescript-control-plane-migration-v0/2026-10-27-todo-summary-qualification.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Todo summary-display follow-up qualification (2026-10-27) | ||
|
|
||
| This entry supplements the [original retirement record](2026-10-26-todo-summary-display-projection.md). | ||
| The production boundary remains summary display through `todo.context.page` and | ||
| in-process quota planning; both complete planning decisions remain necessary. | ||
| There is no new provider, format, permission or RPC owner. | ||
|
|
||
| ## Preserve the earlier evidence | ||
|
|
||
| The independent review of head `c242ca5f439c269c313329c883299a28d95a55dc` | ||
| against `be1dc37a008be7017b64b622f653b6707df5c544` found: | ||
|
|
||
| - the registered `todo_decision_scope_outcome_v0` correction passed canonical | ||
| File/SQLite source and installed wheel/sdist checks; | ||
| - one SQLite CLI fixture used 83 → 82 requests, including 22 → 21 | ||
| `todo.context.page` calls. Its workload differs from the original N1/N3 | ||
| 75 → 74 trace; neither trace permits removing another planning decision; | ||
| - a fixed 32-pair CLI cohort had base/head p50/p95 336.97/521.98 and | ||
| 345.96/836.79 ms, a 60.31% candidate p95 increase; | ||
| - the predeclared 64-pair rerun had 301.56/400.98 and 305.88/391.08 ms. | ||
| This later result does not erase the earlier failed cohort. The difference | ||
| did not establish a repeatable regression or explain the earlier tail; | ||
| - cold startup, warm typed requests and idle/burst daemon RSS were still missing. | ||
| Python thread profiling did not measure Node CPU or establish tail causality. | ||
|
|
||
| These historical cohorts keep their original status. They are not relabelled | ||
| as passes, and the default SQLite limits remain unchanged. | ||
|
|
||
| ## Rebase and real recovery | ||
|
|
||
| The follow-up baseline is `ff8d9932294e9004b9ffeb2fb473d00354397eb8`. | ||
| Six File/SQLite recovery test cases initially stopped on | ||
| `canonical_authority_required`, before their intended assertions. The fixture | ||
| now initializes the real provider from authored source facts **before** calling | ||
| the production CLI; it does not restore a legacy read fallback. All eight | ||
| receipt/next-action cases pass, including version preservation, rejection of | ||
| wrong Todo step updates, legitimate original-Turn settlement and replay. | ||
| The earlier six failures remain recorded as fixture failures, not proof of | ||
| previously passing recovery behavior. | ||
|
|
||
| ## Final-head measurement contract | ||
|
|
||
| [PR #7411](https://github.com/loopx-project/loopx/pull/7411) records the immutable | ||
| final head, execution commands, fixture fingerprint, environment and results. | ||
| Its bounded offline qualification uses the same synthetic canonical SQLite | ||
| Todo and interpreter on both source revisions, with no active Goal mutation: | ||
|
|
||
| - 24 managed-process cold-start pairs, distinguishing warm filesystem/compile | ||
| cache from a fresh process; | ||
| - 64 complete `quota should-run` CLI pairs with alternating AB/BA order, all | ||
| samples retained and nearest-rank p50/p95; | ||
| - 256 warm typed requests and 256 complete quota-planning projections per | ||
| revision, separating transport from the Python facade; | ||
| - idle, sampled burst and post-burst daemon RSS over 2,000 bounded projections; | ||
| - real CLI identity/result assertions, focused TS/Python coverage and packaged | ||
| readback, reported separately from timing. | ||
|
|
||
| Do not overlap owned heavy builds/tests with timed cohorts. Keep private raw | ||
| captures outside Git and publish only synthetic aggregates. A single synthetic | ||
| workload does not establish sustained large-Goal performance. Any miss retains | ||
| an owner-review hold; a faster microbenchmark cannot waive a full-CLI failure. | ||
|
|
||
| ## Rebase onto the subsequently merged main | ||
|
|
||
| The final integration base advances to | ||
| `17b2a0f9b818dc6e6fe77ccc567b20ff91b3bc40`. Main now includes #7459's | ||
| canonical fixture repair and changes to the real quota/context path. The | ||
| conflict resolution keeps that shared fixture repair instead of duplicating it; | ||
| this PR retains the File/SQLite receipt-version regression. The earlier | ||
| `ff8d9932294e9004b9ffeb2fb473d00354397eb8` comparison and | ||
| `e7a54b8f32a648124133b02e11404b75a421fdac` head remain historical evidence. | ||
| The final PR reply records fresh exact-head correctness, package and matched | ||
| performance results for the new base. No earlier cohort is rewritten. |
57 changes: 57 additions & 0 deletions
57
...cript-control-plane-migration-v0/2026-10-27-todo-summary-qualification.zh-CN.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Todo 摘要展示后续验收(2026-10-27) | ||
|
|
||
| 本记录补充[原退役记录](2026-10-26-todo-summary-display-projection.zh-CN.md)。生产边界仍是 | ||
| `todo.context.page` 的摘要展示,以及 quota planning 内的直接组合;两个完整规划决策 | ||
| 都仍有必要。不新增 provider、格式、权限或 RPC owner。 | ||
|
|
||
| ## 保留此前证据 | ||
|
|
||
| 独立评审对照 `be1dc37a008be7017b64b622f653b6707df5c544` 与 | ||
| `c242ca5f439c269c313329c883299a28d95a55dc` 得到: | ||
|
|
||
| - 已注册 `todo_decision_scope_outcome_v0` 的修正通过真实 File/SQLite 来源及 | ||
| wheel/sdist 安装验证; | ||
| - 一个 SQLite CLI fixture 请求为 83 → 82,其中 `todo.context.page` 为 22 → 21。 | ||
| 它与原 N1/N3 的 75 → 74 负载不同;两者均不支持删除另一个规划决策; | ||
| - 固定 32 对 CLI 样本的基线/候选 p50/p95 为 336.97/521.98、345.96/836.79 ms, | ||
| 候选 p95 增加 60.31%; | ||
| - 预先声明的 64 对复测为 301.56/400.98、305.88/391.08 ms。后一次结果不能抹掉 | ||
| 前一次失败;不一致尚未证明可重复回归,也没有解释先前尾延迟; | ||
| - 冷启动、温态 typed request、daemon 空闲/突发 RSS 仍缺失。Python 线程 profile | ||
| 没有测得 Node CPU,也未证明尾延迟成因。 | ||
|
|
||
| 上述历史批次保留原结论,不改写成通过,默认 SQLite 限值也不放宽。 | ||
|
|
||
| ## Rebase 与真实恢复 | ||
|
|
||
| 本次后续工作的基线为 `ff8d9932294e9004b9ffeb2fb473d00354397eb8`。六个 File/SQLite | ||
| 恢复用例最初在目标断言前因 `canonical_authority_required` 失败。现在 fixture 先用 | ||
| 已写好的合成来源初始化真实 provider,再调用生产 CLI;没有恢复旧读取 fallback。 | ||
| 八个 receipt/next-action 用例全部通过,覆盖版本保留、错误 Todo 步骤更新拒绝、 | ||
| 原 Turn 合法结算与重放。之前六项保留为 fixture 失败,不声称先前已验证恢复。 | ||
|
|
||
| ## 最终 head 测量契约 | ||
|
|
||
| [PR #7411](https://github.com/loopx-project/loopx/pull/7411) 记录不可变最终 head、执行命令、 | ||
| fixture 指纹、环境与结果。有界离线验收在两个修订上使用相同解释器和合成 canonical | ||
| SQLite Todo,不修改活跃 Goal: | ||
|
|
||
| - 24 对受管进程冷启动,区分已温热的文件系统/编译缓存和新进程; | ||
| - 64 对完整 `quota should-run` CLI,AB/BA 交错、不删样本,按 nearest-rank 算 p50/p95; | ||
| - 每版本 256 次温态 typed request、256 次完整 quota-planning 投影,区分 transport | ||
| 与 Python facade; | ||
| - 2,000 次有界投影的 daemon 空闲、突发采样峰值和突发后 RSS; | ||
| - 真实 CLI 身份/结果断言、聚焦 TS/Python 与安装回读,与耗时分别报告。 | ||
|
|
||
| 计时期间不并行执行本 Agent 的重型构建/测试。原始私有记录留在 Git 外,只发布合成 | ||
| 汇总。单个合成负载不能证明持续大 Goal 性能。任何未达标保留 owner-review hold; | ||
| 微基准更快不能豁免完整 CLI 失败。 | ||
|
|
||
| ## 同步随后合入的主线 | ||
|
|
||
| 最终集成基线更新为 `17b2a0f9b818dc6e6fe77ccc567b20ff91b3bc40`。主线已包含 | ||
| #7459 的 canonical fixture 修复,也改动了真实 quota/context 路径。冲突解决沿用 | ||
| 共同 fixture 修复,不重复补丁;本 PR 保留 File/SQLite 的 receipt-version 回归。 | ||
| 此前 `ff8d9932294e9004b9ffeb2fb473d00354397eb8` 对照和 | ||
| `e7a54b8f32a648124133b02e11404b75a421fdac` head 保留为历史证据。最终 PR 回复 | ||
| 记录新基线与新精确 head 的正确性、安装和匹配性能复测,不改写旧批次。 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.