Repository navigation
Conversation
A hard_lease Turn guarded before its Todo is claimed is admitted with execution_preparation.state=claim_required and records no prepared lease. Since loopx-project#9097, its first writeback after a Turn-scoped completion (after a separate claim, or via todo complete --recover-execution from loopx-project#8310) is refused with refresh_task_lease_unavailable, and the guard's unsettled_host_turn_recovery command fails the same way, so the Turn can never settle. Accept that writeback when the Todo is done and the Turn has no prepared lease. The existing completed-Todo check below still requires this Turn's own completion receipt, which a hard_lease completion can only write while holding the Todo's lease. Deferred Todos and Turns that prepared a lease keep their current checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Wang, Xiang-Han <wanghank00@gmail.com>
There was a problem hiding this comment.
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.
BigDataDZ
left a comment
There was a problem hiding this comment.
独立评审(native Windows)——APPROVE
精确核对 head:ccf1d4629(合并基点为当前 main)。评审域恰好是我此前多次验证过的 claim_required 语义(#9490、#9435 系列的同一文件)。
代码:5 行早退分支,触发条件收敛于 todo.status == "done" 且 prepared_lease is None(即 claim_required 准入、无准备租约可比对)。安全性锚在"下方完成回执检查必须绑定本 Turn",并由新增的负面测试证明:test_claim_required_turn_cannot_borrow_another_turns_completion 断言另一个已就绪 Turn 的完成不能被借用(refresh_task_lease_unavailable,零扣额)。其余分支(prepared lease 比对、recovery lease bound、autonomous replan guard bound)顺序与语义未动。
实测(Windows 10 / Python 3.12 / Node 24.20)
- 两个新测试 → 6 passed(file+sqlite × recover_execution 双模式;负面用例双 provider)。正面用例完整走通正文声明的链路:claim_required 准入 → claim →
todo complete --recover-execution→ 结算一次 → 幂等重放 → 后续 guard 不再报unsettled_host_turn_recovery,且validated_progress分类恰好 1 次、扣额恰好 1 次。 - 周边 bound 相关用例(hard_lease/claim_required/replacement_lease/execution_bound 选择器)→ 8 passed;2 个
test_migrated_hard_lease_can_write_settle_retry_and_continue失败经 main tip9e4730c13对照为既有环境失败(private capture validation is unsupported on this platform——POSIX 专用私有捕获门,即 #9398/#9559 家族),与本 PR 无关。
CI:分片按两级门控策略跳过、无完整套件结果。本机可验证的一切均通过,且修复域与我的既有验证记录重叠,故直接批准。
Goal And Delivered Outcome
Outcome basis / optional anchor: Reproduced regression from Fence C1 first writebacks with the prepared task lease #9097 (direct PR; no separate issue). Related to [Bug]: Turn cannot close out after its Todo is completed without --turn-instance-id #9988.
Goal/source and gap:
hard_leaseGoal, a Turn guarded before its Todo is claimed is admitted withexecution_preparation.state=claim_required, so it records no prepared lease.--turn-instance-id, its first writeback is refused withrefresh_task_lease_unavailable. That happens after a separatetodo claim, and also on the one-commandtodo complete --recover-executionpath from fix(todo): recover execution idempotently with route-bound lease remediation #8310. The guard then returnsunsettled_host_turn_recoverywith the samerefresh-state --settle-turncommand, which fails the same way, so the Turn can never settle.todo supersede --turn-instance-iddoes not unblock it either.test_one_command_completion_replays_the_original_admitted_turncovers the fix(todo): recover execution idempotently with route-bound lease remediation #8310 path but checks only the completion replay, not the settlement, so it kept passing.Observable before → after, with the validation row that proves it:
quota should-run(claim_required) → claim →todo complete --turn-instance-id X,refresh-state --settle-turnforXfails indefinitely.unsettled_host_turn_recovery(regression_parityrow).Issue/task and intended base: Related to [Bug]: Turn cannot close out after its Todo is completed without --turn-instance-id #9988, a different completion path that strands a Turn. Base
main.Author Declaration
Implemented against
claim_required(no prepared lease) can settle_hard_lease_execution_bound,loopx/control_plane/quota/execution_preparation.pytest_claim_required_turn_settles_after_its_own_completion(claim and--recover-execution)handoff_mode_requires_lease)test_claim_required_turn_cannot_borrow_another_turns_completionstatus == "done"test_unprepared_turn_does_not_become_admitted_after_deferralprepared_lease is Nonetest_first_writeback_refuses_generation_retired_by_later_work,test_replacement_lease_requires_original_turn_guard_before_writeback_hard_lease_execution_bound, the TSretired_lease_proofprojection andfindStepEventto confirm which existing checks bind the lease owner and the Turn's completion receipt. A first draft refused the completion instead; I dropped it because it removed the fix(todo): recover execution idempotently with route-bound lease remediation #8310 one-command recovery. I then removed three conditions from the new branch.prepared_requiredis implied by the earliernot (todo_open or prepared_required)return. The retired-proof checks are implied because the completion receipt the branch relies on cannot be written without the lease. A draft without thedonecondition admitted deferred Todos, and the existing deferral test caught it.Scope And Continuation
--turn-instance-id) is different and stays with fix(todo): refuse unscoped completion of a Todo whose lease an open Turn prepared #9989.Validation
regression_paritypassedtests/control_plane/test_quota_authority_settlement_journey.py::test_claim_required_turn_settles_after_its_own_completion(file/sqlite × claim/--recover-execution): all 4 fail on base 3a4f084 and pass on head. The same sequences were also checked on #9097's first parent a05425b (settles) and merge f5da544 (fails).regression_paritypassedstatus == "done"fails the existing deferral test; droppingprepared_lease is Nonefails the two #9097 generation tests; disabling the existing completed-Todo receipt check failstest_claim_required_turn_cannot_borrow_another_turns_completion.integrationpassedhard_lease: 2135 passed, 13 skipped, 0 failed. Run with the checkout'sscripts/first onPATH, becausetests/test_delegation_turn_context.pycalls the bareloopx.staticpassedscripts/loopx canary premerge --from-git-diff --git-diff-base origin/main: 23 selected checks passed, 0 failed (afternpm ci --ignore-scripts).prepared_lease_requiredwith noprepared_lease. The regression set is every test file that completes a Todo Turn-scoped underhard_lease. The repro was also run with thecodex_app,claude_codeandgeneric_cliruntime profiles. Not covered: PostgreSQL provider.See validation disclosure guidance.
Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).