Repository navigation
Commit 8e3d4a5
docs(skills, mcp): teach that an AI service account is refused a confirmation-gated action whatever it sends (#33057)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao6eUTrsBJsmZzvYABV6AthJ)_
Fixes #32936
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:五处教学文字(objectstack-ai 技能表、MCP 下发的 SKILL.md
及控制台下载镜像、`run_action`/`resume_run` 工具描述、actions.mdx 姿态表、审批 dogfood
文件头)补上同一句话:AI 服务账号用自己的密钥调用需确认的动作时,无论带什么都会被 428
拒绝、什么都不执行,应交给人来执行,或由作者在可无人值守时声明 `ai.requiresConfirmation: false`。
- 为什么改:运行时早已如此(ADR-0151 D3 第 3 条),但已发布的技能仍教所有调用方「带 `confirm: true`
重试」,服务账号照做永远过不去。
- 风险与回滚:零运行时改动,只改文字与两条测试断言;回滚即 revert 本 PR。
- 先看:`skills/objectstack-ai/SKILL.md` 第 204
行表格行;`packages/mcp/src/mcp-http-tools.ts` 的 `run_action`
描述;`packages/mcp/src/skill-md.ts` 的 `run_action` 条目。
- 两分钟验证:`pnpm --filter @objectstack/mcp exec vitest run
src/skill-md.test.ts src/mcp-resume-run-tool.test.ts`,预期全绿。
- 需要你做的:本 PR 触及 `skills/**`(Tier H)。契约复审在现 head 已 PASS(评论
6846560754,Head-sha `a7baa0d746269fc53b8a2e7d4cdb3294e58e23c6`),请以
os-zhuang 批准;批准后席位落地。
- 席位意见:同意落地。四个入口与服务账号判定(`principalKind === 'agent'` 且无
`onBehalfOf`)逐一对过代码;复审只有四个 nit,作为接受的偏差。卡评论要的 `list_actions` 标记属运行时改动,已另立
#33067,本 PR 不做。
## What changes
One sentence, in the same terms everywhere: **under an AI service
account's own key (an agent acting for itself, for no person) the call
is refused whatever it sends and nothing runs: hand the action to a
person, or its author declares `ai.requiresConfirmation: false` when it
is safe unattended.** The existing teaching for a person and a delegated
agent (`confirm: true` after the human approves) stays in every text.
- `skills/objectstack-ai/SKILL.md` — the `list_actions` / `run_action` /
`resume_run` row of the MCP tool table.
- `packages/mcp/src/skill-md.ts` — the `run_action` entry carries the
sentence; the `resume_run` entry names the same refusal.
`ui/apps/console/src/pages/developer/objectstack-skill.ts` (the Console
"Download skill" mirror) carries the same bytes: the byte-for-byte pin
in `packages/mcp/src/skill-md.test.ts` goes red otherwise. This file is
outside the claim's listed surface; it is the mirror of `skill-md.ts`,
not a new text.
- `packages/mcp/src/mcp-http-tools.ts` — the `run_action` description
(comment 6839924935), the `resume_run` description, and both tools'
`confirm` member descriptions ("Under an AI service account's own key it
is not read: the call is refused whatever it sends").
- `content/docs/ui/actions.mdx` (nit D) — the posture table: the
`'rest'` row now states the gate it asks for an account under either
posture, and the `'ai'` row points to it; the `dispatchAction` example's
`confirm` comment says it is never read for an account.
- `packages/qa/dogfood/test/approval-decide-over-mcp.dogfood.test.ts`
(nit E) — the file header names the account confirmation rule for the AI
service account case (header only; no test code changed).
- Changesets: `'@objectstack/skills': patch`; `'@objectstack/mcp':
patch` + `'@object-ui/console': patch` (the mirror).
**The runtime rule, quoted from `main` (c54a23d),
`packages/runtime/src/action-execution.ts`:**
```ts
if (action?.ai?.requiresConfirmation !== true) return undefined;
// [ADR-0151 D3 rule 3] An AI service account never confirms for itself:
// for one, the member is not read at all.
const account = isAiServiceAccountCaller(caller);
// Only the boolean `true` attests.
if (!account && request?.[AI_ACTION_CONFIRMATION_MEMBER] === true) return undefined;
```
It is asked at every door: `packages/runtime/src/action-dispatch.ts`
(`if (posture === 'ai' ||
actionExec.isAiServiceAccountCaller(wiring.ec))`, so REST `/actions` and
a host `dispatchAction` on `'rest'` refuse an account too) and
`packages/runtime/src/domains/mcp.ts` `resumeAdmissionRefusal`
(`resume_run`). `isAiServiceAccountCaller` is `principalKind === 'agent'
&& !onBehalfOf`.
**Not changed:** no runtime code; `delete_record` / `delete_records`
teaching untouched (a different gate).
## Tests
- `packages/mcp/src/mcp-resume-run-tool.test.ts` — new case: both
`run_action` and `resume_run` descriptions keep `confirm: true` and
carry the account sentence, and both `confirm` members say the member is
not read for an account.
- `packages/mcp/src/skill-md.test.ts` — the action-preference case also
pins the account sentence in the `run_action` and `resume_run` entries.
The pinned sentence is absent from both source files on `origin/main`
(`grep -c` 0), so neither case can pass on the base text.
## Acceptance notes
- **Skill budget (`skills/**`).** `skills/objectstack-ai/SKILL.md`: 422
→ 421 lines, 5776 → 5813 tokens (ceiling 6801). Whole package (sum of
every `SKILL.md`): 4597 → 4596 lines, 58697 → 58734 tokens. The row is
one table line edited in place; the growth is funded by deleting the
pitfall line's restatement of the tool-level `requiresConfirmation`
retirement (no execution path read it; `ToolSchema` is strict), which
`## Tool` already states. No re-wrap is counted. Net tokens +37, inside
the ceiling.
- **Out of scope, reported to the seat:** comment 6839924935 also asks
that an AI service account's `list_actions` row carry an `unavailable`
marker. That is a behaviour change (today `domains/mcp.ts` sets
`unavailable` only from `apiForwardCredentialRefusal`), so it is not
built here.
## Verification
Local, on `2126444e` (the change) and re-read on `a7baa0d7` (after
merging `main` 64c426a):
- `pnpm --filter @objectstack/mcp test` — 63/63 files, 1094/1094 tests
on 2126444; 63/63, 1097/1097 on a7baa0d (lock VERDICT command-exit 0).
- `pnpm --filter @objectstack/mcp typecheck` — exit 0
(`check:test-typecheck: OK`) on 2126444.
- `node scripts/check-skills-token-ratchet.mjs` — exit 0 on a7baa0d:
`skills/objectstack-ai/SKILL.md is 5813 tokens (ceiling 6801; headroom
988)`.
- `node scripts/pm/dispatch-gates.mjs --ran` — `✓ 108 derived famil(ies)
accounted for — 106 run, 2 NOT-MEASURED`. Every run family exited 0
(`check:skill-examples`, `check:lean-entry-closure` and `pnpm --dir ui
exec vitest run scripts/` after building their prerequisites: 344 prose
examples type-check; 171/171 files).
<details><summary>NOT MEASURED locally (2), left to CI</summary>
- `pnpm check:dual-build-cjs-loads` — exit 3, needs every published
package's dist (a full workspace build); this diff changes text only.
- `node scripts/check-plugin-teardown-shape.mjs --self-test` — exit 3,
its pinned commit 621a487 cannot be fetched into this shallow clone.
</details>
CI check-runs are the verdict for every other family; the seat reads
them.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibxjTGv9SGUZ76PjPuG)_
<!-- signed: domain:skills#2 · os-tesla ·
session_01L9qibvXzthnUYrxzphgFgW -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent a596c03 commit 8e3d4a5
10 files changed
Lines changed: 83 additions & 16 deletions
File tree
- .changeset
- content/docs/ui
- packages
- mcp/src
- qa/dogfood/test
- skills/objectstack-ai
- ui/apps/console/src/pages/developer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
703 | | - | |
| 703 | + | |
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
714 | | - | |
| 713 | + | |
| 714 | + | |
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2991 | 2991 | | |
2992 | 2992 | | |
2993 | 2993 | | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
2994 | 2999 | | |
2995 | 3000 | | |
2996 | 3001 | | |
| |||
3069 | 3074 | | |
3070 | 3075 | | |
3071 | 3076 | | |
3072 | | - | |
| 3077 | + | |
| 3078 | + | |
3073 | 3079 | | |
3074 | 3080 | | |
3075 | 3081 | | |
| |||
3166 | 3172 | | |
3167 | 3173 | | |
3168 | 3174 | | |
3169 | | - | |
3170 | | - | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
3171 | 3179 | | |
3172 | 3180 | | |
3173 | 3181 | | |
| |||
3209 | 3217 | | |
3210 | 3218 | | |
3211 | 3219 | | |
3212 | | - | |
| 3220 | + | |
| 3221 | + | |
3213 | 3222 | | |
3214 | 3223 | | |
3215 | 3224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
89 | 105 | | |
90 | 106 | | |
91 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
103 | 108 | | |
104 | 109 | | |
105 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
430 | 434 | | |
431 | 435 | | |
432 | 436 | | |
433 | 437 | | |
434 | 438 | | |
435 | 439 | | |
436 | | - | |
| 440 | + | |
| 441 | + | |
437 | 442 | | |
438 | 443 | | |
439 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
322 | | - | |
323 | | - | |
| 321 | + | |
| 322 | + | |
324 | 323 | | |
325 | 324 | | |
326 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
184 | 188 | | |
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
190 | | - | |
| 194 | + | |
| 195 | + | |
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
| |||
0 commit comments