Repository navigation
feat(runtime,mcp): ask the person in their MCP client before a confirmation-gated action runs - #34318
Conversation
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
📓 Docs Drift CheckThis PR changes 2 package(s): 31 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 37 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 8b09292f6340d8ba3af48d6a2800c56a8c2b8d7e && git checkout 8b09292f6340d8ba3af48d6a2800c56a8c2b8d7e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4c0cf65f79a7db985edc349d3615d3bb52d6362e c3019504e02664d6e96c940a28dfdaebb28d0198 && git checkout -B drift-repro 4c0cf65f79a7db985edc349d3615d3bb52d6362e && git merge --no-ff c3019504e02664d6e96c940a28dfdaebb28d0198
node scripts/docs-audit/affected-docs.mjs --json 4c0cf65f79a7db985edc349d3615d3bb52d6362e
|
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM Contract reviewServed-tier: The face is semantic, not a narrowing ( ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentThe change makes the spec's own declared step real at the one door that can carry it, and takes nothing away at any other. It follows the contract's order and its answer table. Findings:
Spoof, replay and race: the answer is read from the SDK's pending-request table for the one request the server sent on the connection it was sent on; a second or late answer finds no pending request. ADR-0011 already states what an No must-fix. Findings 1 and 2 earn a delta review of their fix. Implemented-by: |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM Review — PASSHead-sha: What holds
MustNone. ShouldThese are the contract record's findings 1 and 2, which I verified against the diff. Each earns a delta review of its fix, and I'd fix both in this PR before landing.
Nits
Board items for the area, not this diff: the no-service message still omits "use a client that supports confirmation" (contract step 3.3) and needs a carrier card before #33712 closes; #33712's close note owes "hosted HTTP users keep the email path until #34321"; Gates51 check runs at this head: 35 success, 16 skipped (the ui, docs, dogfood and temporal jobs the path filter leaves out, the opt-in jobs, and the queue-only and schedule-only verdicts), 0 failed or pending. Test Core 8/8, Build Core, TypeScript Type Check, Lint & Repo Gates, Check Changeset and the PR-body guards are green. The PR body records 70/70 derived dispatch gates run, all exit 0, and a clean The contract-review record for the |
… answer Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
…s, the record id on a line of its own Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
…stion Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM Contract reviewServed-tier: Delta review of the record on head ① Derived judgments
② Semver levelUnchanged and still matching: ③ Boundary flags
④ Design judgment
Nothing new of should-fix grade was introduced. The second admission pass is reads only and cannot run or hand off anything. No must-fix, no should-fix. Nits alone end the round. Implemented-by: |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM Review — PASS (delta)Head-sha: The head is the merge of the dev's What holds
Must / ShouldNone. Nits
GatesAt |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5 席位核对ACCEPT and landing · area S3 · 2026-11-16T08:40Z · head
Ready + auto-merge under the area S3 landing line (maintainer, project thread, 2026-11-15T11:06Z) and the pm-dispatch landing procedure (maintainer, 2026-11-15T15:56Z); in-flight work under the wind-down order (2026-11-16T07:43Z). Generated by Claude Code |
Stacks #34318's in-client elicitation onto the retired confirm member: run_action and resume_run pass the elicitor door as main does, and their bridge request no longer forwards the caller's confirm (the closed input refuses it first; elicitation never read it). Claude-Session: https://claude.ai/code/session_01FEkQ5kgF3mo9f7LXuv5hac Co-Authored-By: Claude <noreply@anthropic.com>
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
Requested by Steedos · project thread
Part of #33712
Clause-②: no
Metadata-protocol: semantic (at the MCP door, an author's
ai.requiresConfirmation: trueis confirmed in place for a client that advertiseselicitation. The dev confirms the level against the diff and, if it holds, adds the PR body'sSkills-docs:line.)Skills-docs: follow-up #34210 (widened to cover the in-client question and the
declined/cancelled/timed_outrefusals)维护者速读
ai.requiresConfirmation: true且客户端声明了征询能力的 stdio 调用;远程 HTTP 接口行为与字节均未变。回滚即还原本 PR。packages/runtime/src/action-dispatch.ts(confirmAdmittedAction的征询分支)、packages/mcp/src/action-confirmation-elicitation.ts(超时与取消的判读)、packages/runtime/src/domains/mcp.ts(resume_run分支)。pnpm --filter @objectstack/mcp exec vitest run src/mcp-action-confirmation-handoff-33690.test.ts,应见 18 个用例全绿,其中 stdio 同意/拒绝/取消与 HTTP 仍挂起各有专用例。What changes
Step 1 of the amended confirmation contract (
AI_ACTION_CONFIRMATION_CAPABILITY,packages/spec/src/contracts/ai-service.ts) at the MCPrun_actionandresume_rundoors, on the server that can carry it.@objectstack/mcp, newaction-confirmation-elicitation.ts:actionConfirmationElicitorFor(server, extra)answers an elicitor for the open tool call, orundefinedwhen the client did not advertise form-modeelicitationon this server'sinitialize(the SDK reads an emptyelicitation: {}as form mode). The elicitor sends ONEelicitation/create(form mode, emptyrequestedSchema) throughextra.sendRequest, related to the tool call, bounded byACTION_CONFIRMATION_ELICITATION_TIMEOUT_MS(five minutes, the door's bound the contract asks the door to name; a door constant, no authorable key), abandoned on the call's abort signal. It reads the result'sactiononly (a loose schema, so a form payload the SDK's ownElicitResultSchemawould reject cannot turn anacceptinto a failure). A timeout reads astimed_out; an error answer, an aborted call and a closed connection read ascancel(the abort check comes first because the SDK rejects an aborted request with aRequestTimeouterror too).mcp-http-tools.ts: both tools pass{ elicitConfirmation }as a third bridge argument only when the elicitor exists; otherwise the bridge is called with exactly the two arguments it got before.McpActionBridge.runAction/resumeRungain the optionaldoor?: McpActionCallDoor. Both tool descriptions gain one sentence on the in-client question.@objectstack/runtime:action-dispatch.tsconfirmAdmittedAction(washandOffAdmittedAction) asks the elicitor after the same caller-scope subject verdict the hand-off asks, so the contract's step order holds (every admission gate, the subject load and its verdict, then the person).acceptreturns torunResolvedAction, which dispatches as any admitted call (theaction_invocationrow is written as for any run).decline/cancel/timed_outare refused428 ACTION_CONFIRMATION_REQUIREDwithreasondeclined/cancelled/timed_out, through the existingconfirmationRefusalOf. An elicitor that throws reads ascancelled. Nothing is handed off on any answer.action-execution.tsgainselicitActionConfirmationandactionConfirmationElicitSubject(the action, its label, the object, the record id, and the record's title viaresolveRecordTitle, left out rather than replaced by the id).domains/mcp.tsforwards the door from the bridge and givesresumeActionRunthe same branch:acceptresumes the parked run, any other answer refuses and the run stays paused.Tests
packages/runtime/src/action-confirmation-handoff-33690.test.ts, two new top-leveldescribes on the existing harness (the realbuildMcpBridgeover a kernel double;nameField: 'name'added to its object so the question can carry a title): run_action accept runs once and hands nothing off, the elicitor gets{ actionName, actionLabel, objectName, recordId, recordTitle: 'Ada' }; an accept covers one call; decline / cancel / timed_out refused with their reasons, nothing runs, nothing submitted; a failing elicitor readscancelled; an account and an unreadable record are refused before the elicitor is called; an ungated action is never asked; resume_run accept resumes with the call's values, decline keeps the run paused, an account is refused before asking.packages/mcp/src/mcp-action-confirmation-handoff-33690.test.ts, three new top-leveldescribes: a real SDKClienton the long-lived server'sStdioServerTransport(newline framing over two pipes) advertisingelicitation: {}: accept (one form-mode request naming action, object, record title and id), accept with an unread payload, decline, cancel, an error answer, and resume_run accept / decline; a client without the capability is never asked and the bridge gets two arguments. Streamable HTTP: a client that advertisedelicitationatinitializeis handed off on the next POST, answeredapplication/json; a non-gated call answers plain JSON.actionConfirmationElicitorForagainst a realClientover the SDK's in-memory pair: accept / decline / cancel,timed_outat a 50 ms bound,cancelwhen the client closes the connection mid-question,cancelon an error answer.Acceptance notes
Part of. Measured on@modelcontextprotocol/sdk1.32.1 (LATEST_PROTOCOL_VERSION2025-11-25): the door builds a freshServerper POST (handleHttpRequest, stateless, no session id), so the server that answerstools/callnever ran_oninitializeand holds no client capabilities; and a client's answer to a server request arrives as a separate POST, which in stateless mode reaches another fresh server with no pending request (server request ids are per-instance counters, so they cannot even be routed by id). Streaming thetools/callresponse alone carries the question out but nothing can carry the answer back. Eliciting there needs Streamable HTTP sessions (Mcp-Session-Id), which is an architecture decision; the options are in the report on the card. Until then the contract's own rule holds there: a door that cannot elicit hands off and is never refused for that alone.main(step 4, andACTION_CONFIRMATION_REFUSAL_REASONS) refuses them withcancelled/timed_out. This PR follows the spec text and does not editpackages/spec; the conflict is raised for a ruling on the card. Flipping it is two branches inelicitActionConfirmation.skill-md.ts) is untouched; it stays with mcp: the served MCP skill and TOOL_RETIRED_KEY_GUIDANCE still teach run_action confirm: true, which the MCP door no longer reads since the confirmation hand-off #34209.scripts/ablation-replace.mjs, restore verifiedgit diff HEADempty): elicit branch inconfirmAdmittedActionremoved: 6 run_action pins red; elicit branch inresumeActionRunremoved: resume accept / decline red; the tool's elicitor forcedundefined: 5 stdio pins red ("expected [] to have a length of 1 but got +0"); the account refusal inaiDoorConfirmationremoved: both account-before-asking pins red; the capability check inactionConfirmationElicitorForremoved: the non-capable stdio pin and the HTTP pin red.Verification
Readings at head
3557594b65unless named (merge oforigin/mainat0f74af49d5; the only commit after it drops two inert lint comments in a test file).Package tests (each under the shared verify lock, exit captured per part)
@objectstack/mcptest: 66 files / 1204 tests passed (exit 0).@objectstack/runtimetest (full): 607 files passed, 11101 tests passed / 19 skipped (exit 0), atc09b8aa557, before theorigin/mainmerge, which moved no runtime source (two unrelated runtime test files). At the final head, the five confirmation files (action-confirmation-handoff-33690,mcp-resume-run,action-confirmation-gate,action-dispatch,mcp-system-object-action-exposure): 149 tests passed.@objectstack/mcp(its public exports grew):@objectstack/verify52 files / 439 passed;@objectstack/http-conformance20 / 292;@objectstack/example-todo9 / 249;@objectstack/cliunit layer 423 / 6010 (integration layer declared to CI).@objectstack/dogfoodis the battery: not run (no!, no(narrowing)arm). The runtime's dependents are not re-run: its package exports did not move.pnpm --filter @objectstack/mcp typecheckandpnpm --filter @objectstack/runtime typecheck: exit 0, test layers within their ledgers.--no-inline-config) on the eight touched source and test files: exit 0. The repo-widepnpm lintis left to CI.Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 70 commands. 68 ran in one loop, each with its exit captured before any pipe: all exit 0.check:type-check-debt(re-measure, 0 entries, OK) andcheck:dual-build-cjs-loads(123 entries load) ran afterwards under the lock: exit 0.--ran: 70 derived, 70 run, 0 NOT-MEASURED, 0 UNRUN.git merge-tree --write-treeagainst PR #34236's headc53ea9d147and againstorigin/main: both clean.Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
🤖 Generated with Claude Code