From 0be6c2d3ee72068a426e4e5bd320b7046be62260 Mon Sep 17 00:00:00 2001 From: weichen Date: Sun, 11 Oct 2026 05:15:49 +0000 Subject: [PATCH] Document the execution budget settings and the KTD13 action-authz compat plan Why: U3 slice 2 ships admission budgets (runtime.* keys, lease semantics, yield/reacquire) and the host-side action matrix; the runbook is the single source for operators and records the versioned public-contract plan KTD13 requires. Evidence: backend branch feature/collab-storage-u3-budget-authz (admission.go, action matrix in server.go) with admission/matrix tests green. Impact: docs only. Refs: proposals/2026-10-11-collaboration-storage-and-distribution.md KTD13/R8, section 5 U3. --- docs/guides/team-storage.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/guides/team-storage.md b/docs/guides/team-storage.md index 4186b8e..41c90e7 100644 --- a/docs/guides/team-storage.md +++ b/docs/guides/team-storage.md @@ -118,3 +118,39 @@ make test-backend-pg - 迁移仍随启动执行(已原子 + 锁化);完全独立的 migrator 入口留待 U4 工具。 - 多实例安全**未**因此声明(R4/U5);本档只交付单实例 team 档与真库门禁。 - pgvector 扩展已安装 ≠ 启用;向量检索仍是应用内扫描(U6)。 + +## 9. 执行预算与动作授权(U3 切片 2 已实施) + +### 执行许可(admission,R8) + +- 设置键:`runtime.execBudgetGlobal`(全局并发执行上限,含子代理;0=不限, + 默认)、`runtime.execBudgetPerUser`(每租户上限;0=不限)、 + `runtime.execQueueMax`(待执行队列上限,默认 200)。数值为容量合同初值, + U7 压测后调整。 +- 语义:会话回合与子代理同池计数;账本在数据库(`admission_leases`,PG 咨询 + 锁下原子清点),多实例天然共享;队列满时 API 在落库前 429(不写数据); + 父 run 同步等待子代理或等待 HITL 时让出执行许可、保留会话所有权,恢复 + 执行重新获取——额度占尽时父子不互等。 +- 接纳与执行分别计数:队列深度(接纳)与活跃租约(执行)是两个量, + 诊断分别看 `Manager.QueueDepth()` 与 `store.ActiveExecutionSlots()`。 + +### KTD13 动作授权矩阵与公开契约兼容计划 + +矩阵(宿主侧 `server.ProjectAction`): + +| 动作 | 语义 | 未注册 action-aware 时 | +|---|---|---| +| read | 读取项目资源(会话/消息/检索/下载) | 回落旧 EXT-8 只读适配器(兼容现网) | +| edit | 写入与修改 | **默认拒绝** | +| approve | 审批(HITL/命令确认) | **默认拒绝** | +| execute | 触发执行 | **默认拒绝** | +| admin | 管理 | **默认拒绝** | + +规则:action-aware 适配器(组合根注入 `SetProjectActionAuthorizer`)注册后 +对全部动作权威、出错 fail-closed;旧只读适配器不得自动获得写入能力。 + +**公开契约兼容计划**(后续版本落地):以版本化扩展把动作级判定并入 +EXT-8 的 `ProjectAuthz` 公开契约(新增 action 参数的变体接口 + 契约版本号), +下游适配器按动作逐一声明能力;未声明动作保持默认拒绝,与宿主侧矩阵同语义。 +旧 bool 契约在该版本内继续可用(映射为仅 read);Core/Host 与下游适配器 +(RDM 的 ProjectAuthz 实现)一起验收,不另建成员权威。