Repository navigation
Recover an owed replan debit before the next host Turn - #8794
Conversation
Consider the original Todo binding when an admitted replan has verified writeback. Require the exact spend receipt before another guard grants delivery, even if the Todo lifecycle has changed. Keep explicit selection on the same recovery path and let the existing settlement owner replay the original debit. Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
评审提交 a999e51f4ba7b49b7b4ffb174513cbb55873faac,对照目标 48dbebbd14c5535b9631f4c7a1152d86aa64c5b2。
[P2] 原轮首扣与结算重试未校验原计划的槽数和来源。 同一个已写回、尚未扣额的 Codex App 重规划 Turn。执行恢复计划中的 spend-slot,只把 --slots 1 改为 2,或只把 --source heartbeat 改为 visible-goal。 两个安装包都把改参后的扣额提交为原 effect,回执链仍显示成功。File 已读回 2 slots;SQLite 已读回 visible-goal。随后执行原命令仍返回成功重放。先正常结算再改参也返回成功重放,账本没有新增记录。 仅在事务重放中比较参数 · 已结算时提前返回
动机 / Motivation
在 Codex App 心跳中恢复原 Todo-bound replan 的操作者。 第一次写回后意外中断,第二次唤醒先恢复原 Turn,两条同参数请求可能同时补扣。 File 和 SQLite 上,普通 guard 和显式选择都返回原 Turn 及待扣额,拒绝新身份。生成的原命令两进程并发只写一笔扣额和一条 rollout 事件;两次响应的三步回执完全一致。补扣后新身份可用。普通已完成 Todo 即使仍有旧轮待扣,后继也能准入。 测试使用两个精确提交的 macOS Core wheel 和合成隔离状态;原生 Windows、已登录桌面宿主与托管 CI 未验证。
改动思路 / Approach
结算由原 Goal、Agent、Todo 和 Turn 关联到同一笔扣额。 同一结算 owner 继续持有原 Turn、写回与扣额。先根据已准入的 guard 和已验证的写回找到待扣,再复用原命令;当前选择没有因此取得新权限。并发比较放在原记账事务内,能把不同的当时额度观测归到同一项合法补扣。原 Turn 筛选
具体改动 / Changes
关键代码讲解
- 既有候选选择器纳入已写回待扣的 Todo-bound replan,原轮尚未写回时不额外阻挡。正常、显式选择以及普通已完成 Todo 后继均实跑。恢复和普通生命周期分流
- 同参并发时,事务内允许当前 quota 观测变化,保留原扣额记录;按 Goal、Agent、Turn 和绑定只记一条 rollout。但准备的首扣与已经结算的前置读不检查命令中的 1 slot 和来源。原计划的扣额命令。目标 main 的隔离 wheel 在同一负例也会错记;这是本次恢复的验收缺口,非新引入的记账回归。
- 当前改动 10 文件,+280/−61。复用同一个 prior-turn selector、settlement readback 与 quota artifact 事务。原始结算与前序边界
按 docs/reference/protocols/turn-loop-controller-v0.md 核对:original-turn-recovery-and-ordinary-successor、concurrent-exact-replay 通过;original-accounting-terms 未满足。
对主干的风险 / Risks
扣额记录只写一次,仍可能把错误的首扣认成正确完成。在同一 Goal 的已结算状态下,两种改参也被报告成成功重放。异 Todo 和不允许 Turn 结算的 controller 来源仍会拒绝。
语义与 CI 对齐
真实 File/SQLite 安装包在普通后继及并发恢复均通过。214 项 TypeScript 通过。 23 项 Python 聚焦检查和 18 项标准预合并自动检查通过。 测试使用两个精确提交的 macOS Core wheel 和合成隔离状态;原生 Windows、已登录桌面宿主与托管 CI 未验证。
我的整体评价 / Verdict
请求修改。在现有 settlement/spend owner 校验原计划的槽数和来源,覆盖首扣、账本已写而回执未齐,以及完整回执重放;回执读回仍可返回历史事实。 两种本地库都先写回而不扣额:分别只改 slots、只改 source、按原参数并发执行。改参时不准写,原参两次返回同一完整回执;重放原参、改参和换 Todo 均单独核对。
English verdict: REQUEST_CHANGES at a999e51. Original replan recovery, full concurrent receipts and ordinary successor admission pass on File and SQLite. The installed CLI still commits altered first-debit terms and replays the original receipt as success.
| retainedRecord.goal_id === request.goal_id && | ||
| retainedRecord.agent_id === request.resolved_agent_id && | ||
| canonicalJson(retainedRecord.settlement_identity) === canonicalJson(identity) && | ||
| retained.source === proposed.source && retained.slots === proposed.slots && |
There was a problem hiding this comment.
[P2] 原轮首扣与结算重试未校验原计划的槽数和来源。 这个比较只有 artifact transaction 已能看到 retained receipt 才执行。两份安装包都能在首扣前用改过的 2 slots 或 visible-goal 写入原 effect;之后按原命令还会成功重放。已结算重放也会在 Python precheck 提前返回。请让首次写、回执修复和重放共用原计划的校验。
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)
评审提交 de44c3e5db7642f4926587db040a4fb8a53669b6;GitHub 对照目标 48dbebbd14c5535b9631f4c7a1152d86aa64c5b2。另验证最新 main 6dfd1c90c4c1a186c43de0a2c05243fa14b5a76e(合并基点 58cc5817e35ea9a0dc4697f7791279c6d80946bc)。
动机 / Motivation
通过受管宿主或 LoopX CLI 恢复中断工作的人。 重规划写回后宿主中断,再次运行同一 Agent 时需要先处理原欠款。 上一提交的安装包在首次扣额时接受 2 slots 或 visible-goal,并把错误账目当作原 Turn 的成功重放。
File 与 SQLite 均在首扣、补回执和重放三处拒绝单独修改 slots 或 source。两次原参数并发返回同一组三步回执,仅留一笔扣额;人为移除扣额回执后,原命令补回回执,下一 Turn 以新身份准入。 验证使用隔离 macOS Core 和真实 File/SQLite;原生 Windows、已登录桌面与托管 CI 未验证。GitHub 分支更新和维护者合并授权仍独立。
改动思路 / Approach
同一个 TypeScript 结算 owner 判定原欠款和参数;现有账本事务写入一次,CLI 只携带原身份与来源。 共享扣额修复可先独立集成;保留同一个状态和回执 owner,避免在宿主或项目切换时重复判断。 读原 guard → 确认原 durable writeback → 核对扣额条件 → 原 effect 写回或读回 → 下一 Turn 判断。
具体改动 / Changes
关键代码讲解
原债务筛选 只将已核验的 replan 写回纳入优先恢复。原扣额核对 用同一请求条件覆盖首扣、补写和重放。旧账已有扣额但掉了回执时,只用能核验的原账事实修补,读回历史不会产生新 charge;并发重放 比较原身份和账目事实。下一轮继续由原守卫重新判定。
按 目标验收文件:prior-replan-recovery 已验证;frozen-spend-terms 已验证;ordinary-and-exact-replay 已验证。
对主干的风险 / Risks
File 与 SQLite 均在首扣、补回执和重放三处拒绝单独修改 slots 或 source。两次原参数并发返回同一组三步回执,仅留一笔扣额;人为移除扣额回执后,原命令补回回执,下一 Turn 以新身份准入。 GitHub 目标快照与当前主干分别核对。当前 main 上合成合并树无冲突,只触及 15 个预期文件,更新主干未改动这些文件;不依赖 #8266 的捕获、启动或 Benchmark。GitHub 当前标为 behind;如分支规则要求更新后产生新头,须在新头复审。作者报告全量 TypeScript 有相同基线错误,未作为本次独立预合并通过项。
语义与 CI 对齐
独立运行 60 项 TypeScript 和 6 项 Python 源码测试,均通过。Standard premerge 18 项选中检查通过;真实 Core wheel 另行完成两种存储的反例和重放。 托管 CI 未查询。验证使用隔离 macOS Core 和真实 File/SQLite;原生 Windows、已登录桌面与托管 CI 未验证。GitHub 分支更新和维护者合并授权仍独立。
我的整体评价 / Verdict
同意已验收范围的代码变更。可以先于 #8266 独立落地,按仓库规则完成分支检查和维护者授权。建议保持同一份事务和结算读回,避免把重复扣额判断移入各 Host。
English verdict: APPROVE the standalone code change. It composes cleanly on current main without #8266. Exact review does not waive branch checks or merge authority.
…000 commits (#8759) * Deliver verified images in private Lark answers Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Keep image retries behind new private Lark replies Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recover missing images from one verified private Lark reply Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Use one wall clock for private Lark image retries Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recheck the original Lark reply before historical image writes Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Verify private Lark image sources before every redirect Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * feat(coordination): add postgresql authority checkpoints and local-to-pg-seed exporter - Add authority_checkpoints table DDL and tenant-scoped RLS policies. - Store incremental delta in authority_commits and bounded checkpoints every 64 commits and on genesis cursor 1, resolving table bloat and the 20,000 commit recovery ceiling. - Implement scanCommitted bounded delta replay from covering checkpoint via AuthorityStateReplay. - Add setupPostgreSqlAuthoritySchemaAndRole for explicit schema installation and least-privilege restricted role assembly. - Add exportLocalToPgGenesisSeed with sanitization (expired leases, local absolute paths, .local/ references, Feishu IDs, private materials) and fail-closed privacy boundary scan. - Add loopx postgres setup and loopx postgres local-to-pg-seed CLI commands. - Add test suites for checkpoints, sanitization, role assembly, and CLI invocation. Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recheck the historical Lark reply before each media write Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Retry Lark image uploads after an explicit App scope rejection Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Honor original Lark stop and closure before deferred images Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recheck private answer control after Lark source read Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Read the current Core session after delayed image controls Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Fence private answer media dispatch with original controls Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Keep Lark media checks with private delivery Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recheck Lark image sources after recording upload intent Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Read both original Feishu messages together before media upload Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Verify Feishu sources at the guarded image dispatch Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Preserve pre-dispatch Feishu source and session validation Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recover and verify PostgreSQL checkpoint history with append-only privileges Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Verify backup history to its captured cursor beyond 20000 commits Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Generate explicitly synthetic secret fixtures at test time Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recover private image uploads when the Lark CLI cannot start Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * fix(chat): preserve the first Goal's registered conversation (#8798) * fix(chat): preserve the first Goal's registered conversation Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * test(chat): keep original Goal adoption compatible with Python 3.11 Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> --------- Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Avoid rereading delivered Lark settings records and empty queues Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recover private Lark images after a CLI descriptor limit Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Enable existing checks and the original authorized Task in managed Chat Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Reuse the canonical boundary projection and narrow Task JSON types Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Keep confirmed Goal creation attached to its original Task (#8805) Reuse the existing C1 source observation guard Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Assert the lease source probe returned an observation (#8796) (cherry picked from commit 2c099be) Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recover an owed replan debit before the next host Turn (#8794) * Recover an owed replan debit before the next host Turn Consider the original Todo binding when an admitted replan has verified writeback. Require the exact spend receipt before another guard grants delivery, even if the Todo lifecycle has changed. Keep explicit selection on the same recovery path and let the existing settlement owner replay the original debit. Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Preserve ordinary completed-Todo successor admission Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Replay one validated Turn debit across concurrent observations Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Validate original Turn spend terms before debit and replay Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Keep conversation history rendering off the typing path (#8781) Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * feat(coordination): complete remote task lifecycle and opt-in gateway access (#8747) (#8765) * feat(coordination): add complete remote task lifecycle and opt-in gateway access (#8747) Align with PR #8747 (multi-loopx-agent-cloud-collaboration-v0) and remote-authority-task-service-v0 (#8508): 1. Extend RemoteAuthorityService with full remote task settlement: - Add 'complete', 'block', 'defer', 'todo_add', and 'snapshot' operations. - Enforce hard-lease fencing and claim-request ownership checks. - Settle completion receipts and deterministic cross-machine snapshot digests. - Maintain default-deny Tenant/Goal/Actor authorization and incarnation pinning. 2. Introduce controlled remote authority gateway in Python control plane: - Default-disabled access: local private Goals never connect to remote authority or leak local credentials. - Opt-in gateway metadata projection for explicitly configured goals and the 'loopx-quality-review' canary. - Fail-closed should-run health check when remote authority is unconfigured or unreachable. 3. Conformance and unit test coverage across TypeScript and Python suites. Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * test(coordination): assert subprocess readback before decoding Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * fix(coordination): qualify explicit remote task reads and lifecycle receipts Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * fix(coordination): preserve existing successors on remote completion Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * test(remote-authority): prove ordinary admission stays local Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * test(chat): preserve create-only intent in workspace selection smoke Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Defer material inventory during configuration discovery (#8807) Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Defer report providers during Turn reads Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * test(core): require installed provenance before qualification Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Reuse the final source check for staged Turn requests (#8820) Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Defer PR wait provider loading until permission is checked (#8821) Load the optional PR reconciler only after the invocation-time observation permission check, inside the existing provider failure boundary. Preserve original permission, cadence, result and unknown-effect owners, and document the bounded default-closure and timing-window change. Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Load provider options only for the selected capability editor (#8822) Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * docs: describe README session continuity directly (#8823) * Skip automatic usage observers for supported opt-outs (#8824) * Skip automatic usage observers for supported opt-outs Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Record installed Core and C1 observer qualification Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> --------- Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * docs(blog): add EdgeBench controlled Context ON vs OFF 10-task score comparison (#8760) * docs(blog): add EdgeBench controlled Context ON vs OFF 10-task score comparison Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * docs(blog): use declarative mechanism-led opening in zh context-delivery score section Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * fix(heartbeat): preserve proven waits before their due time (#8825) Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Fix manager discovery in ordinary installs (#8830) * Package the manager discovery projection Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * Record selected manager discovery distribution qualification Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> --------- Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * test(workspace): verify confirmed Goal creation against the current contract (#8816) Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Fix Windows CLI output probe reader invocation (#8817) Port the probe fixture and native Windows regression coverage from e6eb92d and 8d200aa. Decode the generated PowerShell literals into argv before launching the pinned reader. Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * refactor(issue_fix): fold reviewer source trust/freshness vocabularies into one owner (#8826) reviewer_recommendation.py restated the trust and freshness sets that repository_context.py already owns. Import both as aliases of the owner objects so the decision has a single source, and add an architecture guard that pins single ownership by value, by identity, and by wiring through both public builders. REVIEWER_SOURCE_KINDS stays local (deliberately narrower). Signed-off-by: psychologister <230141834+psychologister@users.noreply.github.com> Co-authored-by: psychologister <230141834+psychologister@users.noreply.github.com> * fix(scheduler): reject superseded heartbeat receipts on the Python follow-up route (#8708) * fix(scheduler): reject superseded heartbeat receipts on the Python follow-up route The Python compatibility route for scheduler-ack-current/scheduler-fail-current checked only that the receipt for --turn-instance-id exists; a receipt already superseded by a newer heartbeat Turn still committed scheduler state, while the native TypeScript transaction rejects it as heartbeat_receipt_stale. Thread the Turn from build_scheduler_followup_payload through record_quota_scheduler_ack / record_quota_scheduler_ack_for_decision / record_quota_scheduler_failure_for_decision into _run_native_followup, which now sends turn_instance_id with require_heartbeat_receipt=true. The TypeScript transaction remains the single owner of the missing/stale/superseded fence (it also rechecks under the scheduler state lock); optional parameters keep the in-process API, which has no Turn, unchanged. Fixes #8605 Signed-off-by: Lihua <1017343802@qq.com> * Keep scheduler follow-up hint reads out of legacy migration Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: Lihua <1017343802@qq.com> Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Co-authored-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Resume the original quota settlement after lifecycle writeback (#8728) * fix(replan): resume settlement after lifecycle review writeback Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Recover committed replan settlement before rebuilding its review Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * fix(antigravity): keep the project registry in generated wakes (#8768) Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * fix(chat): keep workspace checker reads portable (#8814) Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Reject external Turn retries when the captured work changes (#8828) * Recheck captured work before launching an external Turn host Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Keep complete-source metadata assembly outside Turn planning Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Preserve PostgreSQL runtime access and recover seed output retries Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Validate recovery cursor metadata without a fixed history ceiling Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Signed-off-by: psychologister <230141834+psychologister@users.noreply.github.com> Signed-off-by: Lihua <1017343802@qq.com> Co-authored-by: Lusen Dong <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> Co-authored-by: Lusen Dong <cicomaple@gmail.com> Co-authored-by: psychologister <st040325@gmail.com> Co-authored-by: psychologister <230141834+psychologister@users.noreply.github.com> Co-authored-by: Lihua <1017343802@qq.com>
Goal And Delivered Outcome
A Codex App heartbeat could admit a second execution of a Todo while the original Turn still owed a debit for an autonomous replan. The guard and explicit Todo selection now return the original settlement command before allowing the next Turn. That command accepts the original slot count and source before first debit, missing-receipt repair or completed replay. Exact concurrent retries return the original result, and the next guard can admit the Todo after settlement.
This is the shared mainline fix for prior Turn recovery and the changed spend request.
Author Declaration
Scope And Continuation
This repair is independently reviewable on main. It reuses the original guard and accounting owners. Historical readback remains available; a missing receipt can be repaired only when the original debit is verifiable.
Validation
Revision
de44c3e5db7642f4926587db040a4fb8a53669b6checked againstmain@6dfd1c90c4c1. All fixtures are synthetic.tests/control_plane_ts/coordination_runtime_shadow.test.ts:380; that file is unchanged from the target. Native Windows and signed-in desktop validation remain unrun at this revision.Frontend / Visual Evidence
UI impact: none. The existing guard presents the original recovery action and accounting refusal.
Boundary Checklist