Skip to content

fix(replan): accept a same-second whole-second historical ACK - #8804

Merged
huangruiteng merged 5 commits into
mainfrom
cursor/historical-ack-same-second-fence-f02e
Nov 16, 2026
Merged

huangruiteng merged 5 commits into
mainfrom
cursor/historical-ack-same-second-fence-f02e

Conversation

@Duang777

@Duang777 Duang777 commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

  • Outcome basis / optional anchor: self-found residual fence in historical ACK recovery after the same-second review-bound successor fence in fix(replan): treat same-second review-bound successors as post-admission #8731. No issue is claimed or closed. This is a self-found residual fence, and it was not taken from an issue list. A whole-second run clock cannot order writes inside the admission second. A Todo-bound refresh stores the obligation on the accepted semantic delta. A historical index can also omit the Todo and effect, and an empty comparison must not adopt another Todo's event.
  • Goal/source and gap: historicalAckDelta() keeps an exact durable ACK for the original receipt-bound Turn. Same-second recovery uses the original refresh_state event. That event must positively match the accepted obligation, or its Todo and settlement effect must equal the ACK receipt. When the index omits those fields, the ACK turn's existing heartbeat receipt supplies them. An event with no identity, or a different Todo and effect, stays pending.
  • Observable before → after, with the validation row that proves it: a later whole second still settles through the precise path. A same-second Todo-bound ACK settles when the CLI event's time and log position are both after admission and its Todo receipt matches. Stripping the index identity still settles when the heartbeat receipt fills the same Todo and effect. Replacing that event's Todo and effect, or clearing obligation, Todo, and effect, leaves the original Turn pending and spends nothing. File and SQLite agree. An earlier time or a conflicting time/log pair also stays pending.
  • Issue/task and intended base: Related to fix(replan): treat same-second review-bound successors as post-admission #8731. Base is main at f3bdad2387397e078fbc887e7cb7ed80adaf7510. This PR does not close fix(replan): treat same-second review-bound successors as post-admission #8731.

Author Declaration

Implemented against

  • Specification and revision: no written specification; the request in this PR is the basis, corrected by the reviews on this PR. The precise generated > admitted path stays. Same-second recovery requires a positive writeback identity plus time and log order.
  • Criteria:
Criterion (spec clause) Disposition Symbol / path Test or command
A generated_at strictly later than admission still settles the original receipt-bound Turn implemented historicalAckDelta tests/control_plane_ts/replan_semantics.test.ts; test_exact_later_ack_executes_original_todo_settlement_commands
A same-second Todo-bound ACK settles only when time and log position are both after admission and the Todo receipt matches implemented _writeback_event_is_bound in loopx/control_plane/work_items/autonomous_replan_ack.py test_same_second_historical_ack_requires_writeback_after_admission
A sparse index is filled from the ACK turn's heartbeat receipt; a different Todo or effect, or an event with no identity, stays pending implemented _expected_todo_receipt receipt_fill, foreign_todo, and blank_identity on File and SQLite; test_same_second_candidate_keeps_the_todo_bound_writeback_order
The writeback qualifier calls the shared reader implemented qualify_replan_writeback maintainability ratchet reports no oversized decision function
  • Self-check before submission: read the latest review; required a positive obligation or Todo-receipt match; filled missing index fields from the heartbeat receipt; ran the commands in Validation. now_local() precision and compact generated_at are unchanged.

Scope And Continuation

  • Completed scope and remaining work: same-second historical ACK recovery now requires a positive writeback identity, then time and log order. Complete within this scope.
  • Slice boundary / successor: N/A.

Validation

  • Tested revision: d2b7ece8f9415f2046028a615e6894aaa27d0be8
  • Run state: finished
  • Input classes: synthetic
Check kind Result Public-safe evidence / limitation
unit passed python3 -m pytest -q covering the Todo-receipt unit test, test_replan_semantics_transport.py, the same-second CLI orders, and the later-second CLI recovery — 26 passed, exit 0. uv is not installed here; pytest 9.2.0 ran against this checkout.
real_entrypoint passed The same-second CLI orders include after, receipt_fill, foreign_todo, blank_identity, before, and both time/log conflicts, on File and SQLite. The event comes from Todo-bound refresh-state. after and receipt_fill write back and spend one slot. The other orders do not.
static passed collect_oversized_decision_functions returns no findings.
static not_applicable No paired RFC changed in this fence. The earlier TypeScript behavior test remains 36 passed; this commit does not change that fence.
  • Coverage and gaps: receipt_fill drops Todo and effect from the index and still settles through the heartbeat receipt. foreign_todo and blank_identity stay pending. A refresh without autonomous_replan_recorded still cannot supply the order.

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

  • Production-scale fixture schema: N/A
  • Semantic dimensions changed, or reviewed no-impact rationale: N/A
  • Provider conformance arms run: N/A
  • Read-only legacy/file/PostgreSQL three-arm rehearsal (required for promotion, runtime-routing, or compatibility-projection changes): N/A

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).

The unchecked scope box is intentional: there is no linked issue. The change is limited to this residual historical ACK fence.

Remaining risk

Same-second recovery needs one positive identity: the event obligation equals the accepted semantic delta, or the event's Todo and effect equal the ACK receipt. A missing index identity is filled only from that turn's heartbeat receipt. If neither the event nor that receipt can prove the same writeback, the obligation stays pending. A strictly later generated_at still settles without the event. Time and log position must both be after admission.

Open in Web Open in Cursor 

historicalAckDelta still required generated > admitted at microsecond
precision. Compact generated_at is the whole-second run clock, while
admission guard_recorded_at is often fractional inside that second, so
an exact later ACK was dropped and the original receipt-bound Turn
stayed unsettleable.

A whole-second stamp at or after the admission second is post-admission.
A fractional stamp still has to be strictly later than the admitted
instant. Earlier fractions and the previous whole second stay rejected.

Signed-off-by: Duang777 <duangjl007@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.1-sol · OpenAI · runtime_reported · reasoning_effort=max

评审提交 0001e94d008a3249555350819b7fd583d359129a。原差异基点 b46a76d2d64b3c14877bdf288953c56ae1c7793b。

动机 / Motivation

在同一 Goal 和 Agent 下恢复带有历史 replan ACK 的原 Turn,包括 Codex heartbeat 及相同结算入口的调用方。 原比较要求 ACK 的 run 时间晚于准入 receipt。run.generated_at 只保留整秒,导致同秒且确实在准入后写入的 ACK 也被拒绝。 在隔离 File 和 SQLite 状态中,通过真实 CLI 取得原准入回执,回放同一 obligation 的另一 Turn 的已接受 ACK。保持 run 的整秒时间相同,分别把带微秒的写回事件放在原准入前后,核对真实写回与扣额。 候选恢复了确实较晚的同秒 ACK,也放行了确实较早的同秒 ACK。两个 provider 中,较早 ACK 都使原 Turn 进入 historical_ack_recorded,写回原 receipt 并实扣一格。基线对此均保持待结算。 覆盖两版源码 CLI、真实 File/SQLite 入口和隔离历史回放。并发顺序由 fixture 控制。托管 CI、已安装版本和其他 provider 尚待验证。

改动思路 / Approach

由现有历史 ACK 读取器验证匹配的原始写回证据,将可比较的事件顺序交给同一个 TypeScript 决策 owner。继续复用现有身份、类型、结果和原结算 receipt。 历史 ACK 的默认时间边界扩至原准入所在的整秒,并由原有 receipt 恢复链传到写回与扣额。 让秒级投影提供候选时间范围,由原始写回顺序证明同秒前后。一个共享的 TypeScript 决策足以服务恢复入口。 范围为历史 ACK 与原 receipt 的结算条件。#8731 留有独立的 successor lifecycle 路径。 维持另一 Turn、跨日期/偏移和较晚整秒用例,加入同一秒内物理顺序相反的正反对照。

具体改动 / Changes

实际差异两个文件,新增 51 行、删除 21 行。生产改动集中在既有 TypeScript owner 的时间判断,其他变更在 replan 行为测试。 historicalAckDelta 将准入时间向下取整,整秒 ACK 由严格晚于原准入改为大于等于准入整秒。含小数秒的 ACK 继续作精确比较。候选筛选依旧核对身份、义务和结果类型,生成的结算命令沿用原 receipt。 验收约定

关键代码讲解

  • 压缩历史 ACK 时转发 run.generated_at。 compact_autonomous_replan_ack

  • 按原准入回执取历史候选。 load_receipt_replan_ack_candidates

  • 校验历史 ACK 的时间和语义。 historicalAckDelta

  • 还原原准入绑定的义务与写回合同。 preserveReceiptBoundObligation

  • post-admission-ack。恢复确实在准入后写回的匹配 ACK。 两种 provider 的确实较晚同秒 ACK 在候选中写回且仅扣一格。

  • chronological-order。同秒 ACK 仍需证明实际写回晚于准入。 当历史写回早于原准入一微秒且两者在同一秒时,compact generated_at 与确实较晚的写回相同。候选在 File 和 SQLite 都接受前者并允许真实写回和扣一格。测试把整秒相等直接当作事后证据,未提供能区分两种顺序的输入。

  • original-settlement-identity。只恢复原匹配义务,并保留一次扣额。 较晚 ACK 的重复调用只返回 replay。错误 Agent 或 obligation 保持待办。

对主干的风险 / Risks

[P2] 同秒且早于准入的历史 ACK 可使原 Turn 结算。 匹配 Goal、Agent 和 obligation 加上另一个 Turn ID,只能限定候选身份。现有整秒投影丢失了实际顺序。把已接受写回的事件时间和账本位置分别设在原准入前后,候选对两者都输出 historical_ack_recorded。真实 CLI 随后写回本应待办的原 Turn 并实扣一格,File 和 SQLite 结果相同。精确重放只扣一次,首次误扣仍然成立。请在同秒分支使用与 ACK Turn 绑定的原始持久化事件顺序,加入写回在准入前后的两条对照。 时间判断

实际 CLI 在 File 与 SQLite 上各复验四种物理账本顺序,并另外核对 早于准入的小数秒、错误 Agent 和错误 obligation。TS 相关测试两版各 190 通过,候选 Python 85 通过,premerge 四项直接、13 项选定通过。单跑全量 Control Plane typecheck 时,两版都报同一处未改动的 TS2345。

语义与 CI 对齐

这里复用既有 ACK、义务和原 receipt。文档约定 freshness 保留微秒,并保持原 Turn 的写回和扣额绑定。确认了晚一整秒与身份拒绝对照,新增的同秒判断仍需覆盖早写回复用原 receipt 的回归用例。

我的整体评价 / Verdict

REQUEST_CHANGES。 请让恢复依据真实写回顺序,证明同秒的早写回保持待结算、晚写回可完成,再复验两种 provider 的原 receipt。 受影响入口是历史恢复、写回与扣额,验证覆盖原 Turn 的 CLI 读回。

English verdict: REQUEST_CHANGES at 0001e94. The change recovers genuinely later same-second ACKs, but it also admits ACKs durably written before admission. On both File and SQLite, the original Turn wrote back and spent one slot with that earlier ACK. Require provenance that preserves the actual order.

A whole-second generated_at cannot separate an ACK written before
admission from one written after it. Same-second recovery now requires
the original refresh_state event bound to the Goal, Agent, obligation,
and ACK Turn, with both its recorded time and log position after
admission. A generated_at that is already strictly later keeps the
precise path. Missing or conflicting order leaves the obligation pending.

Signed-off-by: Duang777 <duangjl007@gmail.com>
Signed-off-by: Duang777 <duangjl007@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.1-sol · OpenAI · runtime_reported · reasoning_effort=max

评审提交 690d90492a89c973c6c7ad3a2650342689270702。原差异基点 f3bdad2387397e078fbc887e7cb7ed80adaf7510。

动机 / Motivation

另一个 Turn 已对同一项重规划完成有效写回时,恢复原 Todo 的 Agent 应能直接结算原回执。 在隔离的 File 和 SQLite Goal 中,用真实 CLI 生成 Todo 绑定的 ACK。保留写回事件字段,用同秒内前后一微秒重放,再读取原准入回执。 旧的早写回误扣已被封住。真实的较晚同秒写回仍报 heartbeat_receipt_identity_conflict。只给重放对照补上义务 ID,同一条路径就能写回、扣一格并幂等重试。 验证覆盖源码 CLI、File 和 SQLite。写回字段由实际命令产生,回放控制时间与账本位置。宿主安装和远端 CI 尚未核验。

常规 Todo 绑定事件需要可验证的义务来源,且当前写回函数触发了主干维护性门禁。

改动思路 / Approach

读取与 ACK Turn 对应的原始写回事件,再由现有决策函数验证微秒和日志位置。判断通过后才生成原回执的写回与扣额命令。 保留一个读取者和一个时间决策 owner。新增的读取与绑定逻辑留在共享入口,写回资格函数仅消费所需事实。 现有 Todo 与纯 replan 结算入口、原回执身份及顺序判断。

具体改动 / Changes

严格晚于准入的旧时间路径保持有效。整秒相同时,新增路径同时检查写回微秒、账本顺序和原作用域。 7 个文件,+295/-24。生产 +126/-4,测试 +169/-20。 回归用例向事件手工写入了义务 ID。 上一轮评审 验收约定

关键代码讲解

  • 真实 Todo 绑定的 refresh-state 产生 ACK 和事件。 refresh_state rollout

  • 查找同 Goal、Agent、Turn 和义务的写回。 _original_writeback_event_index

  • 同时检查写回微秒与账本顺序。 historicalAckDelta

  • 写回阶段再次加载事件并派生候选。 qualify_replan_writeback

  • post-admission-ack。晚于原准入的匹配 ACK 可恢复原 Turn。 Todo 绑定的 CLI 把实际义务记录在已接受的语义增量中,rollout 事件的 replan_obligation_id 为 null。新读取器因此丢掉合法写回顺序,两种 provider 的原 Turn 均无法进入结算。

  • chronological-order。保留原始顺序并拒绝无法证明的写回。 较早同秒与时钟和日志次序冲突的测试均被拒绝。

  • original-settlement-identity。恢复继续绑定原回执,重复调用至多扣一格。 更晚整秒路径与补齐义务 ID 的对照均恢复同一原身份。后者真实写回并幂等扣一格。

对主干的风险 / Risks

[P2] 真实 Todo 写回无法通过同秒 ACK 恢复。 Todo 绑定的 CLI 把实际义务记录在已接受的语义增量中,rollout 事件的 replan_obligation_id 为 null。新读取器因此丢掉合法写回顺序,两种 provider 的原 Turn 均无法进入结算。 两个 provider 都返回 heartbeat_receipt_identity_conflict。在对照里补上事件义务 ID,两个 provider 均用原回执写回并幂等扣一格。请沿真实的 ACK 与原写回身份关联证据。 读取条件 · 生产事件

[P2] 标准 premerge 失败。 主干的 maintainability ratchet 通过;候选首次报告 qualify_replan_writeback 为 oversized_decision_function,标准 premerge 失败。 建议将候选与写回事件关联放回共享读取边界。 新增分支

本地 60 项 Python、280 项 TypeScript、控制面 typecheck、Ruff、双语 RFC 检查与合并树通过。标准 premerge 复现 1 项相对主干新增失败。

语义与 CI 对齐

保持原回执身份与幂等扣额。我对正向用例分别只改写回的顺序和仅补测试所需的义务字段。覆盖报告保留未复验的安装宿主与远端 CI。

我的整体评价 / Verdict

REQUEST_CHANGES。 请补齐 Todo 绑定写回的证据关联,并恢复维护性检查。复验时由实际 CLI 生成同秒写回事件,分别断言早写回拒绝和晚写回成功。

English verdict: REQUEST_CHANGES at 690d904. A real Todo-bound refresh leaves the rollout obligation field empty. File and SQLite both reject the genuinely later same-second ACK and cannot settle the original Turn. Bind that event through the existing Todo receipt, and extract the shared evidence read to restore the maintainability check.

A Todo-bound refresh records the obligation on the accepted semantic
delta and leaves replan_obligation_id empty on the rollout event.
Match that event by the Todo settlement receipt, and keep the time
and log-order checks. Historical events that omit the field still
bind when the receipt agrees. The writeback qualifier calls the
shared reader instead of loading events itself.

Signed-off-by: Duang777 <duangjl007@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.1-sol · OpenAI · runtime_reported · reasoning_effort=max

评审提交 c0902e53161a09e00d35e28c9856362f0fbb6098。原差异基点 f3bdad2387397e078fbc887e7cb7ed80adaf7510。

动机 / Motivation

恢复待结算 Todo 的 Agent,需要确定同一重规划义务确实已由另一个 Turn 在准入后写回。 用真实 CLI 写出 Todo 绑定的历史 ACK,在 File 和 SQLite 的隔离重放中对照同秒早晚写回、完整身份与缺失身份。 真实的较晚同秒写回现在能用原回执结算一次,较早写回保持待办。若历史索引丢了原 Todo 与结算 effect ID,另一个事件填入不同的 Todo 和 effect ID 仍会被采纳,导致实际写回并扣一格。 验证覆盖源码 CLI、File、SQLite 和受控历史重放。生产记录由真实命令生成,回放用来控制时间、顺序与字段缺失。安装宿主和远端 CI 待验证。

写回事件和历史 ACK 需要一项可验证的共同身份,缺失身份的兼容分支仍未达到这项约束。

改动思路 / Approach

读取器从实际 ACK 的语义增量确定候选义务,从同一写回事件找时间。TypeScript 在原回执结算前同时校验时间与日志位置。 写回资格函数已通过共享 helper 恢复维护性。继续保留单一读取入口,并在事件匹配处补齐正向身份门槛。 本次处理历史 ACK 与原 Turn 的结算恢复,保持其既有状态、作用域和一次扣额。

具体改动 / Changes

相对主干 7 个文件,+383/-27。生产 +184/-7 和测试 +199/-20。相对上一轮 4 个文件,+163/-78。 同秒 ACK 使用原始写回事件与账本顺序,覆盖 Todo 绑定的写回。 已修复上一轮实际 Todo 写回失败及维护性门禁。 上一轮评审 验收约定

关键代码讲解

  • 真实 Todo 写回把义务 ID 留在语义 ACK,事件携带 Todo 与 effect。 refresh_state rollout

  • 对照已保存的 Todo/effect 与写回事件。 _todo_receipt_matches

  • 维护微秒和账本顺序门槛。 historicalAckDelta

  • 复用候选读取器,维持原写回规则和维护性门。 qualify_replan_writeback

  • post-admission-ack。真实较晚同秒的 matching Todo ACK 能恢复。 两库都完成原写回、一次扣额、幂等重试。

  • chronological-order。保持早写回和不明确顺序待办。 两种 provider 的较早同秒和时间/日志冲突未结算。

  • original-writeback-binding。时间必须来自与 ACK 对应的原始写回。 both-present 比较会把缺失候选身份当作匹配。历史 ACK 缺少 Todo 和 effect ID、事件带不同 Todo 和 effect ID 时,写回仍被采纳。事件自身三种关联字段均空时,同样进入结算。

对主干的风险 / Risks

[P2] 缺少绑定的历史 ACK 仍可用不同 Todo 的事件结算。 隔离重放中的旧历史 ACK 保留已接受义务,但缺 Todo 与 effect ID。提供另一 Todo 和 effect 的同秒刷新事件后,File 和 SQLite 均把它当成来源,沿原回执写回并扣一格。完整字段对照拒绝。 另一组重放把事件的义务、Todo 和 effect 三项身份都留空,也完成了同一原结算。请在这个分支要求正向身份匹配。 匹配分支

本地 60 项 Python、280 项 TypeScript、控制面 typecheck、标准 premerge 与合并树通过。原维护性 ratchet 失败已修复。

语义与 CI 对齐

原始身份完整时,错 Agent、错义务、错 Todo、错 effect 和较早同秒均保持待结算。真实 receipt_repaired 记录的 ACK 标记为 false。缺字段不能靠比较未发现冲突产生结算权限。

我的整体评价 / Verdict

REQUEST_CHANGES。 已复验真实 Todo 正例和维护性检查。请让缺字段的历史记录从可核验原回执补齐身份,再用同一真实入口复验两个 provider 的可信写回与拒绝。

English verdict: REQUEST_CHANGES at c0902e5. A real Todo-bound ACK now settles successfully, and the maintainability check is repaired. A sparse historical ACK is still matched to a same-second event with a different Todo and settlement effect. Both File and SQLite committed the original writeback and one debit in that replay. Require a positive binding.

A historical index can omit the Todo and effect. An empty comparison
then accepted a same-second refresh for a different Todo. Bind only
when the event obligation equals the accepted semantic delta, or its
Todo and effect equal the ACK receipt. Fill a missing index identity
from that turn's heartbeat receipt. An event with no identity stays pending.

Signed-off-by: Duang777 <duangjl007@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.1-sol · OpenAI · runtime_reported · reasoning_effort=max

评审提交 d2b7ece8f9415f2046028a615e6894aaa27d0be8。原差异基点 f3bdad2387397e078fbc887e7cb7ed80adaf7510。

动机 / Motivation

Todo 已在另一个 Turn 完成重规划时,接续工作的 Agent 需要用正确的历史写回结算原回执。 从真实 CLI 取得已接受的 Todo ACK 以及原写回和准入事件,再按相同整秒分别重放有效写回、早写回、错 Todo/effect 和空身份。在 File 和 SQLite 验证实际结算。 错误和空身份都保持待结算,净扣额为零。历史索引缺字段时,若原准入能补出匹配的 Todo 和 effect,两种后端都用原回执完成写回和一次扣额,重复调用无额外扣额。 验证使用源码 CLI、File、SQLite 和控制时间顺序的合成历史。安装宿主与远端 CI 待验证。

本次批准覆盖当前原回执恢复切片。

改动思路 / Approach

已有写回读者负责把事件关联到明确的原候选。TypeScript 再比较微秒时间与账本顺序,恢复时使用现有写回与扣额命令。 Python 写回资格和 quota guard 共用已知候选读者。时间判断仍只由现有 TypeScript owner 作出。 本轮只验证历史 ACK 恢复和原回执的结算、重试。

具体改动 / Changes

相对主干 7 文件、+473/-27。生产 +220/-7,测试 +253/-20。最新提交 3 文件、+117/-27。 当整秒不能证明晚于原准入时,事件要匹配义务,或者匹配 Todo 与 effect。缺失索引身份时,从同一 ACK Turn 的准入记录取回这两项。TypeScript 同时核对写回时间和日志先后。 上一轮评审 验收约定

关键代码讲解

  • 缺字段的历史索引从同一写回 Turn 的 quota 准入记录补出身份。 _expected_todo_receipt

  • 匹配真实事件的义务,或比较 Todo 与 effect。 _writeback_event_is_bound

  • 核对微秒与日志的顺序。 historicalAckDelta

  • matching-writeback。同秒时写回身份必须与已接受 ACK 对应。 错 Todo/effect、空身份与稀疏历史中的错绑定未进入结算。

  • post-admission-order。写回时间和日志位置在原准入之后。 早同秒拒绝,晚同秒和晚一整秒恢复。

  • original-settlement。原回执幂等结算,历史字段可从正向来源读取。 File、SQLite 的真实与稀疏历史形状均写回并只实扣一格。

对主干的风险 / Risks

最容易误收的是旧索引缺字段而写回事件又来自其他 Todo 的场景。现在拒绝错绑定和全空身份,原回执保持待办。同源旧回执仍能补证和完成结算。已安装宿主及生产历史规模属于本次观察范围之外。

本地 66 项 Python、280 项 TypeScript,以及 typecheck、Ruff、标准 premerge 和合并树检查通过。

语义与 CI 对齐

可以证明晚于准入时,CLI 继续原回执。只有整秒时间相同,或只有相同 Turn 而缺实质绑定时,仍会显示待办。结果以实际写回和重试的账本读回为依据。

我的整体评价 / Verdict

APPROVE。 真实 Todo 写回和可以补证的历史记录均沿原身份结算一次。此前可错接另一笔写回的两种历史形状在本轮均保持待结算。

English verdict: APPROVE at d2b7ece. The real Todo-bound path and sparse legacy history now recover only with positive binding and proven order. Wrong Todo, effect, agent, obligation, and blank events do not spend. Valid File and SQLite replays write back and debit their original Turn exactly once.

@huangruiteng
huangruiteng merged commit 4846781 into main Nov 16, 2026
39 of 50 checks passed
@huangruiteng
huangruiteng deleted the cursor/historical-ack-same-second-fence-f02e branch November 16, 2026 04:43
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