Repository navigation
Recover the original Monitor when cadence-only creation is retried - #8719
Conversation
Keep the clock-derived first due time out of the create request identity. Derive it at the canonical writer after checking for the original receipt. Preserve the result on retries and continue to reject changes to the authored schedule. Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
评审提交 13e2d7113dbc8bb5f223e06e3abf29523acad901;对照目标基线 78e936f9d1f1a00505c4026ee0a5857de95cee27。
动机 / Motivation
用 CLI 配置周期 Monitor、可能需要在创建响应丢失后重试的用户。 提交只包含 cadence 的创建请求,首次写入成功但响应丢失;经过一段时间后按同一 operation ID 重试。 目标基线在生成请求指纹前重新算到期时间,因此同一请求会误报身份冲突;已写入的 Monitor 并未消失。 错误的身份冲突容易诱导操作者换 ID 再创建,增加重复 Monitor 与人工核对。 候选先查原操作回执,首次生成的到期时间和 Todo 精确保留。明确改动到期时间或换创建意图仍拒绝。 使用实际本地 CLI/File/SQLite 和可控时钟。旧版生成的 cadence 回执仍需用 todo receipt 恢复;PostgreSQL、运行中安装和托管 CI 未验证。
改动思路 / Approach
Todo 写入事务拥有请求指纹和原回执,现有调度规则拥有 cadence 的计算,Python 继续运输调用者输入。 把时钟派生值移到查回执之后,只作为首次创建的结果。显式给出的时间仍是请求身份的一部分。 匹配历史回执就读回原结果;首次创建才计算时间,并用原 provider 提交边界写入。
具体改动 / Changes
关键代码讲解
add_goal_todo 与 plan_todo_creation_scope 继续校验同一份作者输入,不再预填时间。 executeCoordinationTodoCreate 对归一化的原输入算指纹并读回执,然后才用 planMonitorSchedule 推导缺省的首次到期时间;显式时间由原输入和持久事务保留。新测试经真实 File/SQLite CLI,核对时钟前移、操作冲突和原回执;文档给出已从旧版写入后的恢复方式。6 个文件,+62/-11。回执身份 计划首次时间 既有调度计算 真实 CLI 回归
基线 docs/project-agent-todo-contract.md 的现有约束:first-due-is-a-result 已验证;explicit-input-and-no-effects 已验证;restore-legacy-receipt 已验证。基线验收依据
对主干的风险 / Risks
给真实 CLI 一个带时区偏移的首次时钟,下一进程使用更晚的 UTC 时间。File 和 SQLite 的基线都对 cadence-only 重试报冲突;候选返回原 Todo 和到期时间,canonical revision 不变。明确时间和普通 Todo 的同输入重放在两个版本一致;修改时间或文本都能拒绝。旧版已提交的 cadence-only 请求,新程序仍拒绝重发,但按文档的 todo receipt 能查到精确原记录;不要为了绕开冲突排出第二个 Monitor。
语义与 CI 对齐
137 项原生 Monitor、Todo 创建与恢复相关测试和 Standard 的 19 项选中检查通过。六组配对对照覆盖两种 provider 下的三种创建意图。 使用实际本地 CLI/File/SQLite 和可控时钟。旧版生成的 cadence 回执仍需用 todo receipt 恢复;PostgreSQL、运行中安装和托管 CI 未验证。
我的整体评价 / Verdict
批准当前提交。现在可放心用同一操作 ID 恢复新版的 cadence 创建。旧记录沿原回执读回,明确改过时间的请求仍会冲突。 合并与正式运行采用仍须按仓库权限和发布流程另行核对。
English verdict: APPROVE at 13e2d71. The same cadence-only operation replays its original Monitor and due time without a second write; explicit changes still conflict, and older results remain available through receipt readback.
When a caller omitted the initial due time, Monitor creation computed it from the current clock. Retrying the same operation after a lost response computed a different value and caused an identity conflict.
Creation now looks up the original operation before deriving the first due time. The replay returns the original Monitor and due time. An explicitly changed due time still conflicts with the original request.
Twelve native Monitor configuration tests and ten quick premerge checks passed. Actual File and SQLite CLI cases covered replay across time, explicit due time changes, and authoritative readback.