Skip to content

Commit a84bcd8

Browse files
docs(adr): ADR-0011 and ADR-0151 record who confirms a declared-gated action on an AI door (#33810)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X3KyFEoEw9hQnSWC2gDfEpS)_ domain:spec#1 · os-project-manager · session_01FEkQ5kZuoX9F5S7p84Dwue Fixes #33689 (PR 2 of 2: the ADR-0011 and ADR-0151 amendment notes. PR 1, the contract, merged as #33725, `1e65a389`.) Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:只加两段 ADR 修订说明,不改任何代码、接口或决定。ADR-0011 记录:声明了 `ai.requiresConfirmation: true` 的动作,经 MCP `run_action` / `resume_run` 调用时,由人来确认(客户端支持征询就在客户端问;不支持就交给宿主的待确认服务,由调用所代表的那个人登录应用后同意或拒绝;宿主没有该服务才拒绝),调用方自己传的 `confirm: true` 不再算数。ADR-0151 记录:AI 服务账号的规则 3 不变,照旧拒绝,不征询也不交出;待确认服务不是规则 3 等待的那扇「转交给人」的门(那仍是 O6)。 - 为什么改:#33725 已把这条契约合进 `@objectstack/spec`,卡片要求同步修订这两份 ADR。 - 风险与回滚:纯文档。两段说明都写明「实现变更发布前,门禁仍读 `confirm: true`」。回滚即还原本 PR。 - 先看:`docs/adr/0011-actions-as-ai-tools.md` 的 Confirmation 表格下方的修订说明;`docs/adr/0151-…md` D3 末尾的修订说明;两份文件头部各加一行 Amended。 - 需要你做的:这是 Tier H(`docs/adr/**`),需要你审批合并。应用内助手这扇门按你的裁定「B 同一规则,两套流程暂留」写入 ADR-0011 说明:同一规则适用于所有 AI 入口,应用内确认卡和 `IAIService` 待批成员保留;契约改动走 #33808,cloud 路由对齐走 #33809,两套接缝合并是 #33806。 ## What changes Docs only: two dated amendment notes and one header line in each ADR. No decision of either ADR is reversed, and no status line changes. - **`docs/adr/0011-actions-as-ai-tools.md`**: a header `**Amended**` line, and an amendment note under the "Confirmation (HITL approval queue)" heading. It cites the merged contract by symbol (`packages/spec/src/contracts/ai-service.ts#AI_ACTION_CONFIRMATION_CAPABILITY`, `#IActionConfirmationService`, `#ACTION_CONFIRMATION_SERVICE`). The note covers: - **Why:** measured 2 of 6 self-confirmed runs on 18.4.0. - **Which calls:** the declared flag, through MCP `run_action`, or `resume_run` for its candidate action, by any caller acting for a person. - **The three steps:** elicit; otherwise hand off, where only the person the call ran as decides, an approval runs as them with every gate re-checked, a `resume_run` resumes its parked run, and the approve and reject doors take a signed-in session only; refuse with `no_confirmation_service` only when no service is registered. - **`confirm`:** the caller's `confirm` never counts. - **What an answer proves:** neither answer proves a human. - **Bounds:** the MCP delete tools keep the member, and REST `/actions` stays outside the gate for a person. - **The in-app assistant door, as ruled (Ruling-ref: Leehom 2026-11-15T11:10:57Z, 「B 同一规则,两套流程暂留」, record 6893484458):** the core rules bind every AI door, the in-app assistant included. Neither the caller's nor the model's own confirmation counts, only the person the call ran as decides, the deciding doors take a signed-in session only, and the approved action runs as that person, re-checked. The in-app door keeps its own channel (the pending-approval card and inbox), and `IAIService`'s pending members stay. The note points to the follow-ups: the in-app door's three changes (who decides, which credential, as whom it runs) land through #33808, the cloud route alignment is #33809, and the seam merge is #33806. - **When it binds:** until the implementing change ships, `#actionConfirmationRefusal` gates on `confirm: true`, and the addendum's sentence stays the description of running code. - **What stays unchanged:** the opt-in, the H/C/E buckets with "never relaxed" (what changes is who confirms), and ADR-0151 D3 rule 3. - **`docs/adr/0151-…-of-its-own.md`**: a header `**Amended**` line, and an amendment note after D3. It covers: - **Rule 3 is unchanged:** an account is refused whatever it sends, neither elicited nor handed off. - **The new reason:** from the implementing change the refusal carries `details.reason: 'service_account'` on every door that runs an action. - **Not the hold door:** the pending-confirmation service is not the hold door rule 3 waits on. It hands a person's call back to that person, and its doors refuse an agent principal. O6 stays a separate decision. - **OAuth agents:** an OAuth agent acting for a person is not an account. - **Until the switch:** the gate is `#actionConfirmationRefusal` / `#isAiServiceAccountCaller` as before. ## Why Card #33689's "Change" amends ADR-0011 and ADR-0151 alongside the contract. Under its order the notes ship as their own Tier H PR after the contract (PR 1) merged. ## Verification Head `ab50848a`, from `origin/main` at `1e65a389`. <details><summary>Derived gates: 21 derived, 21 exit 0, 0 NOT-MEASURED</summary> ```text node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack (21 commands; each run with timeout 900, exit captured before any pipe) 21 of 21 :: exit 0 (check:adr-symbol-anchors: 3621 anchors across 156 records resolve; check-adr-links: 1131 destinations resolve; check:adr-anchors, check:adr-index, check:doc-authoring, check:pm-governed-merges included) dispatch-gates --ran :: exit 0 — 21 derived, 21 run, 0 NOT-MEASURED Changed lines: 70 (+70 / -0), under the human-merge threshold ``` </details> ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. (no names added) - [x] 3. No formatter ran; `pnpm lint` passes. (docs only; the derived lint-family gates ran green) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. (publishes nothing; no changeset) - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. (the maintainer quick-read section is in Chinese by the project's convention) --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5kZuoX9F5S7p84Dwue)_ <!-- signed: domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8319820 commit a84bcd8

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

‎docs/adr/0011-actions-as-ai-tools.md‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
**Status**: Accepted — implemented (2026-06-04)
44
**Authors**: HotCRM (objectstack-ai/hotcrm) — surfaced the requirement; design finalised in framework
55
**Consumers**: `@objectstack/service-ai` (the bridge), `@objectstack/spec` (ui.action, contracts.ai-service), every app that ships actions
6+
**Amended** (2026-11-15, [#33689](https://github.com/objectstack-ai/objectstack/issues/33689)): a dated note under [Confirmation](#confirmation-hitl-approval-queue) records who confirms a declared-gated action on an AI door. The status line above is left as it is.
67

78
---
89

@@ -234,6 +235,52 @@ asking; an action the user can't invoke simply isn't offered.
234235
| `ai.requiresConfirmation: false` on a destructive action | exposed & direct-run — **author asserts safe** (bridge logs a warning) |
235236
| not destructive | direct-run |
236237

238+
> **Amendment note (2026-11-15, [#33689](https://github.com/objectstack-ai/objectstack/issues/33689) — PR #33725, `1e65a389`): who confirms a declared-gated action on an AI door.**
239+
> Ruled by the account owner on objectstack-ai/cloud#3826 (「3826 照建议(征询版)」, phase 1, card 1 of its
240+
> item-6 chain) and amended on #33689 (「我开始重新接受你说的主流方案,就是推送到客户的手机端」,
241+
> 「比如最简单的我可以先推送到邮件」). The contract is the docblock of
242+
> `packages/spec/src/contracts/ai-service.ts#AI_ACTION_CONFIRMATION_CAPABILITY`; it is the record, and this note
243+
> points at it without restating every case.
244+
>
245+
> - **Why.** On the MCP doors the confirmation of an action declaring `ai.requiresConfirmation: true` was the
246+
> caller's own `confirm: true`, which nothing could check. Measured on published 18.4.0, an agent sent it itself on
247+
> an irreversible action in 2 of 6 runs. The gate made forgetting loud; it did not prove a person.
248+
> - **Which calls.** An action whose author declared `ai.requiresConfirmation: true` (the declared flag, not the
249+
> destructive heuristic of the table above), called through the MCP `run_action` tool, or through `resume_run` for
250+
> the candidate action it would run, by any caller acting for a person, on an OAuth token or an API key.
251+
> - **How the person is asked, in order, after every admission gate and before anything runs.** (1) **Elicit**: one
252+
> MCP `elicitation/create` in form mode, when the client advertised `elicitation` at `initialize` and the door can
253+
> carry the request. (2) **Hand off**, otherwise: the call goes to the host's pending-confirmation service
254+
> (`packages/spec/src/contracts/ai-service.ts#IActionConfirmationService`, registered under
255+
> `packages/spec/src/contracts/ai-service.ts#ACTION_CONFIRMATION_SERVICE`) and the caller is answered
256+
> `status: 'pending_confirmation'` with a pending id. Only the person the call ran as approves or rejects it in the
257+
> app; an approved action runs as that person with every gate and permission re-checked, and a handed-off
258+
> `resume_run` resumes its parked run rather than starting one. The approve and reject doors take a person's
259+
> signed-in session to the app and nothing else. (3) **Refuse** only when the host registers no such service:
260+
> `428 ACTION_CONFIRMATION_REQUIRED` with `details.reason: 'no_confirmation_service'`.
261+
> - **The caller's `confirm` never counts** on such a call, in any of the three steps.
262+
> - **What an answer proves.** An elicited `accept` proves that the client answered, and an approved hand-off that a
263+
> signed-in session to the app answered. Neither proves a human; each is as strong as what it takes to give it.
264+
> - **Bounds.** The MCP `delete_record` and `delete_records` gates keep reading `confirm: true` until a decision moves
265+
> them, and REST `/actions` stays outside the gate for a person.
266+
> - **The in-app assistant door: the same rule, its own channel.** Ruling-ref: Leehom 2026-11-15T11:10:57Z,
267+
> 「B 同一规则,两套流程暂留」 (record `6893484458` on #33689). The core rules bind every AI door, the in-app
268+
> assistant included: neither the caller's nor the model's own confirmation counts; only the person the call ran
269+
> as decides; the deciding doors take a signed-in session only; and an approved action runs as that person, with
270+
> every gate and permission re-checked. The in-app door keeps its own channel, the pending-approval card and inbox
271+
> this ADR describes in [Invocation flow](#4-invocation-flow) and the table above, and `IAIService`'s pending
272+
> members stay. Merging the two seams was not ruled. The contract at `1e65a389` names the two MCP tools only; the
273+
> in-app door's three changes (who decides, which credential may decide, and as whom the approved action runs,
274+
> today the pre-registered bypass dispatcher) land through #33808, the cloud approve and reject routes are aligned
275+
> through #33809, and the seam merge is #33806.
276+
> - **When it binds.** The contract ships in `@objectstack/spec/contracts` from the release that carries `1e65a389`.
277+
> The doors implement it in the next card of the chain. Until that change ships, every door gates on the member as
278+
> before (`packages/runtime/src/action-execution.ts#actionConfirmationRefusal`), and the addendum's sentence below
279+
> that a C action is refused "until the call carries `confirm: true`" stays the description of the running code.
280+
> - **Unchanged.** The opt-in and its default-off exposure; the addendum's H, C and E buckets and its rule that a C
281+
> action's confirmation is never relaxed (what changes is who confirms it, not whether it is asked); and the AI
282+
> service account's refusal, ADR-0151 D3 rule 3, which its own note of the same date records.
283+
237284
---
238285

239286
## Migration Path

‎docs/adr/0151-ai-service-account-a-headless-agent-is-a-registered-principal-of-its-own.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- **Leaves unchanged**: the 2026-09-16 note (a person's API key is that person's credential, never an agent); rule 5 and its credential-kind × target-door table; ADR-0118 D1, D2, D5 and D6; the meaning of `ExecutionContext.performedBy` (the OAuth client that acted for a person) and the room it reserves; the OAuth agent path end to end; ADR-0073's automation principal, which stays a separate identity.
99
- **Consumers**: `@objectstack/platform-objects` (two `sys_user` columns), `@objectstack/plugin-auth` (the registration, key and lifecycle doors; the session and credential refusal), `@objectstack/core` (key admission carries the kind; the shared assembler stamps the principal), `@objectstack/plugin-security` (the agent ceiling at evaluation and at assignment), `@objectstack/plugin-audit` and `@objectstack/spec` (the hook surface, O4), and in `objectstack-ai/cloud` the licence layer and the console (cloud ADR-0116 D7, cloud#3886, cloud#3820).
1010
- **Amended** (2026-11-10, [#32060](https://github.com/objectstack-ai/objectstack/issues/32060)): a dated note under [What builds on this](#what-builds-on-this) records what O3 and O4 shipped. The status line above is left as it is.
11+
- **Amended** (2026-11-15, [#33689](https://github.com/objectstack-ai/objectstack/issues/33689)): a dated note under [D3](#d3--its-authority-its-own-grants-under-the-agent-ceiling) records that rule 3 holds unchanged under the amended action-confirmation contract. The status line above is left as it is.
1112

1213
---
1314

@@ -75,6 +76,28 @@ ADR-0118 refused a seeded "system" pseudo-user for two reasons: seeding writes t
7576
- **Rule 5 needs nothing new.** An account's `api` action forward carries the account's own key, and that key already *is* the agent, so no forward credential is minted. Its cells in the table are the `api_key` row as it stands: the identity door refuses by name, the MCP and platform doors accept.
7677
- **MCP.** On the HTTP endpoint and over stdio (ADR-0101, `OS_MCP_STDIO_API_KEY`), an account's key admits the account through the same shared chain. The OAuth tool families are a person's consent and do not apply; the account's grants bound what its tools reach.
7778

79+
> **Amendment note (2026-11-15, [#33689](https://github.com/objectstack-ai/objectstack/issues/33689) — PR #33725, `1e65a389`): rule 3 under the amended confirmation contract.**
80+
> [ADR-0011](./0011-actions-as-ai-tools.md)'s note of the same date records the new contract
81+
> (`packages/spec/src/contracts/ai-service.ts#AI_ACTION_CONFIRMATION_CAPABILITY`): a person confirms a declared-gated
82+
> action on an AI door, elicited in the MCP client or handed off to the host's pending-confirmation service, and the
83+
> caller's own `confirm: true` never counts. Rule 3 is unchanged by it:
84+
>
85+
> - **An account acting for itself is refused whatever it sends.** It is neither elicited, since no person stands
86+
> behind the account and its own client could answer, nor handed off. From the change that implements the
87+
> contract, the refusal carries `details.reason: 'service_account'`
88+
> (`packages/spec/src/contracts/ai-service.ts#ACTION_CONFIRMATION_REFUSAL_REASONS`) on every door that runs an
89+
> action, REST `/actions` and host doors included, because the one admitted sequence asks this rule at each of them.
90+
> - **The pending-confirmation service is not the hold door rule 3 waits on.** It hands a person's own call back to
91+
> that same person (`packages/spec/src/contracts/ai-service.ts#IActionConfirmationService`), and an account has no
92+
> person behind it. Its approve and reject doors take a person's signed-in session and refuse an agent principal,
93+
> with or without `onBehalfOf`. A hold that routes an account's run to its owner or an administrator remains O6's,
94+
> through the approvals engine, and is a separate decision.
95+
> - **An agent acting for a person** (`principalKind: 'agent'` with `onBehalfOf`, the OAuth path) is not an account:
96+
> the contract asks the person it acts for.
97+
> - **Until the implementing change ships**, the gate is `packages/runtime/src/action-execution.ts#actionConfirmationRefusal`
98+
> as before, and it refuses an account through
99+
> `packages/runtime/src/action-execution.ts#isAiServiceAccountCaller` whatever the call sends.
100+
78101
### D4 — Its credentials: dedicated API keys, minted by a person
79102

80103
- **API keys, one or many.** Each key row carries `user_id` = the account and `active_organization_id` = the account's organization. An account may hold several keys (rotation, one per deployment); they remain one identity.

0 commit comments

Comments
 (0)