You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d558de0
Browse filesBrowse the repository at this point in the historyBrowse files
fix(runtime,mcp): the no_confirmation_service refusal names the route that works on the door that asked (#37367)
Fixes#34325
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:AI
客户端调用需要人工确认的业务动作、而服务器没有挂起审批服务时,拒绝提示会按入口说清楚该怎么办:本地(stdio)连接且客户端不支持弹框确认时,提示换用支持确认的客户端;所有入口都提示由人在应用里完成,并且不要改用别的工具做同样的修改。
- 为什么做:属于「MCP 写数」主线;此前有 AI 读到「去应用里做」后改用直接改记录的工具绕过了确认,维护者已同意在提示里明确禁止。
- 出错会怎样:只改拒绝提示的文字,错误码、状态和返回字段都不变,不会改数据;对外接口只新增可选项,已有接入方不受影响;可直接撤回。
- 要你做什么:无。
## What changes
The `no_confirmation_service` refusal (`428
ACTION_CONFIRMATION_REQUIRED`) that the MCP `run_action` and
`resume_run` doors answer when a declared-gated action meets a host with
no pending-confirmation service now names the route that works on the
door that asked. The code, the status, `details` (including `reason`)
and the hand-off handed to a host's service are unchanged. No spec file
is touched.
Messages, measured through the real runtime bridge (`buildMcpBridge`) at
this head, for `archive_lead` on `crm_lead`:
- Before, every door (main 80da086): `Action 'archive_lead' on
'crm_lead' declares ai.requiresConfirmation: true, so a person confirms
it — nothing was run. This server has no pending-confirmation service to
ask them through, and a confirmation sent on the request does not count.
Perform the action in the app instead.`
- After, stdio door, client without `elicitation`: `... does not count.
A client that supports confirmation (MCP elicitation) is asked in place
on this server: use one to confirm it here. Otherwise a person performs
it in the app: do not make the same change with another tool.`
- After, Streamable HTTP door (and any caller that passes no door): `...
does not count. A person performs it in the app: do not make the same
change with another tool.`
The first sentence is the step-3 sentence of
`AI_ACTION_CONFIRMATION_CAPABILITY`. It is left out on Streamable HTTP,
which asks no client until #34321, as ruling 6909391261 on #33712 says.
The in-app clause on every door is the wording of comment 6966146204 on
this card. It matches the `run_action` description clause that #37355
added.
How the refusal site knows the door: the MCP tools already decide per
call whether the client can be elicited
(`actionConfirmationElicitorFor`, from #34318). A new
`actionCallDoorFor` in
`packages/mcp/src/action-confirmation-elicitation.ts` returns one of
three things:
- `door`, main's `McpActionCallDoor` (the elicitor), when the client can
be asked. The bridge is called with three arguments, as on main;
- `facts`, `{ elicitsCapableClients: true }`, when this server read the
client's `initialize` and can carry a request to it, but the client did
not advertise form-mode `elicitation` (the long-lived stdio server
today). The bridge is called as `(name, request, undefined, facts)`;
- nothing, when the server never read `initialize` (the per-request
Streamable HTTP server). The bridge is then called with two arguments,
as before.
The check is made on what the server can do, not on a transport name. If
the HTTP door starts to read `initialize` (#34321), it gets the sentence
at the same time as the elicitation that makes it true.
The runtime bridge (`packages/runtime/src/domains/mcp.ts`) forwards the
flag through `invokeBusinessAction` / `confirmAdmittedAction`
(`action-dispatch.ts`) and `resumeActionRun` to
`handOffActionConfirmation(..., door)` (`action-execution.ts`). It
arrives as a separate argument, not on `ActionConfirmationHandOff`, so
the host's service never sees it.
Public surface of `@objectstack/mcp`, additive only (hence `Clause-②:
yes (widening)`):
- `McpActionCallDoor` is unchanged, and it is still passed only when the
client can be elicited;
- there is a new exported type `McpActionCallDoorFacts` (`{
elicitsCapableClients?: true }`);
- `McpActionBridge.runAction` and `resumeRun` gain an optional fourth
parameter `facts`.
A bridge written against main compiles unchanged. It ignores the fourth
argument and hands the call off as before, so only the refusal wording
differs on such a bridge.
## Tests
- `packages/runtime/src/action-confirmation-handoff-33690.test.ts`, new
describe `[#34325]` (7 cases), run through the real bridge for both
tools. With the stdio door, the message carries the client sentence
followed by the in-app clause. With no door (HTTP), it carries the
in-app clause and never the client sentence. `details` are equal on both
doors. The flag never reaches the service's hand-off.
- `packages/mcp/src/mcp-action-confirmation-handoff-33690.test.ts`, new
describe `[#34325]` (6 cases), for both tools:
- stdio with a client without `elicitation`: the bridge gets no door and
exactly `{ elicitsCapableClients: true }` as the fourth argument;
- stdio with a client that has the capability: main's door (the elicitor
alone), three arguments, no facts;
- Streamable HTTP after an `initialize` that advertised `elicitation`:
no door, two arguments.
- One existing #33712 pin, "a client WITHOUT the capability", pinned
`door: undefined, argCount: 2` on stdio. The door is still `undefined`;
the pin now also reads `facts: { elicitsCapableClients: true }` and
`argCount: 4`. The intent is the same: the client is never asked and the
call is handed off. The Streamable HTTP pin is unchanged.
- Ablations, one-off, via `scripts/ablation-replace.mjs`: each anchor
went from 1 hit to 0, and each restore left the blob equal to HEAD with
an empty `git diff HEAD`. The tests import source through relative
paths, so no dist rebuild is on the path. All 7 went red:
- A1, the client sentence switched off: runtime stdio x2 red.
- A2, the in-app clause reverted to today's wording: runtime stdio x2
and HTTP x2 red.
- A3, the bridge's forwarding of the flag deleted: runtime stdio x2 red.
- A4, `confirmAdmittedAction` stops passing it: runtime stdio
`run_action` red.
- A5, the resume path stops passing it: runtime stdio `resume_run` red.
- A6, `actionCallDoorFor` never returns the facts: mcp stdio x3 red (one
existing pin and two new ones).
- A7, the facts are set without a read `initialize`: mcp HTTP x3 red
(the existing #33712 HTTP pin and two new ones).
- All seven re-run on head fa794d0 after the rework: same red sets,
every restore equal to HEAD.
## Acceptance notes
- An out-of-repo bridge built against main keeps compiling and behaving
as today. On a stdio client without `elicitation` its refusal keeps the
old wording until it reads `facts`. carrier: cloud (if cloud implements
that bridge).
- The spec's step-3 prose (`packages/spec/src/contracts/ai-service.ts`)
still describes one message with both routes. The HTTP door's omission
of the client route follows ruling 6909391261. The prose is left as it
is.
## Verification
Two-minute check: `pnpm --filter @objectstack/runtime exec vitest run
src/action-confirmation-handoff-33690.test.ts -t 34325`. Expect 7
passing, including `stdio, a client without elicitation (run_action)`
and `Streamable HTTP, no door (run_action)`.
Readings at fa794d0:
<details><summary>build, typecheck, vitest (under
os-verify-lock)</summary>
- `pnpm --filter '@objectstack/runtime^...' --filter
'@objectstack/mcp^...' build && mcp typecheck && runtime typecheck &&
both pin files`: VERDICT command-exit 0 (pins 53/53 and 34/34).
- `pnpm --filter @objectstack/mcp test`: MCP_EXIT=0, Test Files 85
passed (85), Tests 1515 passed (1515).
- `pnpm --filter @objectstack/runtime test`: RUNTIME_EXIT=0, Test Files
649 passed (649), Tests 12034 passed, 25 skipped (12059).
</details>
<details><summary>derived gate families</summary>
- `dispatch-gates --commands --repo objectstack-ai/objectstack`: 69
families.
- 68 exit 0, including `check-adr-0087-registration` and
`check-changeset-no-major` on the `yes (widening)` changeset.
`check:dual-build-cjs-loads` exit 3 (PREREQUISITE NOT MET: no whole-repo
dist), so it is NOT MEASURED locally and left to CI.
- `--ran` with exit codes: 69 derived, 68 run, 1 NOT-MEASURED, 0 UNRUN
(exit 0).
- `overlap-check`: clean against origin/main 98bda0a. No merge of
main was needed: main's 4 new commits do not touch `packages/mcp` or
`packages/runtime`.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr
<!-- signed: repo:objectstack#4 · os-justin ·
session_01QSeKYo86w1wqy2z2fMrryr -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
The `no_confirmation_service` refusal (`428 ACTION_CONFIRMATION_REQUIRED`) of the MCP `run_action` and `resume_run` tools now names the route that works on the door that asked. On every door it says that a person performs the action in the app and that the same change must not be made with another tool. On the stdio door, for a client that did not advertise `elicitation`, it also says that a client that supports confirmation is asked in place on that server. The Streamable HTTP door, which asks no client, does not carry that sentence. The code, the status and `details` are unchanged. No type is made optional: `McpActionCallDoor` is unchanged, and it is still passed only when the client can be elicited. The added, optional surface is a new exported type `McpActionCallDoorFacts` (`{ elicitsCapableClients?: true }`) and an optional fourth parameter `facts` on `McpActionBridge.runAction` and `resumeRun`. The tools pass it, after an `undefined` door, only for a stdio client without `elicitation`. A bridge that does not read it compiles and answers as before.
0 commit comments