Skip to content

fix(todos): centralize snapshot refusals before retiring Python guards - #5820

Merged
huangruiteng merged 3 commits into
mainfrom
codex/typed-todo-snapshot-refusal
Oct 7, 2026
Merged

huangruiteng merged 3 commits into
mainfrom
codex/typed-todo-snapshot-refusal

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Todo lifecycle requests used to reject contradictory active lease snapshots and missing Todos only in the Python bridge. Direct TypeScript requests could therefore take a different path. Move these refusals into the existing typed lifecycle owner and remove the duplicated Python predicate/result builder. Preserve normalized valid behavior, refusal codes and order; malformed native wire inputs remain decode errors.

This bounded C1/T4 retirement keeps Python IO, live snapshot/result/lease adapters, overlap checks, supported File/SQLite writers and backup/rollback readers. New-Goal defaults and migration policy are unchanged. The bilingual existing authority cadence ledger records the retired symbols, retained obligations and remaining acceptance gaps.

Validation at b3c3f6dd1574be843a41e0f167c61193bf14f451 against current main 9602d815f1ddb48b54c267b9b80aab6499b99256:

  • Source: 279 passed, including the 205-case bridge, complete local-authority suite and real File/SQLite isolation/settlement journeys.
  • Direct TypeScript: 21 passed. The same new oracle has two expected failures on the independent current baseline; candidate refusals and legal holder controls pass.
  • Independently built and installed base/head wheels: the same 205 bridge cases and 36 real File/SQLite CLI cases pass on each. Each wheel has its own normal frontend build and verified installed source.
  • Control-plane typecheck, focused mypy/Ruff, semantic advisory, whitespace/DCO and scoped public/private scans pass.

The earlier two fixture failures and failed quality receipt remain historical failures. Their isolated repair was merged in #5821 and adopted from main; the complete suite now passes. This is requalification after adoption, not a waiver. Whole-Goal upgrade/rollback, attached-App adoption, sustained D2/default-release qualification and remaining writer/outbox retirement stay with their existing acceptance. No installed deployment is claimed.

The future-facing pass reuses the existing decoder/result owner and deletes the duplicate private predicates; no new module, optional capability, vocabulary or configuration switch. This runtime/control-plane proposal remains maintainer-merge only.

Current exact-head premerge canary passed: 5 direct checks and 19 selected risk-based checks, zero failures or manual holds. Remote CI was not consulted under the current review policy.

Full TypeScript control-plane suite: 4111 passed, 0 failed, 31 environment-conditioned skips. Changed lifecycle/lease tests executed directly.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…shot-refusal

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent marked this pull request as ready for review October 6, 2026 22:27

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | xhigh

Reviewed exact head: b3c3f6dd1574be843a41e0f167c61193bf14f451; independent main baseline: 9602d815f1ddb48b54c267b9b80aab6499b99256. 本轮重新审查完整六路径 diff,没有沿用旧 head 的批准。

动机

通过 CLI 或原生 Todo 接口执行认领、修改或收尾的调用方,会在损坏的租约快照下收到不同拒绝,维护者还需要同时维护 Python 与 TS 两处判断。

例如租约同时标记 active 与 released、Todo 已完成且 actor 未注册时,Python 基线先报告快照损坏,直接 TS 基线却继续进入 actor 或重放判断;候选统一先返回快照损坏且不提出写入或释放。

已验证候选对非法快照的错误码、顺序和无效果结果一致,合法认领、中立修改及终态流程保持;真实 File/SQLite CLI 与独立基线/候选 wheel 都能完成重试恢复和单次结算。

本批不切换新 Goal 默认值,不删除旧 Goal writer、历史回执或备份恢复,不证明 attached App、D2 长期成本或完整 Python 退役;合并与安装采用分别验收。

这项改动的价值是消除真实入口之间的决策分歧,并让后续维护只改一个领域规则。不能把删除行数、回执数量或一次通过当作完整 Goal 验收;本次判断只关闭已明确的 snapshot 拒绝提案和验证切片。

改动思路

复用现有 TS lifecycle owner 可以同时补齐直接原生调用的拒绝语义并删除 Python 重复判断;保留有真实调用方的 IO 和严格结果适配,避免创建第二套决策或迁移状态。

本 PR 交付四个 Todo verb 的 snapshot 拒绝统一及独立安装态验收;完整 writer/outbox/旧备份恢复、D2 持续成本和发布默认资格继续由既有验收负责。

反对发货的最强理由是:Python 入口本来已经拒绝这些状态,迁移若只删除防线、只跑 Python 测试,就可能没有用户收益且遗漏直接 TS 调用。这里通过独立基线上的直接 native 反例证明缺口,再验证候选和合法 holder 控制;没有增加配置、schema、RPC、能力或第二套状态。仅保留 Python 前置判断不能修复原生入口;另加 wrapper 则会重新制造双 owner。

依据独立接受的 docs/architecture/rfcs/typescript-control-plane-migration-v0.md,版本 9602d815f1ddb48b54c267b9b80aab6499b99256:T0 要求当前基线和调用方矩阵;T4 要求删除前核对真实调用方并保留必要 IO、格式和恢复。本批满足这两个有界条件。T1 完整修改事务、T2 monitor 原子回写、T3 其余结构化消费者属于现有后续验收,不由本批偷换为完成。此次被修改的双语 retirement ledger 是结果记录,不能反过来充当独立 oracle。

具体改动

关键代码讲解

  1. loopx/control_plane/coordination/todo_lifecycle_decision.ts:265 的 decodeRequest 先严格解码既有 wire 字段,再检查 active lease 是否 absent/released,随后判断显式 null Todo。前者返回 invalid_lease_snapshot,后者返回 todo_not_found;它们先于 actor 准入和 done 重放。不完整或格式错误的 wire 仍抛解码错误,不能通过 null 分支把非法输入洗成普通业务拒绝。规则直接使用 canonical snapshot 的既有事实,没有新增手工注解,也没有用有限列表缺席推断数据不存在。
  2. loopx/control_plane/coordination/todo_lifecycle_decision.ts:555 的 evaluateCoordinationTodoTerminalDecision 在 decoder 返回拒绝时直接返回;合法输入继续经过原来的 authority 和 terminalFence。拒绝结果没有 next Todo/lease、authority mode 或 idempotent 标记,避免把损坏快照变成重放成功或租约释放。
  3. loopx/control_plane/coordination/todo_lifecycle_decision.ts:591 的 evaluateCoordinationTodoMutationDecision 复用同一拒绝并使用 mutation result schema。合法 claim/update 的 ownershipGate、holder 判断和中立修改继续走原来的路径,未扩大 actor 权限,也未给中立编辑添加租约要求。
  4. loopx/control_plane/coordination/authority_core.py:215 的 _typescript_todo_decision 继续负责真实 Python 调用方的 snapshot 投影和 native 结果形状验证;:338 的 decide 现在将领域判断交给既有 typed owner。删除的是 _invalid_lease_snapshot、私有 _result 和提前 missing-Todo 决策。锁、CAS、scope overlap、provider writer、终态回执、outbox、旧备份和恢复适配保留;它们的价值不能因语言偏好被删除。

完整 diff 为两处生产路径、两处现有测试和双语 ledger,180 加/40 删,生产代码净减 21 行。没有生成代码或新模块。相关未来重构已在本批落地为“删除重复领域判断、保留实际 IO”;进一步 writer/历史格式删除继续按实际调用族验收,无需新框架或并行 Todo。

当前源码的 bridge/local-authority/真实 File–SQLite 合并验证为 279 通过,直接 TS/lease 测试 21 通过。完整 npm run test:control-plane 为 4111 通过、0 失败、31 个 PostgreSQL 实际服务条件 skip(未配置隔离服务 URL);changed Todo lifecycle/lease 直接测试全部执行。独立 main 与候选均从各自源码正常构建 wheel、经过各自 frontend build 和完整性 hooks,再安装到隔离环境;同一 bridge 矩阵各 205 通过,真实 CLI writer 隔离、原操作恢复、provider 不可用拒绝和 quota→refresh→spend 各 36 通过。测试包路径仅适配到已安装包,行为断言未改。基线原生反例运行当前独立 oracle,得到 2 个预期失败及 15 个合法控制通过;候选通过,证明测试能区分这项缺陷。

语义与 CI 对齐

本次复用既有 request/result schema、拒绝码和 TS owner,没有新增词汇或领域专用错误。非法直接 native 输入的拒绝变化已在 PR 与 ledger 披露;合法归一化 Python、三种 handoff mode 和实际 File/SQLite 流程保持。没有 optional/default-off 声明、自动加载 prompt 或 reward-memory 指令变更;一致性规则是强制约束,不称为 guidance。

按当前 capability 契约,GitHub CI 为 not_consulted、wait_for_ci=false,未查询或等待远程 CI。当前 exact-head premerge 执行 5 项直接检查和 19 项风险选择检查,全部通过且没有 manual hold;control-plane typecheck、mypy、Ruff、diff advisory、完整 semantic smoke、DCO 和 public/private scan 也通过。没有缩小 scan、删除断言、调整预算或借新标签抹掉旧失败。

对主干的风险

最值得防范的是 wire 解码与领域拒绝顺序混淆、合法 inactive holder 被过度拒绝,或 done 重放误盖快照损坏。因此矩阵交叉四个 verb、三种 mode、null/done Todo、未知 actor、absent/released active lease,同时保留 active/expired/released/无 holder 的合法中立修改控制。整个流程仍由既有 provider 在锁和 CAS 内施加效果,决策函数不自行写状态。原操作 retry/restart 和单次结算经真实隔离安装态验证,不靠返回码或 mocked store 代替。

旧 broader 验证的两项 local-authority mock 失败和失败质量回执保留。独立合并的 #5821 补齐真实 fixture repo/state 并复用现有 writer-fence 判定;本 head 已采用该 main,279 项包含原两项,保留 private validator/no Markdown/no fallback 断言。首次 canary preview 因尚无当前质量回执拒绝执行;新的精确 scope PASS 回执与最终 canary 是补齐前置证据,未豁免失败。

剩余最强证据边界是 attached App 的实际采用、其他 Host 和 D2 长期资源成本,本批没有改 UI、store 或默认策略,也未声称这些已完成。安装态使用合成 disposable File/SQLite;未向活跃 Goal 注入故障。没有 PostgreSQL 存储修改或该平台资格声明。代码包回退不需要状态转换;历史格式/回执/备份 reader 保留。完整退役及新 Goal 默认 SQLite 仍需对应现有验收。

我的整体评价

本 exact head 没有 blocking finding。该切片把一个已存在的安全不变量放回实际共享 owner,修复直接入口差异并删掉重复知识,具有独立、可逆的交付价值。长期运行上保持实际 durable result、重试恢复和一次结算;用户路径不增加配置、确认或重复录入,直接 native 失败更一致。完整 writer/default cutover 不属于这项批准。

这是 author-owned 的 COMMENTED 自评记录,GitHub raw reviewDecision 不能因此被写成 APPROVED。运行时控制面 PR 仍由维护者合并;本次评审与验证不授予自合并或本机安装采用权限。

English verdict: APPROVE - The exact-head change consolidates normalized snapshot refusals in the existing typed lifecycle owner, preserves legal Python and real File/SQLite journeys, and removes duplicate Python decisions without retiring live IO or recovery contracts. The bounded proposal is qualified; maintainer merge and broader default/retirement acceptance remain separate.

@huangruiteng
huangruiteng merged commit d399043 into main Oct 7, 2026
23 of 35 checks passed
@huangruiteng
huangruiteng deleted the codex/typed-todo-snapshot-refusal branch October 7, 2026 03:55
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.

2 participants