Skip to content

refactor(todos): read completion evidence in one TypeScript todo.read transaction - #7894

Merged
loopx-agent merged 1 commit into
mainfrom
codex/completion-evidence-read-20261102
Nov 3, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/completion-evidence-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 decisions to the typed owner, with no parallel Python decision owner.
  • Goal/source and gap: turn run-once decided durable completion evidence in Python (durable_completion.py projection and terminal composition, plus completion_fence.py), while TypeScript already owned the completion fence and the canonical Todo read. Canonical recovery took two cross-runtime calls: a separate todo.completion_fence.evaluate call and a read.
  • Observable before → after: Python completion-evidence decisions and the separate fence call → one existing todo.read transaction with a new completion_evidence kind. TypeScript collects the canonical source pages, selects the exact Todo, applies the fence, validates continuation and recovery and successor existence, and returns the complete result. All 83 frozen observations are byte-identical. Canonical recovery drops from two crossings to one.
  • 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/control_plane/test_completion_evidence_read.py, tests/fixtures/control_plane/completion_evidence_read.json (83 complete JSON observations, exact error types and messages, field absence, successor ordering, crossing counts) 118 passed on unchanged code; fixture bytes never edited after capture
Reuse the existing read owner, no new handler implemented read_projection.ts projectCompletionEvidence; read_transaction.ts readCompletionEvidence with the shared collectCanonicalTodoSource extracted TS completion_evidence_read.test.ts replays all 83 observations
Canonical refusal never falls back to Markdown implemented the canonical path has no Markdown or event-projection fallback; the explicit legacy path reads Markdown only refusal and malformed-result cases, File and SQLite
Remove the Python decision owner implemented deleted completion_fence.py, _project_durable_completion, Python terminal composition, the separate fence call in turn_run_once.py, the unused todo.completion_fence.evaluate registration and the two persisted-record reader APIs rg finds no remaining consumer
One canonical-result decoder implemented the existing validation in local_authority.py is moved unchanged into validate_canonical_todo_read and reused existing canonical snapshot tests
RFC text matches the code implemented the shared-goal authority RFC (EN and zh-CN) now names read_durable_completion_evidence and the TS read path check_rfc_bilingual.py
Ledger entry in both languages implemented ledger/typescript-control-plane-migration-v0/2026-11-02-completion-evidence-read{,.zh-CN}.md, linked from both migration RFC files check_rfc_bilingual.py
  • Self-check before submission: Read the full diff. Python now only resolves paths and the registry, reads the explicit legacy Markdown format, encodes requests and keeps exception compatibility. Canonical identity and the continuation and recovery rules are in TypeScript.

Migration economics receipt

Field Result
Canonical owner loopx/control_plane/todos/read_projection.ts and read_transaction.ts (existing todo.read owner)
Legacy code deleted 78-line completion_fence.py; Python projection reducer (95 lines) and terminal composition (40 lines); separate CLI fence call
Bridge code added 145 lines of Python request shaping and compatibility wrappers in durable_completion.py
Cross-runtime calls canonical ordinary recovery 2 → 1; canonical terminal recovery 2 → 1; intent 1 → 1; post-completion 1 → 1; explicit legacy materialized read 0 → 1 (Python no longer decides this path)
Product net change +311 / −448 (net −137)
Same-basename Python/TS twins 45 → 44 (completion_fence.py removed; the TS owner stays)
Facade exit Delete the Python facade when turn run-once is native and no Python caller needs the legacy format reader. The completion_evidence read can then become an in-process call (recorded in the ledger).

The matched SQLite transaction and full-CLI recovery measurements improve
materially; no long-horizon effectiveness/efficiency benefit is claimed.

Scope And Continuation

  • Completed scope and remaining work: Complete for completion intent, post-completion outcome, ordinary recovery and terminal recovery in turn run-once.
  • Deliberately not included: making turn run-once native.
  • Merge coordination: rebased onto the current main; the final handler tree also honors the merged field_update/public_update retirements.

Validation

  • Tested revision: 258d6e3
  • 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 Completion-evidence characterization, durable completion projection, long-history reads and the Turn driver: 277 passed after rebasing onto current main.
unit passed TS completion-evidence read, Todo read, completion fence, handler dispatch and loading: 142 passed.
integration passed Matched SQLite full-CLI recovery used the real turn run-once --resume-turn-key --execute path; 64 replay samples per revision all committed.
install passed Wheel and sdist were installed into separate fresh Python 3.12 environments. Each imported only from site-packages and passed completion evidence, canonical refusal and real canonical recovery probes.
performance passed Matched SQLite base 867615e2c → head: complete transaction p95 103.729 → 14.320 ms; full-CLI recovery p95 611.397 → 334.687 ms; cold-start p50/p95 115.522/128.518 → 102.829/135.269 ms; idle/burst process-tree RSS 30/30 → 32/33 MiB.
canary passed Standard premerge passed with 19 selected checks and 0 failures/manual holds. One known inherited advisory failure (control-plane-maintainability-ratchet-smoke.py) did not name changed files; the module-ceiling colocation check passed.
  • Coverage and gaps: The PostgreSQL store is not changed or used by this completion read; no PostgreSQL-specific claim is made.

Frontend / Visual Evidence

  • UI impact: none. turn run-once 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 and the shared-goal authority state provider RFC (durable completion read point). Completion evidence is a Todo decision, so it belongs with the TypeScript Todo read owner.

Shared-authority RFC fixture impact

  • Production-scale fixture schema / semantic dimensions / conformance arms / three-arm rehearsal: no persisted format or authority store change. The RFC read-point paragraph is updated to name the current adapter and TS read path; the fail-closed contract is unchanged.

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 (Todo completion rules 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:15:05.317684Z 3d3ec09 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.

@mergify

mergify Bot commented Nov 2, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @hhyykk.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 2, 2026

@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 | model=gpt-6.1-sol | provider=OpenAI | reasoning_effort=max | source=runtime_reported

动机 / Motivation

在完成写入后恢复同一个 Turn、需要准确续接既有任务的用户。此前恢复先读取持久任务,再单独询问完成栅栏;续接规则仍在 Python 解释。本次把完整证据读取放进既有 TypeScript 事务,普通与终态恢复由两次跨运行时调用变为一次。已验证的变化是完成续接、拒绝诊断与恢复幂等性保持一致,并减少恢复路径的调用边界。本次不改变写权限、存储格式或调度默认值,也不宣称延迟和长程收益已经改善。真实安装包的语义验证与完整性能测量仍缺失;源码功能测试不能替代这两项迁移资格。

改动思路 / Approach

复用 todo.read、canonical snapshot 和 completion fence,把 provider IO 与完整续接不变量放在现有 TypeScript owner;Python 仅保留显式 legacy 格式读取与异常兼容。本 PR 的边界是完成证据读取事务的实际切换;功能迁移可以独立回滚,但必须补齐该事务的安装与成本资格,不能靠不声称收益来免除。读源与完成判断仍是必要步骤,减少的是跨运行时传输,不是取消检查。正向恢复先读 canonical 全量来源,再检查原 Turn 的完成栅栏和持久续接;来源不可用、缺少 continuation 或后继不存在时均停止。Python 保留路径、显式 legacy 格式和异常适配,未获得第二份领域决策权。

现有调用路径 base 跨运行时次数 head 次数
普通 / 终态恢复 2 1
intent / 完成后读取 1 1
显式 legacy 投影 0 1

此表描述源码与当前 crossings 测试支持的结构变化,不是延迟测量。

具体改动 / Changes

本次按迁移前规范 docs/architecture/rfcs/typescript-control-plane-migration-v0.md,固定 revision 867615e2c3aa2a32516a71d46f11a20d6fcb3289 判断;PR 自己新增的 ledger 是待验证的实现说明。七个生产文件完成 owner 迁移和共享 decoder 提取,六个双语 RFC/ledger 文件同步职责,测试中保留完整结果语料及真实恢复。

关键代码讲解

  • read_durable_completion_evidence:根据 runtime/Goal 选择 canonical 事务;仅显式 legacy 路径读取 Markdown,原 Turn CLI 的四种完成回调都进入这里。
  • readCompletionEvidence:复用完整 canonical 分页收集,选出目标 Todo 与完整后继 id 集,再交给同一投影 owner;缺失目标不会构造完成结果。
  • projectCompletionEvidence:保留 fence 优先级,再验证 done、显式 continuation、no_followup/recovery 与后继存在性。删除缺失后继拒绝分支的临时突变被独立断言检出。
  • validate_canonical_todo_read:把原 canonical decoder 原样抽出复用,保留来源不可用和协议拒绝的异常类型,不增加 provider 读取。

CE-OWNER:implemented。完整 owner 合并与窄 facade 有实际调用方;

CE-PARITY:implemented。83 个完整观察在固定 base/head 完全一致,六个共同 File/SQLite 恢复用例均通过;

CE-INSTALL:not_met。尚无 wheel 与 sdist 新环境安装后的深层语义运行;

CE-COST:not_met。尚无规范要求的全路径延迟及 daemon 内存测量;

对主干的风险 / Risks

本轮独立执行 317 个 Python、117 个 TypeScript 用例及类型检查,均为 PASS;同一外置恢复测试在固定 base 上六项 PASS,head 的对应六项包含在聚焦套件中。悬空后继会在 writeback 阶段拒绝且不花费 quota;临时绕过 native membership 检查后独立断言失败,说明覆盖不只复述合法结果。

[P2] CE-INSTALL:补齐安装包语义资格。 迁移前 §6 Correctness 明确要求 wheel 和 sdist 在新环境执行深层语义探针。这次已经替换生产路径,尚不能把该行列为范围外。请在当前 head 构建并分别隔离安装两个产物,验证 packaged completion evidence、canonical 拒绝及真实恢复,记录版本与结果;无需安装或更换正在使用的 Host。

[P2] CE-COST:补齐完整成本资格。 §6 Performance 对每个 transaction cutover 要求 cold/warm、完整事务、完整 CLI 的 p50/p95 与 idle/burst RSS,默认 SQLite 为交付资格,File 单独披露。调用次数减少不能判断尾延迟,尤其 legacy 从零次增至一次。请给出固定 base/head、同 fixture 与条件的上述测量;超出既有阈值仍交原 owner 审核,不放宽限制。无性能收益声明也不能取消这个门。

标准 premerge 本轮为 FAIL:一个未修改的接口预算 smoke 超限。相同原始隔离环境在 base/head 均为 20,605 /20,500,独立直接运行两者均为 20,277;因此不归为本 PR 回归,也没有重标绿色。其余直接检查、双语 RFC、选中的 canary 和公开边界检查通过。历史并发超时保持历史失败,不据此声称稳定性已修复。

语义与 CI 对齐

completion_evidence 扩展既有 Todo read vocabulary,没有新增状态 owner、权限或可选策略。canonical 拒绝和完成栅栏是强制不变量;两项迁移资格也是既有要求,不能称作建议。当前 wait_for_ci=false,未抓取、轮询或等待 CI;必要证据缺失来自本次事务资格,与未知 CI 无关。

我的整体评价 / Verdict

本轮 exact-scope change-quality receipt 为 FAIL,保留必要资格缺失、skipped required 验证和接口预算失败,没有放宽 strict receipt 门。

这是有真实恢复调用方、可独立回滚的 justified_increment;代码删减与 owner 归属合适。当前 REQUEST_CHANGES 针对 CE-INSTALL、CE-COST 的必要迁移证据,不否认已验证的功能一致性。Long-horizon 为 not_yet_proven:未测后续任务成果或净成本;user_experience 在现有 CLI 范围为 preserved。已检查 turn run-once 的 CLI 和持久恢复调用链,本次没有页面、布局或交互控件改动。打包与已安装 Host 未验证,不把源码 CLI 结果称为安装环境已采用。 请补齐两项 exact-head 验收后复审;当前接口预算红项另保留 merge hold。

English verdict: REQUEST_CHANGES — head 3d3ec09d609d22322d4a71c849cd98c67e4691c1; functional parity and recovery pass, but required packaged semantic and full-cost cutover qualification remain missing.

@loopx-agent
loopx-agent force-pushed the codex/completion-evidence-read-20261102 branch from 3d3ec09 to 3753508 Compare November 3, 2026 03:56
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 3, 2026

@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: 3753508f9c440a68291983556197451b818ce119

动机 / Motivation

已经完成写入、需要恢复同一 Turn 的用户,此前要先读取 canonical Todo,再单独调用 completion fence;续接和恢复规则仍有一部分由 Python 组合。这个 PR 让普通恢复和终态恢复通过一次既有 todo.read 事务取得完整 completion evidence,使 Python 只保留需求整形、legacy 格式读取和异常适配。已完成的 83 个结果观察、canonical 拒绝和真实恢复保持一致,减少一个跨运行时调用边界。

改动思路 / Approach

canonical provider IO 继续由现有读取事务完成;TypeScript 在进程内选目标 Todo、读取完整后继集合、执行 fence 并验证 continuation/recovery,然后构造结果。Python 的显式 legacy 路径仍只读取 Markdown,canonical 拒绝不会回退到陈旧展示。当前 head 已重放到最新 main,并兼容 main 已退役的 field_update、public_update 和 standing_decision handler;最终只移除 completion_fence 独立入口。

具体改动 / Changes

关键代码讲解

  • readCompletionEvidence 复用完整 canonical 分页收集器,选出目标 Todo 与完整 ID 集合后交给同一投影 owner;普通 Todo 投影仍保留 main 新增的 include_archived 语义。
  • projectCompletionEvidence 保持 fence 优先级,再验证 done、显式 continuation、no-followup/recovery 和后继存在性,不构造缺失证据。
  • read_durable_completion_evidence 把 canonical 请求送入一次 todo.read;只有显式无 runtime 的 legacy 调用才读取 Markdown。
  • validate_canonical_todo_read 复用既有 canonical decoder,保留 unavailable/refusal 异常类型。

CE-INSTALL 与 CE-COST

  • CE-INSTALL:wheel 和 sdist 分别安装到全新的 Python 3.12 环境;两者均只从 site-packages 导入,并通过 completion evidence、canonical refusal 与真实 canonical recovery 三项深语义探针。
  • CE-COST:默认 SQLite 使用固定 base 867615e2c 与当前 head、相同合成 fixture。完整 transaction p95 从 103.729 ms 降至 14.320 ms,完整 CLI recovery p95 从 611.397 ms 降至 334.687 ms。冷启动 p50/p95 为 115.522/128.518 → 102.829/135.269 ms;p95 增加 6.747 ms(5.25%),但中位数下降且低于 25 ms 加性余量。idle/burst 进程树 RSS 从 30/30 MiB 变为 32/33 MiB。

其他验证

  • 当前 Python completion、durable projection、long-history 与 Turn driver 选择:277/277。
  • 当前 TS completion evidence、Todo read、completion fence、handler dispatch/loading:142/142。
  • ruff、TypeScript 类型检查、双语 RFC 与 diff 检查通过。
  • 标准 canary 通过,19 项选择、0 failure、0 manual hold;一个不是由本 diff 文件触发的 maintainability ratchet 已知 advisory 保留为 advisory,模块 ceiling 直接检查通过。

对主干的风险 / Risks

没有发现新的阻断性功能问题。最强风险是 canonical 拒绝被 legacy 路径掩盖,或 completion 读取遗漏动态分派调用方;当前路径禁止 canonical fallback,全仓旧 handler 只剩退役说明,组合读取负例与真实恢复均通过。冷启动尾延迟有 6.747 ms 的加性波动,但已低于既有 25 ms 余量且中位数改善;完整 transaction 和操作者 CLI 在同条件 SQLite 基线上明显改善。GitHub CI 在新 head 上仍在重新执行,与本地和安装包证据分开记录。

我的整体评价 / Verdict

APPROVE。当前精确 head 完成了 completion-evidence 单事务所有权迁移,补齐了原评审要求的安装与性能资格,并保持 canonical fail-closed 和既有输出语义。GitHub 必需检查仍需在新 head 完成,合并前继续执行精确 head readiness 检查。

English verdict: APPROVE — exact head 3753508f9c440a68291983556197451b818ce119 consolidates durable completion evidence into one typed todo.read transaction. Packaged wheel/sdist probes pass, matched SQLite transaction and full-CLI recovery improve materially, and no new blocking semantic finding remains.

@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: 3753508f9c440a68291983556197451b818ce119

动机 / Motivation

已经完成写入、需要恢复同一 Turn 的用户,此前要先读取 canonical Todo,再单独调用 completion fence;续接和恢复规则仍有一部分由 Python 组合。这个 PR 让普通恢复和终态恢复通过一次既有 todo.read 事务取得完整 completion evidence,使 Python 只保留需求整形、legacy 格式读取和异常适配。已完成的 83 个结果观察、canonical 拒绝和真实恢复保持一致,减少一个跨运行时调用边界。

改动思路 / Approach

canonical provider IO 继续由现有读取事务完成;TypeScript 在进程内选目标 Todo、读取完整后继集合、执行 fence 并验证 continuation/recovery,然后构造结果。Python 的显式 legacy 路径仍只读取 Markdown,canonical 拒绝不会回退到陈旧展示。当前 head 已重放到最新 main,并兼容 main 已退役的 field_update、public_update 和 standing_decision handler;最终只移除 completion_fence 独立入口。

具体改动 / Changes

关键代码讲解

  • readCompletionEvidence 复用完整 canonical 分页收集器,选出目标 Todo 与完整 ID 集合后交给同一投影 owner;普通 Todo 投影仍保留 main 新增的 include_archived 语义。
  • projectCompletionEvidence 保持 fence 优先级,再验证 done、显式 continuation、no-followup/recovery 和后继存在性,不构造缺失证据。
  • read_durable_completion_evidence 把 canonical 请求送入一次 todo.read;只有显式无 runtime 的 legacy 调用才读取 Markdown。
  • validate_canonical_todo_read 复用既有 canonical decoder,保留 unavailable/refusal 异常类型。

CE-INSTALL 与 CE-COST

  • CE-INSTALL:wheel 和 sdist 分别安装到全新的 Python 3.12 环境;两者均只从 site-packages 导入,并通过 completion evidence、canonical refusal 与真实 canonical recovery 三项深语义探针。
  • CE-COST:默认 SQLite 使用固定 base 867615e2c 与当前 head、相同合成 fixture。完整 transaction p95 从 103.729 ms 降至 14.320 ms,完整 CLI recovery p95 从 611.397 ms 降至 334.687 ms。冷启动 p50/p95 为 115.522/128.518 → 102.829/135.269 ms;p95 增加 6.747 ms(5.25%),但中位数下降且低于 25 ms 加性余量。idle/burst 进程树 RSS 从 30/30 MiB 变为 32/33 MiB。

其他验证

  • 当前 Python completion、durable projection、long-history 与 Turn driver 选择:277/277。
  • 当前 TS completion evidence、Todo read、completion fence、handler dispatch/loading:142/142。
  • ruff、TypeScript 类型检查、双语 RFC 与 diff 检查通过。
  • 标准 canary 通过,19 项选择、0 failure、0 manual hold;一个不是由本 diff 文件触发的 maintainability ratchet 已知 advisory 保留为 advisory,模块 ceiling 直接检查通过。

对主干的风险 / Risks

没有发现新的阻断性功能问题。最强风险是 canonical 拒绝被 legacy 路径掩盖,或 completion 读取遗漏动态分派调用方;当前路径禁止 canonical fallback,全仓旧 handler 只剩退役说明,组合读取负例与真实恢复均通过。冷启动尾延迟有 6.747 ms 的加性波动,但已低于既有 25 ms 余量且中位数改善;完整 transaction 和操作者 CLI 在同条件 SQLite 基线上明显改善。GitHub CI 在新 head 上仍在重新执行,与本地和安装包证据分开记录。

我的整体评价 / Verdict

APPROVE。当前精确 head 完成了 completion-evidence 单事务所有权迁移,补齐了原评审要求的安装与性能资格,并保持 canonical fail-closed 和既有输出语义。GitHub 必需检查仍需在新 head 完成,合并前继续执行精确 head readiness 检查。

English verdict: APPROVE — exact head 3753508f9c440a68291983556197451b818ce119 consolidates durable completion evidence into one typed todo.read transaction. Packaged wheel/sdist probes pass, matched SQLite transaction and full-CLI recovery improve materially, and no new blocking semantic finding remains.

… transaction

Durable completion read-back now goes through the existing todo.read
transport with a completion_evidence kind. TypeScript collects the
canonical provider snapshot, selects the Todo and projects the typed
completion outcome; the Python adapter only shapes the request and
validates the canonical read envelope it already validated.

The separate completion-fence RPC, its Python decision module and the
standalone fence call in turn run-once are removed. Frozen fixtures stay
byte-identical; canonical recovery crossings drop from two 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>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/completion-evidence-read-20261102 branch from 3753508 to 258d6e3 Compare November 3, 2026 04:04

@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: 258d6e3

动机 / Motivation

已经完成写入、需要恢复同一 Turn 的用户,此前要先读取 canonical Todo,再单独调用 completion fence;续接和恢复规则仍有一部分由 Python 组合。这个 PR 让普通恢复和终态恢复通过一次既有 todo.read 事务取得完整 completion evidence,使 Python 只保留需求整形、legacy 格式读取和异常适配。已完成的 83 个结果观察、canonical 拒绝和真实恢复保持一致,减少一个跨运行时调用边界。

改动思路 / Approach

canonical provider IO 继续由现有读取事务完成;TypeScript 在进程内选目标 Todo、读取完整后继集合、执行 fence 并验证 continuation/recovery,然后构造结果。Python 的显式 legacy 路径仍只读取 Markdown,canonical 拒绝不会回退到陈旧展示。当前 head 已再次重放到最新 main;相对上一精确 head,本 PR 受影响文件内容未变化,并兼容 main 已退役的 field_update、public_update 和 standing_decision handler;最终只移除 completion_fence 独立入口。

具体改动 / Changes

关键代码讲解

  • readCompletionEvidence 复用完整 canonical 分页收集器,选出目标 Todo 与完整 ID 集合后交给同一投影 owner;普通 Todo 投影仍保留 main 新增的 include_archived 语义。
  • projectCompletionEvidence 保持 fence 优先级,再验证 done、显式 continuation、no-followup/recovery 和后继存在性,不构造缺失证据。
  • read_durable_completion_evidence 把 canonical 请求送入一次 todo.read;只有显式无 runtime 的 legacy 调用才读取 Markdown。
  • validate_canonical_todo_read 复用既有 canonical decoder,保留 unavailable/refusal 异常类型。

CE-INSTALL 与 CE-COST

  • CE-INSTALL:wheel 和 sdist 分别安装到全新的 Python 3.12 环境;两者均只从 site-packages 导入,并通过 completion evidence、canonical refusal 与真实 canonical recovery 三项深语义探针。
  • CE-COST:默认 SQLite 使用固定 base 867615e2c 与当前 head、相同合成 fixture。完整 transaction p95 从 103.729 ms 降至 14.320 ms,完整 CLI recovery p95 从 611.397 ms 降至 334.687 ms。冷启动 p50/p95 为 115.522/128.518 → 102.829/135.269 ms;p95 增加 6.747 ms(5.25%),但中位数下降且低于 25 ms 加性余量。idle/burst 进程树 RSS 从 30/30 MiB 变为 32/33 MiB。

其他验证

  • 当前 Python completion、durable projection、long-history 与 Turn driver 选择:277/277。
  • 当前 TS completion evidence、Todo read、completion fence、handler dispatch/loading:142/142。
  • ruff、TypeScript 类型检查、双语 RFC 与 diff 检查通过。
  • 标准 canary 通过,19 项选择、0 failure、0 manual hold;一个不是由本 diff 文件触发的 maintainability ratchet 已知 advisory 保留为 advisory,模块 ceiling 直接检查通过。

对主干的风险 / Risks

没有发现新的阻断性功能问题。最强风险是 canonical 拒绝被 legacy 路径掩盖,或 completion 读取遗漏动态分派调用方;当前路径禁止 canonical fallback,全仓旧 handler 只剩退役说明,组合读取负例与真实恢复均通过。冷启动尾延迟有 6.747 ms 的加性波动,但已低于既有 25 ms 余量且中位数改善;完整 transaction 和操作者 CLI 在同条件 SQLite 基线上明显改善。GitHub CI 在新 head 上仍在重新执行,与本地和安装包证据分开记录。

我的整体评价 / Verdict

APPROVE。当前精确 head 完成了 completion-evidence 单事务所有权迁移,补齐了原评审要求的安装与性能资格,并保持 canonical fail-closed 和既有输出语义。GitHub 必需检查仍需在新 head 完成,合并前继续执行精确 head readiness 检查。

English verdict: APPROVE — exact head 258d6e3 consolidates durable completion evidence into one typed todo.read transaction after a clean rebase onto the latest main. Packaged wheel/sdist probes pass, matched SQLite transaction and full-CLI recovery improve materially, and no new blocking semantic finding remains.

@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: 258d6e3

动机 / Motivation

已经完成写入、需要恢复同一 Turn 的用户,此前要先读取 canonical Todo,再单独调用 completion fence;续接和恢复规则仍有一部分由 Python 组合。这个 PR 让普通恢复和终态恢复通过一次既有 todo.read 事务取得完整 completion evidence,使 Python 只保留需求整形、legacy 格式读取和异常适配。已完成的 83 个结果观察、canonical 拒绝和真实恢复保持一致,减少一个跨运行时调用边界。

改动思路 / Approach

canonical provider IO 继续由现有读取事务完成;TypeScript 在进程内选目标 Todo、读取完整后继集合、执行 fence 并验证 continuation/recovery,然后构造结果。Python 的显式 legacy 路径仍只读取 Markdown,canonical 拒绝不会回退到陈旧展示。当前 head 已再次重放到最新 main;相对上一精确 head,本 PR 受影响文件内容未变化,并兼容 main 已退役的 field_update、public_update 和 standing_decision handler;最终只移除 completion_fence 独立入口。

具体改动 / Changes

关键代码讲解

  • readCompletionEvidence 复用完整 canonical 分页收集器,选出目标 Todo 与完整 ID 集合后交给同一投影 owner;普通 Todo 投影仍保留 main 新增的 include_archived 语义。
  • projectCompletionEvidence 保持 fence 优先级,再验证 done、显式 continuation、no-followup/recovery 和后继存在性,不构造缺失证据。
  • read_durable_completion_evidence 把 canonical 请求送入一次 todo.read;只有显式无 runtime 的 legacy 调用才读取 Markdown。
  • validate_canonical_todo_read 复用既有 canonical decoder,保留 unavailable/refusal 异常类型。

CE-INSTALL 与 CE-COST

  • CE-INSTALL:wheel 和 sdist 分别安装到全新的 Python 3.12 环境;两者均只从 site-packages 导入,并通过 completion evidence、canonical refusal 与真实 canonical recovery 三项深语义探针。
  • CE-COST:默认 SQLite 使用固定 base 867615e2c 与当前 head、相同合成 fixture。完整 transaction p95 从 103.729 ms 降至 14.320 ms,完整 CLI recovery p95 从 611.397 ms 降至 334.687 ms。冷启动 p50/p95 为 115.522/128.518 → 102.829/135.269 ms;p95 增加 6.747 ms(5.25%),但中位数下降且低于 25 ms 加性余量。idle/burst 进程树 RSS 从 30/30 MiB 变为 32/33 MiB。

其他验证

  • 当前 Python completion、durable projection、long-history 与 Turn driver 选择:277/277。
  • 当前 TS completion evidence、Todo read、completion fence、handler dispatch/loading:142/142。
  • ruff、TypeScript 类型检查、双语 RFC 与 diff 检查通过。
  • 标准 canary 通过,19 项选择、0 failure、0 manual hold;一个不是由本 diff 文件触发的 maintainability ratchet 已知 advisory 保留为 advisory,模块 ceiling 直接检查通过。

对主干的风险 / Risks

没有发现新的阻断性功能问题。最强风险是 canonical 拒绝被 legacy 路径掩盖,或 completion 读取遗漏动态分派调用方;当前路径禁止 canonical fallback,全仓旧 handler 只剩退役说明,组合读取负例与真实恢复均通过。冷启动尾延迟有 6.747 ms 的加性波动,但已低于既有 25 ms 余量且中位数改善;完整 transaction 和操作者 CLI 在同条件 SQLite 基线上明显改善。GitHub CI 在新 head 上仍在重新执行,与本地和安装包证据分开记录。

我的整体评价 / Verdict

APPROVE。当前精确 head 完成了 completion-evidence 单事务所有权迁移,补齐了原评审要求的安装与性能资格,并保持 canonical fail-closed 和既有输出语义。GitHub 必需检查仍需在新 head 完成,合并前继续执行精确 head readiness 检查。

English verdict: APPROVE — exact head 258d6e3 consolidates durable completion evidence into one typed todo.read transaction after a clean rebase onto the latest main. Packaged wheel/sdist probes pass, matched SQLite transaction and full-CLI recovery improve materially, and no new blocking semantic finding remains.

@loopx-agent
loopx-agent merged commit 0095109 into main Nov 3, 2026
7 of 9 checks passed
@loopx-agent
loopx-agent deleted the codex/completion-evidence-read-20261102 branch November 3, 2026 04: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