Skip to content

fix(todos): retain lifecycle actor through legacy Todo writes - #6378

Merged
huangruiteng merged 9 commits into
mainfrom
codex/games-supervisor-legacy-actor
Oct 14, 2026
Merged

huangruiteng merged 9 commits into
mainfrom
codex/games-supervisor-legacy-actor

Conversation

@huangruiteng

@huangruiteng huangruiteng commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Legacy Markdown Todo completion can lose the lifecycle-admitted actor, causing later recovery of the original execution to reject its source identity. This repair persists that actor while preserving the established distinction between planning maintenance and copy/ownership changes.

The existing TypeScript attribution predicate is shared by canonical materialization and the legacy public plan. Evidence, priority, state planning and explicit planning clears retain the previous actor; changed raw text/note, ownership and monitor observations retain their existing attribution. The Markdown writer applies provenance only after a real material change, inside its existing transaction, so previews and unchanged replays do not mint new effects. Completion/supersede retain the original identity and receipt rules. No new grant, CLI option, schema version or configuration switch is introduced.

Specification: docs/project-agent-todo-contract.md and docs/quota-allocation.md, pinned before this change at af3ed549ee2679ea18d1e1edd733c40dd4c652f8. Repair and validation by a model agent: gpt-6.1-sol / OpenAI, runtime-reported xhigh.

Validation at head 317770ba8f8ad7b2cf8204eca565a6ee5de86d0a:

  • 201 focused Python tests passed. The final test-only explicit-clear refinement reran all 9 actor CLI cases successfully; product and other test sources are byte-identical to that full run.
  • 1152 TypeScript update and File/SQLite/real PostgreSQL conformance cases passed, with zero failures/skips. PostgreSQL 17.11 ran on an isolated disposable server with synthetic data.
  • The old planning-overwrite defect failed three independent actor assertions on frozen pre-fix source. The fixed real CLI covers planning, mixed raw copy, claim/reassignment, explicit clear, missing reason, unknown/non-owner/excluded actor, preview/replay, historical source recovery and exactly one settlement debit.
  • Full control-plane typecheck, touched Python Ruff, diff/compile checks and semantic advisory followed by the native semantic smoke passed.
  • Standard canary premerge passed its five direct and eighteen selected risk/catalog checks, with no manual holds; the exact-scope change-quality receipt passed.
  • Resolved review policy is wait_for_ci=false; hosted CI was not queried or awaited.

This qualifies mutation provenance and affected source entrypoints. It does not certify credential authentication, installed-host adoption, every stale-wait scenario or completion of the broader legacy-writer retirement. The bounded refactor keeps one TypeScript decision owner and the existing Python storage transport.

Signed-off-by: huangruiteng <huangrt01@163.com>
…mes-supervisor-legacy-actor

Signed-off-by: huangruiteng <huangrt01@163.com>

@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; xhigh

动机

需要在中断后继续原任务的 Agent 与维护者。 旧 Markdown Todo 在完成时丢失规则认可的操作者身份,后续同一次执行的结算可能被拒绝;本提案补回身份,但规划字段更新也会覆盖它。

真实 CLI 的完成、原身份恢复与一次扣额已经通过;额外证实只修改 evidence 的规划操作会把原 owner 的身份覆盖为 peer。 这是旧 Markdown 写入路径修复,不证明身份凭据认证、实际宿主采用、所有 provider 的运行资格或长期净收益。

改动思路

在原 writer 事务内传递既有 TS 生命周期规则认可的 actor;完成和 supersede 可以共用序列化帮助函数,规划字段必须保留原 actor。 本 PR 应交付旧 writer 的完成身份修复,并保持原规划与文案修正的归属区别;当前更新路径仍须修复后重验。

完成路径的改法有效,但把所有 update 都视为 actor 变化扩大了修复范围。规划更新与 raw text/note 修正已有区别,应复用原 typed intent,而不是在适配器另设统一覆盖规则。

具体改动

审查 head:b313e3d0803e9fbb48ca75f2aacb8d1e22b7bda2。固定规格:docs/project-agent-todo-contract.md,变更前版本 af3ed549ee2679ea18d1e1edd733c40dd4c652f8。

Ordinary lifecycle mutations:Ordinary lifecycle mutations follow todo ownership; cross-owner action needs an explicit grant and reason. → implemented;Receipt-backed settlement progress:Recover the exact original identity and missing receipts; Todo completion is distinct from Turn accounting. → implemented;A planning-only update:A planning-only update preserves the existing last_actor_agent_id; combined raw text/note retains copy-edit attribution. → not_met。 另按同版本 docs/quota-allocation.md 的 Receipt-backed settlement progress 验证一次结算;规划保留条款及 todo_update_intent.ts 的原 owner 是独立依据。

关键代码讲解

完整5文件 +174/-3:metadata codec6行、writer6/-3、共享帮助函数26行及136行测试。update/complete/supersede 在原锁内、授权后写 provenance;没有更改 TS 资格、claim、lease、完成 key 或扣额规则。旧路径与 canonical provider 仍共用现有语义 owner;当前规划归属不一致需收敛。

对主干的风险

119项聚焦测试、Ruff、advisory 后 native semantic/canary 5直接/18选择检查通过。相同实际 CLI 测试在固定 base 因缺少 actor 失败,在 head 通过普通完成、历史来源恢复、原 key/time、正确拒绝及一次扣额;另外实际 update/claim/complete/supersede 验证了合法委派 actor 与 claim owner 不同、缺 reason/被排除拒绝、dry-run 和 replay 字节不变。

[P2] 规划字段更新覆盖原生命周期 actor(阻塞本提案)。 legacy_mutation.py:911 对每次 changed update 调用新帮助函数;后者直接把 accepted actor 写入 last_actor_agent_id。隔离真实 CLI 中先由 owner 修正文案,再由有 update grant 的 peer 仅执行 todo update --evidence ... --authority-reason ...,独立 todo list 读回 actor 从 owner 变成 peer。固定规格明确 planning-only 应保留既有 actor,canonical todo_update_intent.ts 也保留它;这里把证据维护者记成生命周期执行者,会污染后续身份来源。

最小修复:让规划意图复用既有 preserve 规则;raw text/note、claim 与 terminal 继续按现有归属写 actor。加 ordinary CLI 回归:纯 planning 保留、混合文案修正按原规则变化、规划 clear、完成/同身份恢复仍成功。当前测试只证明 terminal 修复,未覆盖这一区别。5个身份反例部分通过 typed consumer 注入,不冒充全部 CLI 场景;没有 PG/实际宿主全链路资格或 CI 观察。

我的整体评价

REQUEST_CHANGES。完成 actor 修复有实际价值,但当前整份提案仍改变规划归属的既有语义。在原 writer 事务内传递既有 TS 生命周期规则认可的 actor;完成和 supersede 可以共用序列化帮助函数,规划字段必须保留原 actor。 本 PR 应交付旧 writer 的完成身份修复,并保持原规划与文案修正的归属区别;当前更新路径仍须修复后重验。 这是同一边界内的小修复,无需新状态机、额外 capability 或大范围 TS 迁移;修复后重验完整 head,再判断批准。测试通过数不抵消已复现的合法路径回归。

English verdict: REQUEST_CHANGES - head b313e3d; terminal provenance and exact recovery work, but planning-only evidence updates overwrite the existing lifecycle actor contrary to the accepted/canonical contract. Real CLI reproduction blocks approval; preserve planning attribution and add mixed-intent regression coverage.

Comment thread loopx/control_plane/todos/legacy_mutation.py Outdated
loopx-agent and others added 3 commits October 14, 2026 13:13
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…r-legacy-actor

Signed-off-by: huangruiteng <huangrt01@163.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
@huangruiteng huangruiteng changed the title fix(todos): preserve authenticated actor in legacy lifecycle writes fix(todos): retain lifecycle actor through legacy Todo writes Oct 14, 2026
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
… coverage

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

@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; xhigh

动机

需要在中断后继续原任务的 Agent 与维护者。 旧 Markdown Todo 完成后没有留下规则认可的操作者,后续恢复原次执行会遇到身份冲突;维护证据又可能把操作者误改成 peer。

真实 CLI 读回保留正确操作者,纯规划保持原归属,文案与所有权变更按既有规则记账;重试保留原完成身份并只结算一次。 本次修复限于 Todo 归属和旧写入兼容;它不证明凭据认证、安装宿主采用、所有任务的等待修复或整轮控制面迁移完成。

改动思路

归属规则复用现有 TypeScript owner,Python 只负责 Markdown 事务写回;actor 本身不构成变化,不新增并行权限或结算决策。 本 PR 交付旧 writer 的归属与原次执行恢复修复,同时保持 canonical 规划语义;完整旧 writer 退休仍属于原迁移边界。

入口沿用普通 Todo CLI,先由现有生命周期规则校验 actor、claim、委派理由和 lease,再在持有的 writer 事务中传递归属。规划与文案修改共用原 canonical 判定;优先级生成的显示文本不被误当作 raw text。Python 先计算实际变化,再写 actor,因此归属字段本身不会制造新的操作。canonical 的 audit-only 不变规则保持原样,存储 IO 与权限、规划政策和结算 owner 分工清楚。仅增加 codec 无法处理规划区别,另写 Python 判定则会制造重复 owner;当前整合是同一兼容边界内的有用修复。

具体改动

审查 head:317770ba8f8ad7b2cf8204eca565a6ee5de86d0a。固定规格:docs/project-agent-todo-contract.md,变更前版本 af3ed549ee2679ea18d1e1edd733c40dd4c652f8;同版本 docs/quota-allocation.md 的收据结算说明作为补充。

  • Ordinary lifecycle mutations:沿用 owner 和明确委派、理由规则 → implemented;普通 CLI 的未知 actor、缺理由、非 owner/excluded 及 lease 负例仍拒绝且没有写入。
  • A planning-only update:纯规划保留原 actor、混合 raw text/note 沿用文案归属 → implemented;证据、优先级、显式 clear、同文案规划、混合修正和 canonical 状态规划均已覆盖。
  • Receipt-backed settlement progress:原次执行依靠对应收据恢复,Todo 完成与扣额分开 → implemented;普通与历史缺 actor 的原身份恢复保留 key/time,反例拒绝,重复收尾仅扣一次。

关键代码讲解

  • shouldRecordTodoMutationActor:抽取原 TypeScript materializer 的 raw-copy/clear/ownership/observation 判定,供两条活跃写入路径共用;metadata 规划字段不构成 actor 变化。
  • record_todo_mutation_actor:只对真实 changed 且 accepted actor 存在的结果写回现有 metadata;不变重放不会更新时间或归属,目标异常消失会在持有事务内失败。
  • apply_todo_update_to_lines:把原 note 传入 typed plan,并先移出 actor 再计算 material change,最后调用传输 helper;complete/supersede 也在原授权和锁内使用该 helper。
  • prepareUpdatedTodo:复用同一 predicate,保留原 CAS、lease 和 audit-only 抑制机制;actor 与更新时间不会让不变操作变成新提交。

完整 8 文件 +337/-9:生产 +67/-9,测试 +270。metadata codec 与签名支持已经存在的 last_actor_agent_id;5 个生产文件、CLI 恢复测试、metadata roundtrip 和 typed planner 测试都已检查。没有新增模块、协议版本、独立权限 owner 或用户配置入口。

对主干的风险

同一真实 CLI 序列在固定 main 和当前产品源码比较了合法修改、缺理由、未知 actor、dry-run、重放及独立 list 读回;完整拒绝文本相同且 state 无副作用。main 丢失 actor 是本次明确修复的差异;旧评审 head 的无条件 planning stamp 又在冻结源码上触发 3 个独立 actor 断言失败,当前回归通过。误借当前 editable source 的早期对照已排除,没有用它证明旧缺陷。

本次 201 项 Python 验证、1152 项 TypeScript/File/SQLite/真实 PostgreSQL 验证通过,0 失败、0 skipped。PostgreSQL 为隔离真实 17.11 服务,采用一次性合成数据。最后仅将两个测试 argv 换成显式 --clear-priority,9 项 actor CLI 测试再验通过;产品和其他测试与上述验证 revision 完全相同,复用证据已检查失效条件。Typecheck、touched Ruff、advisory 后 semantic smoke、5 个直接与18个风险/catalog检查及当前 scope 的 change-quality receipt 通过;没有 manual hold。按已解析 wait_for_ci=false 未查询或等待 hosted CI。

语义与 CI 对齐

复用既有 actor vocabulary、ownership field 集合和 TypeScript owner,未新增状态分类或 Python 决策源,未改预算以掩盖失败。canonical 状态规划不会被新 stamp 捕获;新错误使用通用 Todo 术语,归属不会授予凭据认证、额外委派或执行权。既有 admission/receipt fence 仍是机器强制规则。没有 first-screen、安装指令或 default-off 能力变化。历史元数据恢复和完整 legacy 退休仍有自己的边界,本 PR 的通过不替代这些更大验收。

我的整体评价

APPROVE。long_horizon 改善的是原身份恢复和反复收尾不重复扣额;user_experience 改善的是相同普通 CLI 操作留下正确可读归属,不增加手填状态或确认步骤。归属规则复用现有 TypeScript owner,Python 只负责 Markdown 事务写回;actor 本身不构成变化,不新增并行权限或结算决策。 本 PR 交付旧 writer 的归属与原次执行恢复修复,同时保持 canonical 规划语义;完整旧 writer 退休仍属于原迁移边界。

整体机制与已复现缺陷相称,保留有实际 persisted caller 的 Markdown codec,并完成同边界的未来维护整理:共享原 predicate、删除无条件 stamp、合并重复测试链。旧 blocker 已在当前代码和真实回归中解决;所有 applicable evidence 已完成。安装宿主采用及长期运行收益没有被测试,继续保留为范围限制。批准记录、旧 review closeout、exact-head merge readiness 和维护者明确合并授权仍分别核对,bypass 不替代任一项。

English verdict: APPROVE - head 317770b; shared canonical attribution preserves planning actors and no-change replay while legacy terminal recovery retains the accepted original source. Real CLI, 201 Python, 1152 TypeScript/real-store cases, final 9 actor tests and risk-based validation pass; no credential-authentication or installed-host adoption claim.

@huangruiteng huangruiteng 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.

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

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

动机

需要在中断后继续原任务的 Agent 与维护者。 旧 Markdown Todo 完成后没有留下规则认可的操作者,后续恢复原次执行会遇到身份冲突;维护证据又可能把操作者误改成 peer。

真实 CLI 读回保留正确操作者,纯规划保持原归属,文案与所有权变更按既有规则记账;重试保留原完成身份并只结算一次。 本次修复限于 Todo 归属和旧写入兼容;它不证明凭据认证、安装宿主采用、所有任务的等待修复或整轮控制面迁移完成。

改动思路

归属规则复用现有 TypeScript owner,Python 只负责 Markdown 事务写回;actor 本身不构成变化,不新增并行权限或结算决策。 本 PR 交付旧 writer 的归属与原次执行恢复修复,同时保持 canonical 规划语义;完整旧 writer 退休仍属于原迁移边界。

入口沿用普通 Todo CLI,先由现有生命周期规则校验 actor、claim、委派理由和 lease,再在持有的 writer 事务中传递归属。规划与文案修改共用原 canonical 判定;优先级生成的显示文本不被误当作 raw text。Python 先计算实际变化,再写 actor,因此归属字段本身不会制造新的操作。canonical 的 audit-only 不变规则保持原样,存储 IO 与权限、规划政策和结算 owner 分工清楚。仅增加 codec 无法处理规划区别,另写 Python 判定则会制造重复 owner;当前整合是同一兼容边界内的有用修复。

具体改动

审查 head:317770ba8f8ad7b2cf8204eca565a6ee5de86d0a。固定规格:docs/project-agent-todo-contract.md,变更前版本 af3ed549ee2679ea18d1e1edd733c40dd4c652f8;同版本 docs/quota-allocation.md 的收据结算说明作为补充。

  • Ordinary lifecycle mutations:沿用 owner 和明确委派、理由规则 → implemented;普通 CLI 的未知 actor、缺理由、非 owner/excluded 及 lease 负例仍拒绝且没有写入。
  • A planning-only update:纯规划保留原 actor、混合 raw text/note 沿用文案归属 → implemented;证据、优先级、显式 clear、同文案规划、混合修正和 canonical 状态规划均已覆盖。
  • Receipt-backed settlement progress:原次执行依靠对应收据恢复,Todo 完成与扣额分开 → implemented;普通与历史缺 actor 的原身份恢复保留 key/time,反例拒绝,重复收尾仅扣一次。

关键代码讲解

  • shouldRecordTodoMutationActor:抽取原 TypeScript materializer 的 raw-copy/clear/ownership/observation 判定,供两条活跃写入路径共用;metadata 规划字段不构成 actor 变化。
  • record_todo_mutation_actor:只对真实 changed 且 accepted actor 存在的结果写回现有 metadata;不变重放不会更新时间或归属,目标异常消失会在持有事务内失败。
  • apply_todo_update_to_lines:把原 note 传入 typed plan,并先移出 actor 再计算 material change,最后调用传输 helper;complete/supersede 也在原授权和锁内使用该 helper。
  • prepareUpdatedTodo:复用同一 predicate,保留原 CAS、lease 和 audit-only 抑制机制;actor 与更新时间不会让不变操作变成新提交。

完整 8 文件 +337/-9:生产 +67/-9,测试 +270。metadata codec 与签名支持已经存在的 last_actor_agent_id;5 个生产文件、CLI 恢复测试、metadata roundtrip 和 typed planner 测试都已检查。没有新增模块、协议版本、独立权限 owner 或用户配置入口。

对主干的风险

同一真实 CLI 序列在固定 main 和当前产品源码比较了合法修改、缺理由、未知 actor、dry-run、重放及独立 list 读回;完整拒绝文本相同且 state 无副作用。main 丢失 actor 是本次明确修复的差异;旧评审 head 的无条件 planning stamp 又在冻结源码上触发 3 个独立 actor 断言失败,当前回归通过。误借当前 editable source 的早期对照已排除,没有用它证明旧缺陷。

本次 201 项 Python 验证、1152 项 TypeScript/File/SQLite/真实 PostgreSQL 验证通过,0 失败、0 skipped。PostgreSQL 为隔离真实 17.11 服务,采用一次性合成数据。最后仅将两个测试 argv 换成显式 --clear-priority,9 项 actor CLI 测试再验通过;产品和其他测试与上述验证 revision 完全相同,复用证据已检查失效条件。Typecheck、touched Ruff、advisory 后 semantic smoke、5 个直接与18个风险/catalog检查及当前 scope 的 change-quality receipt 通过;没有 manual hold。按已解析 wait_for_ci=false 未查询或等待 hosted CI。

语义与 CI 对齐

复用既有 actor vocabulary、ownership field 集合和 TypeScript owner,未新增状态分类或 Python 决策源,未改预算以掩盖失败。canonical 状态规划不会被新 stamp 捕获;新错误使用通用 Todo 术语,归属不会授予凭据认证、额外委派或执行权。既有 admission/receipt fence 仍是机器强制规则。没有 first-screen、安装指令或 default-off 能力变化。历史元数据恢复和完整 legacy 退休仍有自己的边界,本 PR 的通过不替代这些更大验收。

我的整体评价

APPROVE。long_horizon 改善的是原身份恢复和反复收尾不重复扣额;user_experience 改善的是相同普通 CLI 操作留下正确可读归属,不增加手填状态或确认步骤。归属规则复用现有 TypeScript owner,Python 只负责 Markdown 事务写回;actor 本身不构成变化,不新增并行权限或结算决策。 本 PR 交付旧 writer 的归属与原次执行恢复修复,同时保持 canonical 规划语义;完整旧 writer 退休仍属于原迁移边界。

整体机制与已复现缺陷相称,保留有实际 persisted caller 的 Markdown codec,并完成同边界的未来维护整理:共享原 predicate、删除无条件 stamp、合并重复测试链。旧 blocker 已在当前代码和真实回归中解决;所有 applicable evidence 已完成。安装宿主采用及长期运行收益没有被测试,继续保留为范围限制。批准记录、旧 review closeout、exact-head merge readiness 和维护者明确合并授权仍分别核对,bypass 不替代任一项。

English verdict: APPROVE - head 317770b; shared canonical attribution preserves planning actors and no-change replay while legacy terminal recovery retains the accepted original source. Real CLI, 201 Python, 1152 TypeScript/real-store cases, final 9 actor tests and risk-based validation pass; no credential-authentication or installed-host adoption claim.

@huangruiteng
huangruiteng merged commit 19c725e into main Oct 14, 2026
24 of 25 checks passed
@huangruiteng
huangruiteng deleted the codex/games-supervisor-legacy-actor branch October 14, 2026 05:51
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