feat: sync auto-next obligation gate hardening

This commit is contained in:
2026-04-24 16:41:48 +08:00
parent 7c362dedf8
commit cb34935b28
9 changed files with 741 additions and 155 deletions

114
README.md
View File

@@ -2,78 +2,102 @@
## 中文說明
這個 repo 是從較大的 OpenClaw workspace 中抽出的焦點工作流成果,主題是
這個 repo 目前聚焦兩條與 continuity 直接相關的成果
- **approved plan continuity hard-gate**
- **dispatch receipt binding**
- **anti-blackhole / completion-delivery watchdog groundwork**
- **auto-next obligation gate**
目標是避免兩類問題持續發生
目標是避免以下兩種 failure
1. **continuity failure / auto-next break**
2. **subagent anti-blackhole / fake timeout**
- 任務已完成
- 下一步已知
- 但沒有真的 dispatch 下一顆 task
- 流程卻還是被當成正常收尾
2. **task-boundary stop / 口頭續跑**
- 同一份 approved plan 內其實應該 auto-next
- 但主代理停在 task boundary
- 用 checkpoint / 口頭回報 / session metadata 取代真正 dispatch
## 目前已完成
### A. Continuity hard-gate
- continuity evaluator
- dispatch receipt binding groundwork
- `derivedAction` continuity binding
- receipt validator 最小欄位驗證
- `derivedAction` / `nextDerivedAction` 納入 continuity 判定
- `dry_run_dispatch` 不得冒充真 receipt
- fake receipt authority 最小收緊
- hook integration 已接入
- fake receipt 不得放行
- hook integration 已接入 `hooks/force-recall/handler.ts`
### B. Anti-blackhole watchdog recovery
- watchdog status recompute
- 最小 recovery decision 閉環
- `fetch_history`
- `respawn`
- `blocked`
- owner-visible reporting payload
- scenario matrix tests
### B. Auto-next obligation gate
- 新 failure reason`missing_auto_next_dispatch`
- 同一份 approved plan 中,若
- 當前 task 已完成
- 下一顆 task 已知
- `sameApprovedPlan=true`
- `taskBoundaryStop=true`
- `waiting_user` / `blocked` / `pending_verification`
-`highRiskStop`
- 且沒有真實 next dispatch receipt
- ⇒ 直接 fail不得停在 boundary 等主人再說「繼續」
- receipt linkage hardeningreceipt 現在要對到要求的 next-task handoff而不是只要存在就算過
- 新增最小 linkage 欄位:`nextTaskId`
- checkpoint / session metadata / stale receipt / dry-run planner intent 不得冒充 auto-next dispatch proof
## 驗證狀態
- `node scripts/test_approved_plan_continuity_gate.mjs``17 passed / 0 failed`
- `node scripts/test_force_recall_long_task_preflight.mjs` → PASS
- `node --check hooks/force-recall/handler.ts` → PASS
- `node --check scripts/approved_plan_continuity_gate.mjs` → PASS
- `node --check scripts/approved_plan_dispatch_binding.mjs` → PASS
## 目前限制
- continuity 仍偏 prompt-level hard-gate integration
- watchdog recovery 目前驗收的是 decision / reporting / test slice不是 live integration
- 目前仍主要鎖在 continuity / force-recall 路徑,不是所有 entry points。
- `sameApprovedPlan` 的上游證據仍可再更硬。
- continuity plugin MVP 仍在後續產品化中,尚未整理成可直接讓其他 OpenClaw 安裝的插件包。
## 下一步建議
1. continuity runtime enforcement hardening
2. watchdog live recovery integration
3. escalation / receipt contract hardening
## 下一步
1. continuity 收尾覆核
2. 回到 continuity plugin MVP
3. 把目前 continuity 內核抽成可安裝、可設定、可測試、可依雙語 README 套用的插件 MVP
---
## English Description
This repository is a focused export from a larger OpenClaw workspace covering:
This repository currently focuses on two continuity-related hardening slices:
- **approved plan continuity hard-gate**
- **anti-blackhole / completion-delivery watchdog recovery**
- **auto-next obligation gate**
It prevents two core failure classes:
1. **continuity failure / auto-next break**
2. **task-boundary stop disguised as progress**
## Current State
### A. Continuity hard-gate
- continuity evaluator
- dispatch receipt binding groundwork
- `derivedAction` continuity binding
- `dry_run_dispatch` no longer accepted as a real receipt
- fake receipt authority tightened
- hook integration present
- minimum receipt validation
- `derivedAction` / `nextDerivedAction` continuity handling
- `dry_run_dispatch` rejected as real receipt
- fake receipt rejected
- hook integration in `hooks/force-recall/handler.ts`
### B. Anti-blackhole watchdog recovery
- watchdog status recompute
- minimal recovery-decision loop:
- `fetch_history`
- `respawn`
- `blocked`
- owner-visible reporting payload
- scenario matrix tests
### B. Auto-next obligation gate
- explicit failure reason: `missing_auto_next_dispatch`
- task-boundary stop is now treated as continuity failure when same-plan auto-next is obligatory
- receipt linkage hardening via `nextTaskId`
- checkpoint / session metadata / stale receipt / dry-run intent can no longer stand in for real auto-next dispatch proof
## Validation
- continuity gate tests passing
- force-recall preflight passing
- syntax checks passing
## Current Limitations
- continuity remains prompt-level rather than engine-level
- watchdog recovery is validated as a decision/reporting/test slice, not live execution integration
## Suggested Next Steps
1. continuity runtime enforcement hardening
2. watchdog live recovery integration
3. escalation / receipt contract hardening
- scoped mainly to the continuity / force-recall path
- upstream `sameApprovedPlan` evidence can still be hardened further
- plugin packaging is still pending