Skip to content

fix(quota): support fenced completed_lease_takeover for a Turn completed under a reclaimed lease - #9561

Open
mojunzi wants to merge 3 commits into
loopx-project:mainfrom
mojunzi:codex/quota-writeback-completed-turn-lease-binding
Open

mojunzi wants to merge 3 commits into
loopx-project:mainfrom
mojunzi:codex/quota-writeback-completed-turn-lease-binding

Conversation

@mojunzi

@mojunzi mojunzi commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

  • Outcome basis / optional anchor: self-contained reproduced defect from a real install (no pre-existing issue; Related to Blocked writeback on completion-validated Todo cannot settle its Turn #5000, extends PR fix(quota): resume unfinished turns with fenced lease takeover #9488's fenced lease takeover, and is complementary to fix(turn): preserve original lease authority across recovery #9153 / test(quota): validate Codex lease takeover through settlement #9550 which cover different lease-recovery surfaces)
  • Goal/source and gap: a Turn whose task lease expires mid-Turn deadlocks settlement if the owner re-claims and runs todo complete before rerunning quota should-run. The re-claim creates a new lease generation with a fresh idempotency key; once todo complete retires that lease and marks the Todo done, every existing recovery path in main requires an open Todo (active-lease lease_takeover, requalification, execution-loss closeout), while direct refresh-state fails closed with refresh_task_lease_unavailable. The Turn is then stranded from durable writeback and quota spend.
  • Observable before → after, with the validation row that proves it:
    • before: a prepared Turn whose Todo was completed under a reclaimed lease generation before guard reentry fails direct refresh-state with refresh_task_lease_unavailable, and rerunning the original Turn's quota should-run cannot bind the retired completing generation, permanently stranding settlement.
    • after: direct refresh-state continues to fail closed (refresh_task_lease_unavailable) and retired-generation regression tests remain intact; rerunning the original Turn's quota should-run acquires the canonical maintenance lock, verifies canonical completion ownership in TypeScript, appends an append-only completed_lease_takeover receipt updating prepared_lease to the completing generation (without repeating work or altering admission/billing identity), and lets the guard-returned refresh-state settle the original Turn once. Stale original-generation proofs, unprepared Turns, and tampered/foreign sources remain rejected. Proven by the unit, real_entrypoint, and regression_parity rows in the Validation table below.
  • Issue/task and intended base: Related to Blocked writeback on completion-validated Todo cannot settle its Turn #5000; intended base main

Reproduction (real install)

  1. Start a long-running Turn whose execution exceeds the lease TTL (admission pins prepared_lease at epoch 1).
  2. The lease expires mid-Turn; the same owner re-claims, producing epoch 2 with a different claim idempotency key.
  3. Follow the documented settlement order without first rerunning quota should-run: todo complete --turn-instance-id <TURN> succeeds under epoch 2 (atomically setting todo.status = "done", todo.completion_turn_key = identity.effect_id, and retiring the epoch-2 lease as released), then run writeback.
  4. Direct writeback fails closed with refresh_task_lease_unavailable, and rerunning quota should-run previously could not qualify lease_takeover because replayPhase === "settlement_pending" and todo.status === "done". Permanent settlement deadlock.

Why fenced completed_lease_takeover is safe

  • No Python bypass on direct writeback: loopx/control_plane/quota/execution_preparation.py is unchanged from main. Direct refresh-state still fails closed (refresh_task_lease_unavailable) until the original Turn's guard explicitly qualifies takeover, preserving test_first_writeback_refuses_generation_retired_by_later_work.
  • TypeScript-owned authority under the canonical maintenance lock: extending PR fix(quota): resume unfinished turns with fenced lease takeover #9488's lease_takeover mechanism, requalify_bound_heartbeat_receipt takes the nonblocking canonical maintenance lock only when a prepared Turn has a matching todo_complete event and no accounting (refresh_state, quota_spend, todo_supersede) has started. TypeScript (heartbeatCompletedLeaseTakeover in heartbeat_receipt_identity.ts) alone decides eligibility.
  • Strict canonical and causal checks: requires heartbeatPreparedWorkAdmission(original, identity) (unprepared Turns stay refused), canonical handoff_mode === "hard_lease" from file_v0/sqlite_v0 with decision_read_from_provider === true and legacy_fallback_used === false, todo.status === "done", todo.done === true, todo.completion_turn_key === identity.effect_id, same completing owner, single released lease with strictly advancing lease_epoch and version and distinct key digest, leaseRepositoryRejection === null, monotonic timestamps (admitted <= acquired <= updated <= observed_at and released <= expires), and an exact matching todo_complete rollout receipt.
  • Cold-read lineage verification: validateHeartbeatTakeoverParent verifies the append-only parent chain back to the original admission, and settlement_readback.ts cross-checks takeover_completion_event_id === completionEvent.event_id on cold readback. Replaying quota should-run is idempotent, and stale original-generation proofs remain rejected.

Author Declaration

  • Written by: model_agent — OpenAI Codex (GPT-5-family) and Google Antigravity (Gemini-family), directed and reviewed by the human operator

Implemented against

  • Specification and revision: no written specification; the request in this PR is the basis, extending PR fix(quota): resume unfinished turns with fenced lease takeover #9488 (988a80c2b1) fenced lease_takeover semantics while preserving execution_preparation.ts ("Recovery must not borrow a replacement lease or execution") and retired-generation writeback fencing.
  • Criteria:
Criterion (spec clause) Disposition Symbol / path Test or command
Direct refresh-state continues to fail closed before guard takeover; retired-generation regression stays green implemented loopx/control_plane/quota/execution_preparation.py (unchanged from main) tests/control_plane/test_completed_lease_takeover.py + test_first_writeback_refuses_generation_retired_by_later_work (8 passed)
Guard reentry qualifies completed_lease_takeover under maintenance fence only before accounting starts and validates canonical completion + retired lease ownership implemented heartbeatCompletedLeaseTakeover, validateHeartbeatTakeoverParent, heartbeatWorkRequalification in loopx/control_plane/quota/heartbeat_receipt_identity.ts; requalify_bound_heartbeat_receipt in loopx/control_plane/quota/heartbeat_receipt.py; readExecutionPreparationSource in loopx/control_plane/todos/read_transaction.ts tests/control_plane_ts/native_child_admission.test.ts + tests/control_plane/test_completed_lease_takeover.py (File & SQLite)
Cold settlement readback verifies takeover lineage and cross-checks takeover_completion_event_id against todo_complete implemented heartbeatValidationEvent, readQuotaSettlementFromRequest, requalifyHeartbeatReceipt in loopx/control_plane/quota/settlement_readback.ts tests/control_plane_ts/native_child_admission.test.ts + tests/control_plane_ts/quota_settlement_readback.test.ts
Unprepared Turns, stale original-generation proofs, foreign/tampered sources, and post-writeback reentry remain rejected implemented same as above tests/control_plane_ts/native_child_admission.test.ts + tests/control_plane/test_completed_lease_takeover.py
  • Self-check before submission: reverted the initial commit's Python execution_preparation.py writeback bypass after catching that it broke test_first_writeback_refuses_generation_retired_by_later_work[False-complete-file|sqlite] and weakened direct-writeback fencing; verified full TypeScript control-plane suite, targeted Python control-plane suites (File & SQLite), ruff, touched-file mypy, loopx check, scripts/generate_semantic_inventory.py, loopx canary premerge --from-git-diff, and published-diff parity against origin/main...HEAD. Not verified: live multi-hour reproduction (reproduced on a real install prior to the patch; end-to-end File & SQLite CLI lifecycle is covered in tests/control_plane/test_completed_lease_takeover.py) and full repo-wide 6-shard pytest locally.

Scope And Continuation

Validation

Public-safe summaries only.

  • Tested revision: 845d88b1ab25fd56f77c228c97046906fc9774ce
  • Run state: finished
  • Input classes: synthetic, public_fixture
Check kind Result Public-safe evidence / limitation
static passed npm run typecheck:control-plane (tsc --project tsconfig.control-plane.json --noEmit): 0 errors; python -m ruff check loopx/control_plane/quota/heartbeat_receipt.py loopx/control_plane/quota/execution_preparation.py tests/control_plane/test_completed_lease_takeover.py: passed; python -m mypy --follow-imports=silent loopx/control_plane/quota/heartbeat_receipt.py loopx/control_plane/quota/execution_preparation.py: 0 issues; loopx check on all 6 changed files: clean (0 errors, 0 warnings); python scripts/generate_semantic_inventory.py --changed-from origin/main: 0 unsupported new vocabulary carriers; git diff --check: clean
unit passed npm run test:control-plane: 6896 passed, 0 failed, 1 skipped (includes new completed_lease_takeover, retired-lease updated_at fallback, and cold-read takeover_completion_event_id tamper tests in tests/control_plane_ts/native_child_admission.test.ts; CI typescript-core (1-3/3) and typescript-coverage green on 845d88b1a)
real_entrypoint passed python -m pytest -vv tests/control_plane/test_completed_lease_takeover.py tests/control_plane/test_heartbeat_lease_takeover.py tests/control_plane/test_quota_execution_preparation.py tests/control_plane/test_execution_loss_closeout_cli.py: 145 passed, 0 failed (File & SQLite end-to-end CLI flow: todo complete under reclaimed lease -> direct refresh-state fails closed -> quota should-run records completed_lease_takeover -> idempotent replay -> stale proof rejected -> guard-returned refresh-state settles once; unprepared Turn stays refused)
regression_parity passed python -m pytest -vv tests/control_plane/test_quota_authority_settlement_journey.py -k test_first_writeback_refuses_generation_retired_by_later_work: 8 passed, 0 failed (confirmed failing on commit 1 94642d06a `[False-complete-file
integration passed loopx canary premerge --from-git-diff: 18/18 checks passed (0 failures, 0 warnings), including control-plane-maintainability-ratchet-smoke.py, semantic-vocabulary-drift-smoke.py, task-lease-runtime-smoke.py, refresh-state-write-correctness-smoke.py, todo-write-correctness-smoke.py, and quota-plan-smoke.py
static blocked CI kernel-contracts failed on pre-existing main repo-wide mypy errors (Found 3834 errors in 395 files, tracked in #9549), which causes CI pytest shards and merge-gate to be skipped/blocked until #9549 lands on main and this branch rebases
  • Coverage and gaps: All changed TS and Python control-plane paths (admission check, maintenance-locked takeover snapshot, retired lease timestamp handling, cold-read lineage/completion-event verification, File/SQLite CLI settlement, stale proof refusal, unprepared Turn refusal, and retired-generation regression) are exercised directly. Remaining gaps: (1) full repo-wide 6-shard pytest was not run locally and is currently skipped in CI behind Isolate private capture platform support from quota type checking #9549's pre-existing kernel-contracts mypy failure; (2) test_quota_authority_settlement_journey.py::test_original_turn_refuses_readiness_from_a_replacement_lease[file|sqlite] fails on current main on this host due to pre-existing PR fix(quota): resume unfinished turns with fenced lease takeover #9488 open-Todo lease_takeover behavior (its Todo stays open and never calls todo complete, so it is unrelated to completed_lease_takeover).

See validation disclosure guidance.

Frontend / Visual Evidence

  • UI impact: none
  • Before: N/A
  • After: N/A
  • First viewport and preview: N/A
  • States and viewports shown: N/A
  • Source data: none
  • Attention review: N/A
  • Craft review: N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring (no functional changes)
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)
  • Capability or extension (providers, adapters, skills)
  • Public docs or presentation surface (README, protocols, dashboard)
  • Build, packaging, installer, or CI
  • Host or runtime integration

Technical Direction

Shared-authority RFC fixture impact

N/A — this PR fixes the completed-Todo fenced lease takeover settlement gap and does not claim new Shared Goal Authority RFC migration progress.

Boundary Checklist

  • Neither the diff nor this PR body/comments/attachments disclose private state, credentials, raw traces or verifier output, internal links, or local machine paths (including .loopx/, .codex/goals/, and live ACTIVE_GOAL_STATE.md).
  • I did not duplicate maintainer-owned benchmark work unless a maintainer split out a public issue for it.
  • I kept the change scoped to the linked issue/task.
  • Existing English/Chinese RFC pairs (including ledger entries) both have a diff, and the local premerge check python3 scripts/check_rfc_bilingual.py --base origin/main --head HEAD passes, or no paired RFC changed.
  • I completed the visual evidence section for UI changes, or marked UI impact none.
  • Every commit includes a DCO Signed-off-by trailer (git commit -s).

Related audit gap (not fixed here)

While diagnosing the incident, the rollout event log projection (loopx/rollout_event_log.py _safe_details) was observed flattening nested dict values such as mutation_authority.idempotency_key into truncated 240-character strings, which destroys lease-key audit evidence in the log. The ledger itself is unaffected. This is a separate observability defect; it is reported here for maintainer awareness rather than fixed in this PR to keep the slice reviewable.

…se generation

When a task lease expires mid-Turn, the documented settlement order
(todo complete before writeback) deadlocks permanently: the re-claim
creates a new lease generation with a fresh idempotency key, the exact
prepared receipt no longer matches, recovery binding requires steward
key shapes no CLI path produces for this case, and every recovery path
(requalification, takeover, execution-loss closeout) requires the Todo
to still be open. The writeback then fails forever with
refresh_task_lease_unavailable.

A completed Todo can never produce another lease generation (claims and
lifecycle operations reject non-open Todos), so the owner's retired head
lease unambiguously is the completing generation. The completion receipt
already proves a lease-fenced terminal transition for the exact Turn;
binding writeback to it admits no execution the completion fence did
not already permit, while refusing to bind strands the exact Turn the
settlement plan instructs to complete first.

Admit retired-lease binding only when the readback carries an exact
todo_complete receipt for this Turn, Todo, and agent, and the requested
proof (when given) matches the completing generation exactly. Foreign
or fabricated receipts and proofs are still rejected.

Signed-off-by: Wang, Xiang-Han <wanghank00@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 28, 2026 06:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@mojunzi
mojunzi marked this pull request as draft November 28, 2026 06:14
…ted_lease_takeover

Revert the Python execution_preparation.py writeback backdoor that bypassed lease-generation fencing on direct refresh-state and broke retired-generation regression tests.

Instead, extend PR loopx-project#9488's TypeScript-owned fenced lease takeover to handle a prepared Turn whose Todo was already completed under a reclaimed lease generation before rerunning quota should-run:
- Direct refresh-state continues to fail closed (refresh_task_lease_unavailable) until the original Turn's guard runs.
- Rerunning quota should-run acquires the canonical maintenance lock, verifies canonical done status, completion_turn_key, completing owner, monotonic retired lease generation, and matching rollout todo_complete receipt, and appends a completed_lease_takeover receipt updating prepared_lease without repeating work or altering admission/billing identity.
- Cold settlement readback validates completed_lease_takeover lineage and cross-checks takeover_completion_event_id against the Turn's todo_complete receipt.
- Stale original-generation proofs and unprepared Turns remain fenced.

Signed-off-by: Wang, Xiang-Han <wanghank00@gmail.com>
@mojunzi mojunzi changed the title fix(quota): bind writeback for a Turn completed under a reclaimed lease generation fix(quota): support fenced completed_lease_takeover for a Turn completed under a reclaimed lease Nov 28, 2026
@mojunzi
mojunzi marked this pull request as ready for review November 29, 2026 20:08

@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.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

任务租约在执行期间到期时,原持有人可以重新认领并完成 Todo。主干直接结算会拒绝已退役的租约,而且原轮次的准入读回无法接上完成时使用的新租约。操作者明明已通过 Todo 验证,仍无法把原轮次结算闭环。这个 PR 让原轮次从已完成的 Todo 恢复结算。验收依据是 PR 对 #9488 的扩展描述,以及主干既有的租约隔离和 Goal 实例隔离。基于 File 与 SQLite 的对照确认了正常路径改进,同时发现一处会重新造成结算停滞的隔离问题。

在任务完成前重新认领租约、需要结算原轮次的操作者。 File/SQLite 的 todo complete、原轮次 quota should-run 与 refresh-state。 候选同来源两后端都升级并结算一次;有另一 Goal 实例的历史记账时两端仍只重放。 外实例事件不属于当前轮次的 typed readback,但 Python 阻止接续。File/SQLite 两对照通过、两负例失败。 未测量实际安装、多小时生产复现、PostgreSQL 和稳定延迟。远端 CI 未查询。 当前轮次无法忽略另一 Goal 实例的历史记账事件。

按基线 811c1a1f66652d3fc3b9830d467e14b45b7423c1 上的 docs/architecture/rfcs/typescript-control-plane-migration-v0.md 核对两项。

  • existing-runtime-owner 对应现有 runtime 的职责和来源。
  • real-path-parity 对应真实 File/SQLite 入口的行为对照。

改动思路 / Approach

直接写回继续受原租约围栏约束。重入原轮次的 quota should-run 在维护锁下读取完成收据与退役租约,由 TypeScript 决定是否追加接续收据。这个边界允许已验证的完成结果继续走原轮次,不需要重跑任务。复用现有收据链比在写回入口放宽租约规则更合适。Python 为读快照增加的前置筛选也需要使用原轮次的 Goal 实例身份。

验证完成来源、租约代次、原轮次与结算身份保持在同一 Goal 实例。 让 Python 快照前置检查复用同一 Goal 实例和结算身份的判定,或由现有 typed 结算所有者决定何时需要快照。

具体改动 / Changes

  • heartbeat_receipt.py 的 requalify_bound_heartbeat_receipt 在追加前先识别已完成且尚未记账的请求,取得维护锁后读取权威租约。
  • heartbeatCompletedLeaseTakeover 核对完成事件、Todo、同一持有人、新租约代次及时间边界。 validateHeartbeatTakeoverParent 和 settlement_readback.ts 在冷读时检查原准入与完成事件。 readExecutionPreparationSource 仅在 takeover 读取中提供退役时间。
  • Python 新用例走真实 File/SQLite 命令,覆盖直接写回拒绝、准入重入、旧证明拒绝、一次结算和幂等重放。TypeScript 用例覆盖其他持有人、未准备轮次、畸形完成收据和已经开始记账的请求。

对主干的风险 / Risks

[P2] 其他 Goal 实例的历史记账事件会阻止当前轮次接续。 requalify_bound_heartbeat_receipt 的前置筛选只匹配 Goal 名称、Agent 和轮次字符串。结算冷读按精确 Goal 实例隔离,Python 却会把另一个实例的 refresh_state 当成当前轮次已经记账。File、SQLite 的隔离对照都先实际完成重领后的 Todo。在只增加一条其他实例的历史记账记录后,冷读仍正确报告当前轮次待结算,原轮次 guard 却由 upgraded 变为 replayed,漏绑完成时的租约。请在维护锁前按同一来源和结算身份筛选,或让现有结算所有者提供是否需要快照的判断。补上同文本轮次跨 Goal 实例的双后端回归。 Python 前置筛选

原正常用例两端在主干均只重放,候选在无跨实例记录时能够完成原轮次。同源拒绝及单次记账用例随 145 项 Python 检查通过。相关 TypeScript 的 211 项通过。生产安装态的多小时场景和 PostgreSQL 不在验证范围。

18 项本地预合并检查中的 17 项首跑通过。补装仓库锁定的 npm 开发依赖后,单独重跑余下一项语义词汇检查通过。

我的整体评价 / Verdict

保留已完成租约通过原 guard 接续的总体设计。将 Python 快照前置判断收敛到同一个 Goal 实例和结算身份,再复验冷读、重放与 File/SQLite 一次结算。远端 CI 未查询。

English verdict: REQUEST_CHANGES at 845d88b. Ignore accounting events from another Goal instance when qualifying the completed-lease takeover. Both File and SQLite controls recover, while both cross-instance counterfactuals strand the original settlement.

and original_details.get("prepared_lease_key_sha256")
and not details.get("prepared_lease_key_sha256")
):
turn_events = [

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.

[P2] 按 Goal 实例筛选记账记录。 File 和 SQLite 的真实 guard 对照中,另一实例的同文本轮次有历史记账时,冷读仍报告当前轮次待结算,前置扫描却跳过完成租约接续。请让这里使用与结算读回相同的来源和结算身份,并覆盖该负例。

…ify shared takeover validation

Address P2 review finding: scope requalify_bound_heartbeat_receipt's completed_takeover_candidate pre-filter by the exact goal_ref owner (sharing _expected_goal_ref / _event_matches_goal_ref with _agent_heartbeat_receipt_events) and settlement_effect_id so historical accounting events from another Goal instance or settlement effect do not suppress takeover.

Add File and SQLite cross-instance regression coverage (test_completed_lease_takeover_ignores_foreign_goal_instance_accounting), share the common takeover validation core in heartbeat_receipt_identity.ts, and revert the unnecessary released_at projection change in read_transaction.ts.

Signed-off-by: Wang, Xiang-Han <wanghank00@gmail.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.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

已准入、重领同一硬租约任务并在运行原守卫前完成 Todo 的 Agent 需要结算原轮。 上一提交遇到其他 Goal 实例的同轮历史账务,守卫重放旧回执,File 和 SQLite 都卡在接管。 本提交按 GoalRef 和 settlement effect 筛出完成与账务事件,守卫能接管。对于 legacy Goal 与另一实例同 Todo 的历史写回,后续回执仍会被去重,原轮扣额为零。 限于已准入并完成的原硬租约任务及其账务恢复。 复测使用隔离 File、SQLite 和合成历史行,复用实际 Todo 完成、quota should-run、生成的 refresh-state 和扣额命令。部署态升级与托管 CI 未验证。 既有接管契约 上一轮评审

改动思路 / Approach

原 guard 持有 rollout 锁,并在核验候选退役租约时读取 canonical authority。TypeScript 复用开放任务与已完成任务的共同校验,分别处理 active 和 released 状态。完成接管追加原 admission 和 completion 的引用,冷读校验两者配对。后续 refresh-state 继续用原写回与扣额链路。 守卫 冷读

具体改动 / Changes

评审提交 696be1e2628d6dfb0c1c8d0923cfa9b6efc2e6d1,PR 基线 811c1a1f66652d3fc3b9830d467e14b45b7423c1。五个文件 +655/-58。

关键代码讲解

  • requalify_bound_heartbeat_receipt 在取维护锁前筛选同 GoalRef 和同 effect 的 rollout 事件。独立对照确认上一轮指出的守卫误判已消失。 事件筛选
  • verifyTakeoverCommon 核对原准入、单条 canonical lease、owner、代数、时间和来源。heartbeatCompletedLeaseTakeover 另要求完成键、released 状态及原轮 completion;settlement_readback 用该事件 ID 校验冷读。 共同校验 完成接管 冷读
  • Python 的 File/SQLite 测试覆盖新守卫、生成写回与重放。跨实例用例中的历史 refresh_state 使用另一个 Todo,未覆盖历史写回与当前 Todo 相同的案例。TypeScript 测试保护接管的拒绝条件和持久化读回。 File/SQLite TypeScript

核对三项验收。guard-fence 已通过。completion-lineage 已通过。scoped-settlement-once 卡在真实写回后的扣额。 既有同轮恢复约定

对主干的风险 / Risks

[P2] legacy 写回的去重仍会吞掉当前 Goal 的回执。 无 GoalRef 的当前 legacy 写回在 append_rollout_event_once 按字段去重时省略 goal_ref。这使同 Todo 的异实例历史写回占用当前记录。结算冷读仍按实例隔离,所以找不到本轮自己的写回回执。两种 provider 在无历史和异 Todo 历史时均完成结算并只扣一次。只有异实例、同 Todo 的两项在守卫升级和幂等重放之后返回 matching accountable refresh-state receipt is missing,并且没有当前实例的写回回执,扣额为零。 让 refresh-state 的 append-once 身份显式区分没有 GoalRef 的 legacy 事件和携带 GoalRef 的事件。沿用已核验的当前作用域,增加同 Todo 的 File/SQLite 用例,核对当前回执、扣额及重放各一次。 写回去重键 去重匹配 结算错误

前置直接写回和旧 lease 证明仍被拒。已有 TS 矩阵覆盖来源不符、完成身份不符、已写回、其他 owner 与回执父链。 仓库 Python 301 通过、10 跳过,TypeScript 211 通过。本地 canary 17 项选定检查及 6 项直接检查通过。

我的整体评价 / Verdict

REQUEST_CHANGES。原守卫的实例隔离已复验。请补齐写回回执的实例隔离,并在 File 与 SQLite 复验生成命令、回执冷读和同轮重放,确认恢复完成后只扣一次。

English verdict: REQUEST_CHANGES at 696be1e. The guard recovers the original Turn, but legacy writeback deduplication can still suppress its receipt when the same Todo has history from another Goal instance. File and SQLite both leave the debit uncommitted.

This branch has not been deployed

No deployments
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.

3 participants