Repository navigation
fix(replan): match a null admitted completion key to a Todo row without one - #9296
Conversation
…ut one
An autonomous-replan obligation admitted for a completed Todo that has no
completion turn key records the trigger as `completion_turn_key: null`
(goal_frontier builds it with `item.get("completion_turn_key")`). The Todo
row read back for lifecycle reconstruction omits the key, and
`lifecycleObligation` compared the two with `!==`, so `null !== undefined`
rejected the exact admitted lifecycle. A second `quota should-run` for the
same `--turn-instance-id` then failed with `heartbeat_receipt_write_failed`
("lifecycle source does not match the admitted obligation"). Hosts that
revalidate before entering the Turn, such as the DSH Driver's pre-step
recheck, rejected every such Turn.
Compare the key as `?? null` on both sides. This matches the Python
obligation identity, which already drops a None completion key, and it
also repairs receipts already admitted with a null trigger, which an
admission-side change would not. A key present on only one side still
conflicts.
Signed-off-by: xiaobaifly7 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
在进入已准入重规划轮次前复查的宿主,需要核对同一个旧 Todo 和原回执。 旧 Todo 缺少完成轮次键时,准入触发记录 null,随后读取的 Todo 省略键。基线第二次检查因此拒绝已经准入的轮次。 同一条公开 CLI 命令能复查原轮次,并读回相同的 effect 身份和触发序列。真实 File 和 SQLite 结果一致。 只修复重规划来源比较。既有 Todo 状态、凭据版本、写回与额度规则仍由原有入口处理。
改动思路 / Approach
现有权威和消费者足以解决问题。Python 准入保留既有触发数据。TypeScript 只调整匹配器对两个缺值表示的语义,未改变原始 JSON 或真实键。无需新状态、迁移或把错误分支转成成功。 只修复重规划来源比较。既有 Todo 状态、凭据版本、写回与额度规则仍由原有入口处理。 原先的匹配前提仍适用。失败输入继续走原有拒绝路径,只有满足现有约束的记录才能完成这一步。已有完成键的匹配保持精确。两种存储的带键对照在基线和当前头都成功,一侧有键仍拒绝。
具体改动 / Changes
精确头的净差异为两个文件 +28/-1。生产代码在已存在的匹配函数中处理当前场景,测试加入正常回读、失败或不匹配边界。Python 准入保留既有触发数据。TypeScript 只调整匹配器对两个缺值表示的语义,未改变原始 JSON 或真实键。 依现有合同核验了 original_9296_contract 和 unchanged_negative_gate,两个约束均有执行证据。当前主干与精确头的三方合成未产生冲突。 现有合同
关键代码讲解
- lifecycleObligation 确认原收据的触发对象和完成身份。只把缺省和 null 视为同一个缺值。 源码
- projectReplanSemantics 原生重规划复查的投影入口。继续使用原有来源、Agent、Todo 和触发序列约束。 源码
对主干的风险 / Risks
PASS。四个真实 CLI 用例通过。带有效完成键和不带键的 Todo 在 File、SQLite 都能复查同一轮,不产生额度扣减。 在基线的实际 CLI 上,两个无键用例均失败,有真实键的两个对照通过。当前 TypeScript 反例也拒绝仅一侧有键的记录。 精确头 221 项 TypeScript 测试、四个原生 CLI 对照及 TypeScript 类型检查通过。全树检查在补齐独立检出的 TypeScript 依赖后通过。主干的 Goal frontier 重构合成后重跑,四个原生对照仍通过。 快速预合并 4 项直接检查通过,选中检查 3 项通过。 适用范围与残余风险已限定。验证使用隔离的 File 和 SQLite 源码运行。未运行正式安装、Windows 或 PostgreSQL。
语义与 CI 对齐
使用现有协议、既有匹配条件和状态投影。已有完成键的匹配保持精确。两种存储的带键对照在基线和当前头都成功,一侧有键仍拒绝。 比较原实现与当前头的结果,没有依赖远端 CI。 回归测试
我的整体评价 / Verdict
没有阻止批准的问题。该改动恢复了正常且已经获准的后续路径,降低合法工作因数据形状中断的风险,保留错误、授权、写回和调度约束。改动只涉及重规划投影和 CLI 复查,未改动渲染页面。 验证使用隔离的 File 和 SQLite 源码运行。未运行正式安装、Windows 或 PostgreSQL。
English verdict: APPROVE at 50b264d. Native File/SQLite recheck preserves the original Turn for absent completion keys while keyed and mismatch controls retain their semantics.
|
The two red checks here come from one cancelled job: 🤖 Generated with Claude Code |
Goal And Delivered Outcome
mainat b03763b).completion_turn_key: null, becausegoal_frontierbuilds it withitem.get("completion_turn_key"). The Todo row read back for lifecycle reconstruction omits the key, andlifecycleObligationcompared the two with!==, sonull !== undefinedrejected the exact admitted lifecycle.quota should-runwith the same--turn-instance-idfor an admittedautonomous_replan_requiredTurn. Before:ok: false,effective_action: heartbeat_receipt_write_failed, "lifecycle source does not match the admitted obligation". After:ok: true,should_run: true,autonomous_replan_required. Hosts that revalidate before entering the Turn (the DSH Driver's pre-step recheck) rejected every such Turn, and LoopX paused once all agent Todos were done.main.Author Declaration
Implemented against
trigger_identityinautonomous_replan_obligation.py) already treats a None completion key as absent, and this change aligns the TS comparison with it.lifecycleObligationinreplan_semantics.tstests/control_plane_ts/replan_semantics.test.ts"an admitted lifecycle trigger with a null completion key matches a Todo row without one"null)mainwith "heartbeat receipt settlement identity conflicts" and passes here. Neighbouring TS and Python tests and the control-plane typecheck were run. Othercompletion_turn_keyequality checks in the TS control plane were reviewed; they already normalize to null or require a non-empty string. The admission side was left unchanged: changing it would not repair receipts already recorded withnull.Scope And Continuation
Validation
unitpassednode --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/replan_semantics.test.ts: 42/42; onmainthe new test failsunitpassedtests/control_plane_ts/replan_settlement.test.ts10/10,tests/control_plane_ts/quota_settlement_readback.test.ts169/169staticpassednpm run typecheck:control-planeintegrationpassedtests/control_plane/test_lifecycle_guard_reentry.py,test_replan_settlement_runtime.py,test_replan_semantics_transport.py: 43 passed, 6 failed; the same 6 fail onmainon the Windows author host (sqlite legacy writer fence "value must be strict JSON")real_entrypointpassedok:false / heartbeat_receipt_write_failed; the same runtime with only this line patched returnsok:true / should_run:true / autonomous_replan_required. Private state, not attached.main'sreplan_semantics.tsis identical to b03763b's.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A
Boundary Checklist
none.Signed-off-bytrailer (git commit -s).🤖 Generated with Claude Code