修复残留问题 #192

Merged
kdletters merged 5 commits from feat/five_min_design into master 2026-08-25 14:27:31 +08:00
Owner

agent.db 是纯 append、全仓没有 rotation,而有界尾窗的记录数上限(16384)比写侧
的扫描上限(100 万)低两个数量级。截断掐掉的永远是更旧的记录,所以「命中」与截
断无关;只有「没命中」时才真的分不清「没写过」和「没看见」。

  • plan_gdd_decision_audit_state_locked:截断判断从遍历前的无条件 Err 挪到遍历后、
    且只在没命中时报。原先任何写够记录的项目都会永久停在 needs-reconciliation——
    audit 明明就在窗口里,函数照样报错,文案还指向「identity 不一致」。
  • approval_terminal_observation_exists_locked:不再把截断位丢给 _。没命中且截
    断时返回 Err 而不是 Ok(false),交给调用方既有的具名 projection gap 分支,不再
    让一次视野缺失冒充恢复缺口被反复重放。
  • 收束闸 Err 分支标题改为「Fast GDD decision audit 无法确认」。Err 现在有 identity
    冲突和尾窗截断两种来源,具体原因由 detail 里的 error 原文给出。
  • AGENT_DB_MAX_BOUNDED_RECORDS 改 pub(crate),让回归测试能精确把 fixture 撑过截
    断线,不必在测试里埋魔数。

新增 truncated_tail_scan_still_confirms_records_inside_the_window 钉住这两处:把
任一处改回旧行为都会让它失败。

recovery_scan.rs 的七槽审计是同样的形状,但它断言的是精确基数而非存在性,截断确
实证不了基数,另行处理。

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

agent.db 是纯 append、全仓没有 rotation,而有界尾窗的记录数上限(16384)比写侧 的扫描上限(100 万)低两个数量级。截断掐掉的永远是更旧的记录,所以「命中」与截 断无关;只有「没命中」时才真的分不清「没写过」和「没看见」。 - plan_gdd_decision_audit_state_locked:截断判断从遍历前的无条件 Err 挪到遍历后、 且只在没命中时报。原先任何写够记录的项目都会永久停在 needs-reconciliation—— audit 明明就在窗口里,函数照样报错,文案还指向「identity 不一致」。 - approval_terminal_observation_exists_locked:不再把截断位丢给 `_`。没命中且截 断时返回 Err 而不是 Ok(false),交给调用方既有的具名 projection gap 分支,不再 让一次视野缺失冒充恢复缺口被反复重放。 - 收束闸 Err 分支标题改为「Fast GDD decision audit 无法确认」。Err 现在有 identity 冲突和尾窗截断两种来源,具体原因由 detail 里的 error 原文给出。 - AGENT_DB_MAX_BOUNDED_RECORDS 改 pub(crate),让回归测试能精确把 fixture 撑过截 断线,不必在测试里埋魔数。 新增 truncated_tail_scan_still_confirms_records_inside_the_window 钉住这两处:把 任一处改回旧行为都会让它失败。 recovery_scan.rs 的七槽审计是同样的形状,但它断言的是精确基数而非存在性,截断确 实证不了基数,另行处理。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lhk229 added 1 commit 2026-08-25 10:56:46 +08:00
尾窗截断不再被当成记录缺失,策划收束闸不会再永久停摆
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
db37f404e2
agent.db 是纯 append、全仓没有 rotation,而有界尾窗的记录数上限(16384)比写侧
的扫描上限(100 万)低两个数量级。截断掐掉的永远是更旧的记录,所以「命中」与截
断无关;只有「没命中」时才真的分不清「没写过」和「没看见」。

- plan_gdd_decision_audit_state_locked:截断判断从遍历前的无条件 Err 挪到遍历后、
  且只在没命中时报。原先任何写够记录的项目都会永久停在 needs-reconciliation——
  audit 明明就在窗口里,函数照样报错,文案还指向「identity 不一致」。
- approval_terminal_observation_exists_locked:不再把截断位丢给 `_`。没命中且截
  断时返回 Err 而不是 Ok(false),交给调用方既有的具名 projection gap 分支,不再
  让一次视野缺失冒充恢复缺口被反复重放。
- 收束闸 Err 分支标题改为「Fast GDD decision audit 无法确认」。Err 现在有 identity
  冲突和尾窗截断两种来源,具体原因由 detail 里的 error 原文给出。
- AGENT_DB_MAX_BOUNDED_RECORDS 改 pub(crate),让回归测试能精确把 fixture 撑过截
  断线,不必在测试里埋魔数。

新增 truncated_tail_scan_still_confirms_records_inside_the_window 钉住这两处:把
任一处改回旧行为都会让它失败。

recovery_scan.rs 的七槽审计是同样的形状,但它断言的是精确基数而非存在性,截断确
实证不了基数,另行处理。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lhk229 added 1 commit 2026-08-25 10:56:59 +08:00
Merge branch 'master' into feat/five_min_design
Project CI / Repository checks (pull_request) Failing after 5m26s
Project CI / Frontend tests (pull_request) Failing after 5m49s
Project CI / Backend tests (pull_request) Successful in 4m13s
Project CI / Native shell tests (pull_request) Failing after 3m40s
5c8d894c8a
lhk229 marked the pull request as work in progress 2026-08-25 11:27:01 +08:00
lhk229 added 1 commit 2026-08-25 11:56:36 +08:00
审批判据改走全量扫描,不再拿有界尾窗证明「不存在」
Project CI / Repository checks (pull_request) Failing after 4m24s
Project CI / Frontend tests (pull_request) Failing after 5m31s
Project CI / Native shell tests (pull_request) Failing after 5m50s
Project CI / Backend tests (pull_request) Successful in 7m5s
33ee790b92
上一版把尾窗的截断位改成 fail-closed,方向错了。这次连同它一起修掉根因。

新增 read_agent_db_records_matching:只读流式全量扫描,上限与写侧幂等扫描完全一致
(256 MiB / 100 万条)。读得到的范围从此等于写得进的范围,尾窗那道两个数量级的缺口
在这两条判据上不复存在。

- approval_terminal_observation_exists_locked 改走全量,恢复返回 Ok(found)。它在
  project_generic_submit_observation_locked 里是「这次是不是重放」的探针,首次审批时
  false 就是正确答案,紧接着才会去写 terminal observation。上一版在那里报 Err,`?`
  直接抛出,append_agent_db_terminal_observation_if_missing_for_action 永远到不了,
  调用方置 recoveryPending 后重试同构——审批永久停摆。而且 truncated 也会被崩溃残留
  的残缺末行置位,而有界读不修尾巴,所以任意大小的项目都能踩中。

- plan_gdd_decision_audit_state_locked 改走全量。它的过滤器只到 (gddId, version),
  比写侧幂等键 (gddId, version, responseId) 少一格,是故意的:同版本不同 responseId
  的两条 audit 写侧不拦、能共存,这里就是那个跨 responseId 的冲突检测器。上一版靠
  「命中即成立」跳过截断,等于让滑出窗口的旧冲突隐形,收束闸会错误放行。

用例改名 approval_judgements_scan_the_whole_agent_db_not_just_the_tail_window,把冲
突副本放在填充之前(窗口之外),并自检尾窗确实截断、副本确实在窗口外。两条改动分别
退回旧行为都会让它失败。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lhk229 added 1 commit 2026-08-25 13:01:23 +08:00
Merge branch 'master' into feat/five_min_design
Project CI / Frontend tests (pull_request) Failing after 4m5s
Project CI / Repository checks (pull_request) Failing after 4m14s
Project CI / Native shell tests (pull_request) Failing after 5m21s
Project CI / Backend tests (pull_request) Successful in 5m43s
48bdc2f01b
lhk229 marked the pull request as ready for review 2026-08-25 13:14:45 +08:00
kdletters added 1 commit 2026-08-25 14:27:18 +08:00
Merge branch 'master' into feat/five_min_design
Project CI / Repository checks (pull_request) Failing after 2m52s
Project CI / Frontend tests (pull_request) Failing after 3m34s
Project CI / Backend tests (pull_request) Failing after 4m26s
Project CI / Native shell tests (pull_request) Failing after 5m4s
5709a4a996
kdletters merged commit 31ebe4c78c into master 2026-08-25 14:27:31 +08:00
kdletters deleted branch feat/five_min_design 2026-08-25 14:27:31 +08:00
Sign in to join this conversation.