Appearance
Reliability / Approval
Side-effect surfaces
createAutoReviewGate() 同时管理 host shell、box shell、MCP、computer、automation write、cloud agent、subagent launch 等执行面。重点不是这些产品名称,而是:不同 capability surface 可以有不同 enforcement mode,但必须经过统一 Runtime owner。
| Symbol | 语义 |
|---|---|
currentModes() | 读取当前 enforcement mode,并让 controller 过期掉不再 enforce 的 surface |
assertNoPendingApproval() | 已有 pending approval 时禁止开始新的 side effect |
userInstructions() | allow/block instructions 的 Runtime 投影 |
shellApprovalState() | 为 shell approval state 生成稳定 identity |
getIdentity() | identity 包含 surface / box / generation |
markSideEffectStart() | side effect 开始后推进 generation |
Pending approval invariant
text
request side effect
↓
assertNoPendingApproval()
├─ pending = 0 → continue
└─ pending > 0 → reject new side effect start这不是 UX 限制,而是一个并发/一致性 invariant:如果允许多个待审批副作用同时漂移,审批对象与实际执行状态很容易错配。
Generation identity
text
identity = surface + boxId? + generation
↓
side effect starts
↓
generation += 1这里值得吸收的是“审批针对的执行状态必须有 identity”,而不是照抄它的字符串格式。
本地定位
bash
rg -n "createAutoReviewGate|currentModes|assertNoPendingApproval|shellApprovalState|getIdentity|markSideEffectStart" source/host/runner/auto-review-gate.ts固定源码
关联知识文章
- 历史执行怎样重放和分叉:Replay、Determinism、Fork 与 Time Travel — Approval identity 让“同一次副作用”有可验证身份;
shellApprovalState() - 高风险 Tool 怎样只拿最小权限:Risk、Least Privilege 与 Approval — Risk Hint 和 Enforcement 必须分开;
isReadOnly()→annotations - 高风险 Tool 怎样只拿最小权限:Risk、Least Privilege 与 Approval — 真正的 side-effect gate 在 Runtime Controller;
assertNoPendingApproval()→currentModes() - 恢复、重试和人工审批怎样共享同一执行事实 — Approval Gate 与 Checkpoint Boundary 必须共同参与 Resume;
assertNoPendingApproval()→shellApprovalState() - 重试怎样避免放大故障:Backoff、Retry Budget 与 Idempotency — 副作用 generation identity 是 Retry/Resume 的锚点之一;
shellApprovalState() - Human Control 如何跨进程工作:HITL、Interrupt、Approval 与 Resume — Pending Approval 是 Runtime Gate,不是 Prompt 建议;
createAutoReviewGate()→assertNoPendingApproval()→shellApprovalState() - Tool 失败后能不能重试:Retry Eligibility 与 Idempotency Contract — Side Effect identity 必须跨审批/执行可关联;
shellApprovalState()→getIdentity()→markSideEffectStart()