fix(todos): scope Monitor completion replay by cycle - #4916
Conversation
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
87a7580 to
3a6af7b
Compare
|
在 exact head
这不是旧周期未重开时的合法恢复;新周期已经通过另一具名请求完成。请把 legacy fallback 绑定到它所属的周期/可验证的完成 lineage,或在无法证明时停止恢复旧 receipt;补上 File/SQLite 的“旧 legacy → 新周期显式完成 → v3 隐式重试”负例。现有测试只覆盖旧周期刚完成时的恢复,以及新周期继续由 v3 完成的路径,因此没有击中这个交叉路径。 |
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
|
已在
已补 File 和 SQLite 同一反例: 验证结果:聚焦 File/SQLite reviewer + lifecycle 用例 |
huangruiteng
left a comment
There was a problem hiding this comment.
动机
评审精确 head 3ac56718f7b4e32f2e3d42216b422f76028bf7cd。原有未指定 completion identity 的 continuous_monitor 总用 Goal/Todo 对应的永久 operation ID;Monitor 在新 material-change generation 重开后,再次完成可能重放上一周期的 receipt,返回成功但 canonical Todo 仍为 open。维护者给出的更强反例是:旧周期 legacy 完成,新周期由显式 operation 完成,再执行 v3 隐式重试。
改动思路
Python 仅为未指定 identity 的连续 Monitor 发送 v3/null operation 请求;显式 identity 和非 Monitor 仍走 v2。TypeScript terminal authority 读取 canonical material_change_generation 后推导周期 operation ID,只重放同周期 receipt;没有可证明 lineage 时不猜测旧 legacy receipt。若当前周期已由显式 operation 完成,v3 写入该周期的 no_change receipt,再次重试只重放它。v2 携带原 operation ID 的历史恢复保留。
具体改动
provider_terminal_lifecycle.py 选择版本与 nullable identity;local_authority_runtime.ts 拒绝 v3 非 null ID、supersede 和带 completion turn key 的请求;todo_terminal_lifecycle.ts 以 typed union、generation 校验、两次权威读和现有 receipt/commit 边界完成周期绑定。中英文 canonical-terminal 文档说明兼容与回滚边界;File/SQLite conformance 覆盖旧 legacy、跨周期重开、显式完成后 v3 的 no_change、race 与非 Monitor 拒绝;Python facade 覆盖真实 complete_goal_todo 和 canonical readback。
对主干的风险
新增一个 wire 版本和约 691 行净增量,主要在聚焦测试,核心语义仍留在既有 TypeScript terminal owner,没有第二个 Python 决策源。周期编号取自 canonical Todo,不依赖显示投影;v2 的具名 receipt 仍可按原 ID 恢复。当前 head 上 8 个 File/SQLite 相关实存储测试、10 个 Python facade 测试、12 个 runtime 请求测试、TypeScript typecheck 与 diff 检查通过。本评审未独立运行 PostgreSQL 服务或轮询远端 CI;这不是主干合并许可,maintainer 仍需按合并门槛确认。
我的整体评价
APPROVE(代码评审)。 上轮指出的“旧 legacy → 新周期显式完成 → v3 重试”反例得到精确修复,v3 不再把无 generation lineage 的旧 receipt 当作当前周期证明;同周期重试与 v2 历史恢复仍有回归覆盖。相关未来重构可留在 terminal owner 内,当前不需要扩出新抽象。
English verdict: APPROVE - exact head 3ac5671 scopes implicit Monitor receipts to canonical generations and no longer infers legacy lineage; focused File/SQLite, Python and request tests plus typecheck passed. Merge qualification remains separate.
|
Exact-head readiness update for Please update the branch against |
…request-4916 Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
…tent Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Problem and result
An unkeyed
continuous_monitorcompletion reused one permanent Goal/Todo operation id. After the Monitor reopened, a new completion could replay an earlier success while leaving the current Todo open. The TypeScript terminal authority now derives that operation id from the authoritativematerial_change_generation, so retries within one cycle replay and later cycles complete independently.Implementation
operation_identityis a discriminated union:{kind: "explicit", operation_id: "..."}or{kind: "current_monitor_cycle"}. The latter is valid only for unkeyed Monitor completion.no_changereceipt.The protocol simplification removes a net 40 production lines relative to the earlier PR implementation. No provider defaults, storage formats, promotion or permissions change. No frontend configuration or UI change is required: CLI and Chat still use the same public completion actions; the changed envelope is internal to the packaged adapter/runtime.
Validation
3ac56718ffor complete/supersede were recovered unchanged by the new implementation on both File and SQLite, without changing the authority head.automatic-execution-admission-v0.mdlacks the checker-requiredsemantic mirrortext. Confirmed the same failure condition inorigin/main; this PR does not modify that RFC.Fresh CI and maintainer review apply to the updated head. This PR is not merged.