立项策划:完成 M1B-2 GDD 提交与恢复

接入 plan.submit_gdd 原生工具及 exact planning Provider 绑定与结构化注入

实现 create-only GDD 提交点、索引 Markdown session 恢复与策划子 run 收口

补齐定向门禁与阶段文档记录,审批 receipt UI 和构建准入留待后续
This commit is contained in:
2026-08-14 14:23:58 +00:00
parent a17f725834
commit 27c3eb847a
56 changed files with 7978 additions and 339 deletions
@@ -1,5 +1,16 @@
# 决策记录
## 2026-08-14 M1B-2 实现合同收口:Provider binding、结构化注入与提交恢复边界
- **状态与基线**:`M1B-1` 已通过门禁并合入,作为 `.agent/planning/` storage 基线;`M1B-2` 工作包已在隔离分支通过本包门禁,当前待合回原分支。当前包接 `plan.submit_gdd`、exact planning Provider 请求身份、提交点和恢复;`gdd-approval` planning pending、审批等待、receipt、审批命令与 UI 继续属于 `M1C-1` 及之后。本状态只表示 M1B-2 工作包完成,不表示完整产品可交付。
- **binding 是有自指纹的 exact v1,不是可扩展 map**:`plan-provider-session-binding.v1` 在 `runId` 后固定包含 `rootAgentId`,并在 `requestContextFingerprint` 后以 required typed `fingerprint` 收尾;typed value 排除自身 fingerprint 但覆盖 `rootAgentId`,base Provider request ID value 同样在 `runId` 后覆盖 `rootAgentId`。`rootAgentId` 与末尾 fingerprint 是本次实现对委派根身份和 binding 自完整性的有意加固,不再称“额外字段”;缺失、重排、未知字段、重算不等或从当前状态补默认值都失败关闭。无 Goal 的唯一合法三元组是 `goalId=null / goalRevision=0 / goalSnapshotFingerprint=""`;Agent DB validator 不能先用通用非空 identity 门把这个合法空 fingerprint 拒掉。
- **四类请求共用同一 captured context**:exact planning 的 `tool-plan | final-reply | context-compaction | final-reply-context-compaction` 全部写 `game-creator-provider-request-lifecycle.v3`、同一 required binding 和同一 structured injection;只有 `tool-plan` 能产生 action、`game-creator-provider-action-batch.v4` 与 `plan.submit_gdd`,其余三类无 action batch。planning idle context compaction 因没有 active run/session captured context 而明确不支持、fail-closed。request-context 的 `composition` 与 `sourceKind` 都固定为现役 Prompt Bundle 值 `runtime`,不得把 durable source `agent-delegate` 复制进 `sourceKind`;MCP 固定为空且 planning builder 不读取项目 MCP catalog,避免“先读后清空”制造额外依赖或漂移。
- **structured injection 的 wire 冻结**:`plan-provider-structured-injections.v1` 顶层顺序为 `schemaVersion, clarificationRound, accumulatedAgentMillis, session, platformFacts, approvalObservation`;session 顺序为 `phase, decisionsSummary, prototypeValidationItems, latestSubmittedRef, lastDecisionRef`;平台事实复用固定 `PlanPlatformFacts`;approval observation 只能为 `null` 或现役 `tool, status, summary, detail` 四字段 strict 对象。canonical compact JSON 最大 64 KiB,以 dedicated user message 真正进入最终 `LlmRunRequest`:第一行 `AGC_PLAN_PROVIDER_STRUCTURED_INJECTIONS_V1`,第二行 JSON,无第三行与尾换行。同一第二行 JSON bytes 同时生成 `structuredInjections.wireBytes/wireSha256`,禁止重建另一份“语义相同”对象再摘要。
- **submit 的包内 policy 与 session 真相**:`plan.submit_gdd` 配为 `confirm` 时按 deny 失败关闭,不创建 M1B-2 无法消费的 generic confirmation;显式 deny 同样拒绝。输入的 decisions 先逐项严格匹配 source session 的完整前缀,之后只允许追加 `default_pending/default/round=0` 的默认决定,不能把未提问项伪造成用户已确认。
- **提交点不等于审批等待**:M1B-2 在 create-only GDD 提交点之后只重建 index、`game/fast_gdd.md` 与 session successor,再终止策划子 run/delivery;不创建 planning pending 或 waiting 投影。child terminal ensure 按原 action identity 可重入,task/event/delivery/Agent DB audit 各自幂等;delivery 必须发布后 exact 回读,未 durable 前不能先写 `recoveryPending=false` 的 committed audit。原 submit 在提交前已经建立的 generic `game-creator-pending-action.v5` standalone pending 与 v4 action batch 继续保留,供 M1C-1 receipt/terminal observation 按同 action identity 消费。standalone pending 保存 `providerBatchPlanUpdate`,使 pending-only 能精确重建完整 plan/planUpdate/batchId;batch-only 则补回同 identity pending。两枚 anchor 都在时严格对账;恰缺一枚且另一枚与 immutable GDD/frozen binding 严格匹配时确定性重建缺失投影;两枚都缺失、任一损坏或 identity 漂移时进入 reconciliation,不能只凭 GDD 猜完整 action/batch wire。双缺扫描覆盖 GDD commit 后、child finish 前且 Runtime `pendingToolAction=null` 的真实窗口,重复扫描不重复写 audit;已提交事实优先于其后的 repository/steer 漂移,同 action 只收口原投影、不生成新版本。
- **本包门禁结果**:四类 request 的 binding/lifecycle/wire、structured DTO 字段与 64 KiB 边界、`composition/sourceKind=runtime`、idle compaction 拒绝、submit 业务/身份拒绝、提交点前后恢复、同 submission replay 不增版本、index/Markdown/session/child terminal 断点,以及 generic anchors 双在/单缺/双缺/漂移矩阵均已有定向证据;范围匹配的 Rust 门禁、`cargo check --offline`、`cargo fmt --check`、`npm run check:encoding` 与 `git diff --check` 已通过。隔离分支尚待合入;审批 pending/receipt/UI/构建准入仍不在本包。
- 关联文档:`docs/technical/【技术方案】立项策划Agent(Fast GDD)-2026-08-10.md` 第 3、8.1、9、12、21、23.6、23.8 节。
## 2026-08-14 M1C-0:用户修订状态进入静态委派 lineage 分类
- 落地:`StaticDelegateContractStatus` 新增 `UserRevisionRequested`(serde durable 值为 `user-revision-requested`)。`static_delegate_lineage_counters` 现在按三类传播:`NeedsUserInput` 只增加 `clarification_round`;`UserRevisionRequested` 原样继承 `repair_depth` 与 `clarification_round`;其它状态继续按质量返工增加 `repair_depth` 并重置 `clarification_round`。