docs(rfc): close semantic handoff contract gaps - #4367
huangruiteng merged 3 commits into
Conversation
Signed-off-by: luw2007 <luw2007@gmail.com>
huangruiteng
left a comment
There was a problem hiding this comment.
结论:REQUEST_CHANGES。本次评审绑定 exact head fd3aa7f759fdb1399c3b5feff4aed3d47940fb1f。四组修订方向正确,但 request-derived Goal amendment 的取消竞态仍缺少可实现的线性化协议;这会让 A7/A16 的 fail-closed 承诺在两个独立 authority transaction 之间失效。
阻塞项(P1):shared-goal-alignment-and-governed-amendment-v0.md §5 step 5 现在要求同一次 authorization decision 检查 source request revision 仍 live,然后只描述一次 Goal CAS,并宣称 revocation/supersession racing commit 会 fail closed。与此同时,capable-manager-semantic-handoff-v0.md §5.12 明确 request transition 与 Goal/Todo 等 owner 各自在自己的 transaction 内提交,跨边界靠 effect intent、精确 receipt 和 reconciliation,不虚构 distributed transaction。于是存在真实 interleaving:commit 先读到 r1 live;request owner 独立提交取消/替代 r2;Goal base 仍当前;Goal CAS 随后成功。两个 store 都能生成局部有效 receipt,但被取消的 r1 仍改变了 canonical Goal,事后 reconciliation 无法无权限地回滚 semantic revision。
最小修复不是再加一段“重新检查” prose,而是命名一个可强制的 linearization point 与 owner。例如让 GoalAmendmentAuthority 消费一个由 request-level effectful attempt fence 颁发、并在 commit settle 前阻止取消生效的精确 token;或者定义受审阅的 prepare/commit/abort 协议及 crash/readback 语义。必须说明取消先赢、commit 先赢、检查后崩溃、Goal CAS 后回执丢失四类 interleaving 各自只有哪个 terminal outcome,且不与 §5.12 的独立 owner/无分布式事务原则冲突。A7/A16 应把这个具体协议变成可执行 race fixture,而不是只断言“fails closed”。
动机
这个 follow-up 的大方向很有价值。#4330 合入后的独立 audit 指出五个 load-bearing 缺口:晚到 receipt 被 mutable request head 拒绝;effectful pre-Todo 改派无独占 fence;首个 Stage 3 authority 被写成可覆盖过宽 amendment class;request-derived proposal 与来源请求取消没有绑定;A3/A6/A7/A14/A16 可以用弱证据误过门禁。如果在 M2 schema freeze 前不收紧,后续 runtime 很容易把 request identity、work ownership 和 Goal semantic authority 混成第二套真相。
当前 patch 已实质修复前四项中的前三项,并加强 acceptance:增加 immutable DispatchAttempt 和 optional attempt_ref,允许已授权旧 attempt 在 request head 前进后补录精确 evidence;每个 request 跨 revision 至多一个 effectful attempt 持有 fence,无法强制停止时新 receiver 只能调查准备;Stage 3 首片明确只允许 intent-preserving shared_work_graph;A3 增加真实可逆 mutation/readback、撤销和 prompt-injection 负向,A6 澄清复用 identity construction 而非字面 id,A14 拆出成功远端读取与 denied/unavailable 对照。剩余问题只在 source-request/Goal 的跨 owner commit 竞态。
改动思路
handoff RFC 的 request state 设计现在更清晰:request-head CAS 只授权新的 dispatch/assessment/effect attempt;已经授权的 attempt 保留不可变 request revision,late receipt 不因后来 correction/cancellation 被丢弃或重绑。DispatchAttempt 把 receiver、intent、effectful flag、state 和 supersession 显式化;request-level fence 把 consultation 的多接收者与 effectful execution 的单 owner 分开。这个 owner 选择与现有 Turn/Todo/lease/effect interpreter 的职责边界相容。
alignment RFC 则给 goal_amendment_proposal_v0 增加可选 source_request_ref,并要求 request-derived proposal 在 commit 时来源 revision 仍有效。这是正确不变量,但当前只写成 policy read + Goal CAS,没有把 source request 与 Goal commit 的先后顺序落在任何可强制边界。现有 §5.12 明确“真实 authority 边界内原子、跨边界对账”,因此不能把“same authorization decision”当作跨 store atomicity 的替代。最自然的 bounded companion 是复用本 PR 新增的 request-level effectful attempt fence,把 amendment commit 视为受它保护的 effect,并说明取消何时只是 condition、何时真正生效;无需发明第三套 amendment revocation state。
具体改动
四个既有双语 RFC 文件合计 55 additions / 33 deletions,无 runtime、schema implementation、provider、权限或默认行为变化。英文/中文 diff 逐段对照后语义一致,4 个 embedded JSON block 均可解析,changed-doc local links 均可解析,git diff --check 通过。
关键内容讲解
DispatchAttempt/Observation.attempt_ref:把“谁在什么 request revision 下被授权执行”从 mutable request head 中拆出来,解决 late evidence 的 provenance;same-event replay 和 changed-payload conflict 仍沿用 existing effect-interpreter semantics。- request-level execution fence:跨 revision 只允许一个 effectful attempt 持有 fence,纠正/改派不能抹去 active claim;无法强制边界时只允许无副作用调查准备。这关闭了 effectful pre-Todo 双执行口。
- Stage 3 scope:每种 amendment class 都要独立 qualification;首个
GoalAmendmentAuthorityslice 只允许shared_work_graph,不会因 manager/verifier prose 获得 acceptance、permission、objective 或 stop-condition authority。 - source-request binding:proposal 示例新增
{request_id, revision},commit prose 要求 live/non-revoked/non-superseded;字段与不变量正确,但尚未定义跨 owner atomic/fenced commit。 - A3/A6/A7/A14/A16:正负 journey 比以前更难假阳性,尤其真实 host mutation、untrusted input、成功 remote artifact retrieval、late receipt 与 amendment race。不过 A7/A16 需要补成上述可实现的线性化测试。
对主干的风险
这是 docs-only PR,直接 runtime blast radius 为零;真正风险是它将成为 M2/M3 的实现与 promotion authority。若按现文实现,request CAS suite 与 Goal CAS suite 都可以全绿,组合竞态仍会让 cancelled r1 proposal commit。canonical Goal 一旦更新,peer frontier、Todos 和后续 effects 会基于 stale intent 继续,不能靠事后 audit 安全撤回。因此这是 contract blocker,不是措辞建议。
另外,GitHub 对该 exact head 没有提供 status-check rollup;本地 docs-governance smoke 在当前 main 的既有 manager-runtime-profile-v0.md 缺少中文 mirror 处提前失败,该文件不在本四文件 diff 中。这个 baseline 问题不构成本 PR finding,但修复本 blocker 并 rebase 后仍应让仓库必需 checks 给出可读 receipt。当前 branch 虽 behind main,base 之后这些四个 RFC 没有同文件变更,未发现文本冲突。
我的整体评价
这是一个范围合适、没有多余 runtime scaffolding 的 RFC 修正,且确实关闭了 #4330 audit 的大部分问题。我支持 immutable attempt、单 effectful fence、Stage 3 class 收窄和更强 acceptance 的方向;没有必要拆开这些相互依赖的语义。但“来源请求仍 live”必须从愿望变成能在线性化点失败的协议,否则最关键的 cancellation race 仍是假门禁。补齐 owner/fence/commit/abort/readback 关系并同步双语 A7/A16 后,可以快速复审。
English verdict: REQUEST_CHANGES — exact head fd3aa7f759fdb1399c3b5feff4aed3d47940fb1f correctly adds immutable attempts, effect fencing, narrower Stage 3 authority, and stronger acceptance journeys, but its source-request liveness check cannot make cancellation racing a separate Goal CAS fail closed; define the enforceable cross-authority linearization/recovery protocol and bind A7/A16 to it.
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Summary / 摘要
Close the contract gaps raised on #4330 before M2 freezes semantic handoff identities. Preserve the contributor's immutable dispatch attempts, cross-revision effect fence, narrower Stage 3 scope and stronger acceptance journeys. Add an enforceable ordering for source-request cancellation versus a separate Goal amendment commit.
保留开发者已有修正,补齐请求取消与 Goal 修订跨 owner 的提交竞态;管家与目标对齐 RFC 中英同步更新。
shared_work_graph.Validation / 验证
examples/docs-governance-smoke.pypassed after merging current main into this branch.git diff --checkpassed; four JSON examples, 50 local file links, four new section anchors and A1–A20 language parity checked.Scope and remaining work / 边界与后续
Docs only: no runtime, permission, provider or default behavior changes, and no frontend bundle change. The affected future frontend/Lark/CLI journey is specified: cancellation requested → pending settlement → settled with or without an already committed effect, all from the same receipt projection. Implementation and real authority-profile/entrypoint acceptance remain M2/M3 work; request-derived commits stay unsupported until that protocol is qualified.
Future-facing consolidation: define cancellation ordering once under alignment, reuse the existing collaboration fence and amendment operation receipt, and remove the misleading read-then-CAS promise. No new generic ledger, distributed transaction framework or second Goal writer.
Under review; not self-merged. 保持待审阅,不自合并。