Repository navigation
fix(mcp): initialize points at the served SKILL.md; run_action names the no_confirmation_service next step - #37355
Conversation
…the no_confirmation_service next step Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 662aaefdeb623e36e5ae1e2f1feeb48cc73059b3 && git checkout 662aaefdeb623e36e5ae1e2f1feeb48cc73059b3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 134b71dbb0409e1ae2561fb77effcb20f97b0d10 e3c3ac47a03a6b0c76ba9fa5228318e8634e031c && git checkout -B drift-repro 134b71dbb0409e1ae2561fb77effcb20f97b0d10 && git merge --no-ff e3c3ac47a03a6b0c76ba9fa5228318e8634e031c
node scripts/docs-audit/affected-docs.mjs --json 134b71dbb0409e1ae2561fb77effcb20f97b0d10
|
|
repo:objectstack#4 · os-justin · session_01QSeKYo86w1wqy2z2fMrryr 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYo86w1wqy2z2fMrryr Landing · head
State: L1 ACCEPT on this head (7176128903); every check-run green or expected skip. Ready and auto-merge in this stroke. On MERGED, #35778 closes by |
… that works on the door that asked (objectstack-ai#37367) Fixes objectstack-ai#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 objectstack-ai#34321, as ruling 6909391261 on objectstack-ai#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 objectstack-ai#37355 added. How the refusal site knows the door: the MCP tools already decide per call whether the client can be elicited (`actionConfirmationElicitorFor`, from objectstack-ai#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` (objectstack-ai#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 `[objectstack-ai#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 `[objectstack-ai#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 objectstack-ai#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 objectstack-ai#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>
Fixes #35778
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Items 1 and 2 of #35778. Item 3 (optional slimming of list_datasets / query_dataset, the spec
QueryDatasetInputSchemaand the validate_expression variable descriptions) is not taken: the card marks it optional and measure-first, and it stays open on the card.packages/mcp/src/mcp-server-runtime.ts: the open door's defaultinitializetext (DEFAULT_HTTP_INSTRUCTIONS) gains one sentence:Usage guide (SKILL.md): GET this endpoint's path plus /skill (by default /api/v1/mcp/skill).GET PREFIX/mcp/skillbesidePREFIX/mcpfrom the same domain list (packages/runtime/src/domains/mcp.tscreateMcpDomains, mounted indispatcher-plugin.tswith the sameprefix, default/api/v1), behind the sameisMcpServerEnabled()switch, answered by the samemcpservice (renderSkill), and anonymous, so it holds for every grant.handleHttpRequest's only caller in this repo is that domain. The sentence is relative to the endpoint because the prefix is configurable.instructionsstay whole (existing pins), and the stdio default names no URL, since a stdio server has no HTTP endpoint.packages/mcp/src/mcp-http-tools.ts:run_action's description gains one clause after the ACTION_CONFIRMATION_REQUIRED sentence:On details.reason "no_confirmation_service" a person performs it in the app: do not make the same change with another tool.Byte deltas:
tools-list-weight-34689.test.ts): 36,613 to 36,739 bytes (+126);run_actiondescription 1,228 to 1,352 (+124). The ceiling of 38,000 is unchanged and still holds.initializetext: +93 bytes (a bare bridge answers 533 characters). The 4,096-character bound pin on the longest default text still passes.Tests
initialize-selection-rule-34686.test.ts: the pointer is in the first paragraph for five grants (no scope, data:read, data:write, metadata:write with an authoring injection, data:read with one).mcp-action-confirmation-handoff-33690.test.ts:run_action's tools/list description carries the clause.scripts/ablation-replace.mjs(anchor hit 1 to 0, restored blob equal to HEAD,git diff HEADempty). The tests import the source, so no dist rebuild sits in the path:Acceptance notes
handleHttpRequestfrom its own code and mounts the MCP endpoint without the runtime dispatcher. Such a host gets this default only when it injects no instructions of its own. If it serves no sibling/skillpath, the sentence would not hold there; nothing in this repo is such a caller.Verification
Two-minute check:
pnpm --filter @objectstack/mcp exec vitest run src/initialize-selection-rule-34686.test.ts src/mcp-action-confirmation-handoff-33690.test.ts src/tools-list-weight-34689.test.ts. Expect 3 files passing, and a tools/list table line| run_action | 1352 | 884 | 2236 |.Readings at e3c3ac4:
mcp build, typecheck, vitest (under os-verify-lock)
@objectstack/mcp...build: VERDICT command-exit 0.pnpm --filter @objectstack/mcp typecheck, then the fullvitest run --maxWorkers=2: VERDICT command-exit 0. Test Files 85 passed (85), Tests 1509 passed (1509). check:test-typecheck OK.derived gate families
dispatch-gates --commands --repo objectstack-ai/objectstack: 68 families.check:dual-build-cjs-loadsexit 3 (PREREQUISITE NOT MET: no whole-repo dist), so it is NOT MEASURED locally and left to CI.--ranwith exit codes: 68 derived, 67 run, 1 NOT-MEASURED, 0 UNRUN.overlap-check: clean against origin/main.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr