Skip to content

fix(goal): durable boundary gate stops crash-recovery turn inflation - #289

Merged
LeXwDeX merged 1 commit into
devfrom
fix/goal-scan-boundary
Aug 15, 2026
Merged

fix(goal): durable boundary gate stops crash-recovery turn inflation#289
LeXwDeX merged 1 commit into
devfrom
fix/goal-scan-boundary

Conversation

@LeXwDeX

@LeXwDeX LeXwDeX commented Aug 15, 2026

Copy link
Copy Markdown
Owner

修复 issue #285(F3:崩溃重启后启动扫描重复评估同一边界 → turns_used 通胀 + 重复续派)。

Fix

  • GoalState.Info 新增 last_judged_msgupdateAfterJudge(judged) 在 continue 提交时持久化被判定的 assistant 消息 id(同一 transition,原子)
  • afterIdle 扫描路径 durable 门:会话窗口仍终止于 last_judged_msg 时跳过再评估(崩溃前已判定+提交,无新进展)。live idle 永不触发此门——每次续派都会产生新 assistant 消息;resume/subgoal 编辑经 live 轮驱动,不走扫描
  • 崩溃落在「continue 提交后、续派首条 assistant 前」的窗口:门跳过(避免通胀+重复);丢失续派的恢复本就是 CONTEXT.md 注明的独立设计

Evidence(/tdd)

  • 红测先行(引用不存在的 judged 参数即编译红)→ 实现 → 绿
  • 新增两用例:边界未变 → judge 0 调用、turns 恒 1、无续派;边界已推进 → judge 1 调用、turns=2、续派发出
  • test/goal 105 pass / 0 fail;typecheck 干净;改动文件 lint 0 警告(净零增量)

issue #285 — after a crash, the boot scan could re-judge the exact boundary
the crashed process already judged and committed: evaluatedRevisions is
process-local, so both dedup gates let the stale boundary through, and
updateAfterJudge inflated turns_used and dispatched a duplicate continuation.

- GoalState.Info gains last_judged_msg; updateAfterJudge(judged) persists the
  judged assistant message id on every continue commit (same transition, atomic)
- afterIdle scan path: while the session window still ends on last_judged_msg,
  no new progress has landed — skip re-evaluation. Live idle events are never
  gated: each dispatched continuation produces a fresh assistant message, so
  the live path always judges a new boundary; resume/subgoal edits re-drive
  through live turns, not the scan.
- crash between continue commit and continuation dispatch: the gate skips
  (avoids inflation + duplicate); recovering the lost dispatch remains the
  separate explicit design noted in goal CONTEXT.md.

Tests (red-first): unchanged-boundary scan commits nothing (turns stay 1, judge
0 calls); advanced-boundary scan proceeds (turns 2, continuation dispatched).
@LeXwDeX
LeXwDeX merged commit 070babc into dev Aug 15, 2026
5 checks passed
@LeXwDeX
LeXwDeX deleted the fix/goal-scan-boundary branch August 15, 2026 22:38
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.

1 participant