Repository navigation
feat(runtime,mcp)!: a confirmation-gated action never runs on the MCP caller's own confirm — run_action and resume_run hand it to the person - #34202
Conversation
…n, never run it on the caller's confirm run_action and resume_run no longer read the confirm member on an action declaring ai.requiresConfirmation: true. After every admission gate and the caller-scope subject verdict, the call is handed to the host's pending-confirmation service (ACTION_CONFIRMATION_SERVICE) and answered status pending_confirmation with the pending id; with no service it is refused 428 ACTION_CONFIRMATION_REQUIRED, reason no_confirmation_service. An AI service account keeps its refusal, now carrying reason service_account. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
…sume_run; add the changeset Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
…aller's confirm; add the dogfood twin Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
…rmation contract Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
…t already-registered 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
… MCP caller's confirm 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
…ct exposure pin Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
…; the delete-gate parity pin leaves run_action's reason aside Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
📓 Docs Drift CheckThis PR changes 2 package(s): 1 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 — 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 539252eb6acea48618504016070adb63fca92424 && git checkout 539252eb6acea48618504016070adb63fca92424
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin dfb8ed3570b3be1cfbc3758ff791ace7c31fa1a2 a18a85ca6e1b65ace8c22d2e79a44412c102a70a && git checkout -B drift-repro dfb8ed3570b3be1cfbc3758ff791ace7c31fa1a2 && git merge --no-ff a18a85ca6e1b65ace8c22d2e79a44412c102a70a
node scripts/docs-audit/affected-docs.mjs --json dfb8ed3570b3be1cfbc3758ff791ace7c31fa1a2
|
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM Review claim (review-a, S3) · head 292c638 · 2026-11-16T01:15Z |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM Contract reviewServed-tier: Read: card #33690 body and its four comments (triage 6890545596, re-sequencing 6890862846, claim 6898081431, dev report 6904293454), the PR body, the net diff ① Derived judgmentsEach change the diff implies, judged against the tree:
Flipped pins: I read all eleven existing test files against the dev report's
No pin outside the confirmation behaviour was loosened. The REST, host-door and ungated controls are kept or added. ② Semver level
③ Boundary flags
④ Design judgmentThe narrowing makes the spec's own refusal real. The contract on Attempts to break the hand-off, all failed:
Findings:
Implemented-by: VERDICT: PASS |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM Review — PASS (one prose fix owed before landing)Head-sha: Contract face: a declared narrowing, so the whole diff is under the Owed
What holds (from the record, checked where named)
Nits (no re-review needed) These are the record's five:
Gates: at review time 38 success, 18 skipped, none red. |
…ion line Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM Review — PASS (delta)Head-sha: The owed prose fix is done. In The contract record still holds. The delta touches no code, schema, docblock or governed text, only the declaration line the record already named as owed. Record 6904719554 therefore covers this head, and no new record is needed. Still owed (unchanged): #34209 must land in the same release, because Gates: at review time 34 success, 18 skipped, none red, so every check is green. Can land. |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5 席位核对ACCEPT and landing · area S3 · 2026-11-16T01:50Z · 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). Generated by Claude Code |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43788698581 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5
Requested by Steedos · project thread
Fixes #33690
Clause-②: no (narrowing)
Metadata-protocol: semantic
Skills-docs: follow-up #34210
维护者速读
ai.requiresConfirmation: true的动作,经 MCPrun_action/resume_run调用时,不再因调用方自己发的confirm: true而执行;改为交给宿主的待确认服务(返回待确认编号),没有该服务时拒绝(428,reason: no_confirmation_service)。confirm: true无人值守跑这类动作的脚本/代理会被挂起或拒绝;开源版无该服务,这类调用一律 428。回滚即 revert 本 PR。packages/runtime/src/action-dispatch.ts(admitResolvedAction 中新分支,只对 MCP 门生效);packages/runtime/src/domains/mcp.ts(resume_run 的移交分支);packages/runtime/src/action-execution.ts(handOffActionConfirmation)。pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/action-confirmation-handoff-33690.test.ts,预期 16 个全绿(同一请求发 5 次,执行 0 次、5 个待确认编号)。What changes
BREAKING for an MCP client, an agent or a script that runs an action declaring
ai.requiresConfirmation: truethroughrun_actionorresume_runby sendingconfirm: trueitself. Ruled on the card (re-sequencing comment 6890862846): the caller's ownconfirm: truenever counts on such a call. The person it runs as confirms it in the app.This implements the hand-off and refusal steps of the amended confirmation contract (
AI_ACTION_CONFIRMATION_CAPABILITY, the docblock ofpackages/spec/src/contracts/ai-service.ts, read and not edited). No door elicits yet (#33712), so every declared-gated MCP call takes the hand-off.IActionConfirmationService(registered underACTION_CONFIRMATION_SERVICE) throughsubmit. The tool answersstatus: 'pending_confirmation'with the service'spendingId, a plain message,actionNameandobjectName. That answer is the tool's successful result. Nothing runs, and noaction_invocationrow is written. Aresume_runhand-off carriesrun: { runId, values }, and the run stays paused.428 ACTION_CONFIRMATION_REQUIREDwithdetails.reason: 'no_confirmation_service', with or withoutconfirm: true.pendingIdis a fault. The call fails and nothing runs.details.reason: 'service_account'at every action door./actionsstays outside the gate for a person.dispatchAction) under theaiposture still readsconfirm. The hand-off is keyed on the MCP door, not the posture.delete_recordanddelete_recordsgates still readconfirm: true.confirmstays accepted onrun_actionandresume_run; it is not read, and its tool text says so.Files:
packages/runtime/src/action-execution.ts:aiDoorConfirmationresolveActionConfirmationServicehandOffActionConfirmationrefuseDeniedSubjectBeforeHandOffservice_accountreasoninvokeBusinessActionreturns the pending answer.action-dispatch.ts:confirmationHandOffon the resolved call, thehandedOffrun outcome, andhandOffAdmittedActionafter the verdict.domains/mcp.ts:resumeAdmissionRefusalanswers the hand-off step (name kept, ADR-0066 anchors it), andrefuseUnresumableAdmittedRunis factored out so the hand-off branch runs steps 4 and 5 first.packages/mcp/src/mcp-http-tools.ts: therun_action/resume_rundescriptions teach the pending answer and the refusal.Tests
packages/runtime/src/action-confirmation-handoff-33690.test.ts(16 tests):confirm: true, the call executes 0 times, and each attempt is held with its own pending id.pendingIdthrows.service_accountand nothing is read.resume_run: 5 sends resume 0 times, the run rides the hand-off, and with no service the run stays paused./actionsfor a person, the host door under theaiposture, and a plain action.packages/mcp/src/mcp-action-confirmation-handoff-33690.test.ts(4 tests) uses the real MCP HTTP door:code+status+details.reason.packages/qa/dogfood/test/action-confirmation-handoff-33690.dogfood.test.tsruns the real stack,SecurityPlugin, MCP over HTTP and a service double. Sent 3 times, the call writes 0 times and is held 3 times for the person. CONTROL: an undeclared action runs at once.confirm: truerunning the action):packages/runtime/src/action-confirmation-gate.test.ts: the MCP-door describe.packages/runtime/src/mcp-resume-run.test.ts: the confirmed resume, the account details, and the delegated CONTROL.packages/runtime/src/action-dispatch.test.ts: the ADR-0151 D3 rule 3 account details, plus the person and delegated MCP CONTROLs.packages/runtime/src/domains/api-action-forward.test.ts: in the MCP list_actions offers sys_api_key.revoke_api_key as runnable to an API-key caller, and run_action then refuses it 403 #28943 pair, the gated call is now held. The API-key guard and the session revoke are kept on a twin that declares no confirmation.packages/runtime/src/mcp-system-object-action-exposure.test.ts: the HITL gate test.packages/runtime/src/platform-admin-action-gate.test.ts: the ruling E CONTROL. Gated actions are held for member and admin; ungated ones are unchanged.packages/mcp/src/mcp-resume-run-tool.test.ts: the tool text.examples/app-todo/test/mcp-actions.test.ts: step 7.packages/qa/dogfood/test/approval-decide-over-mcp.dogfood.test.tspackages/qa/dogfood/test/approval-read-over-mcp.dogfood.test.tspackages/qa/dogfood/test/mcp-system-object-action-exposure.dogfood.test.tsAcceptance notes
api-typed declared-gated action whose forward would be refused (thesys_api_keycredential guard, an organization-role endpoint) is now held or refused at the confirmation step before that refusal is reached. The contract places the hand-off after admission and before execution, and those refusals sit in the forward.list_actionsstill marks them unavailable.packages/mcp/src/skill-md.ts, and its mirrorui/apps/console/src/pages/developer/objectstack-skill.ts) andTOOL_RETIRED_KEY_GUIDANCEinpackages/spec/src/ai/tool.zod.tsstill teachconfirm: trueforrun_action. The mirror is outside this card's surface, so this is reported for follow-up.Skills-docs:above names the published skills.packages/qa/scenarios/src/runner/observe.tsrule 1 reads a successful write call asapplied, so a hand-off answer would be gradedappliedon a host that registers the service. No open-source stack registers one. This is reported for follow-up.Verification
Final head
292c638502. Every family CI runs is read from this PR's check-runs, not re-run here.Focused pins and suites
pnpm --filter @objectstack/runtime exec vitest run(whole package) at2266f4da70, the last source commit before the main merge: Test Files 610 passed (610), Tests 12430 passed, 19 skipped. RUNTIME_EXIT=0.pnpm --filter @objectstack/mcp exec vitest run(whole package) at2266f4da70: Test Files 66 passed (66), Tests 1189 passed (1189). MCP_EXIT=0.mcp-resume-run-tool.test.ts: Test Files 4 passed (4), Tests 160 passed; Test Files 1 passed (1), Tests 10 passed.292c638502, re-run after the test-only commits that followed the battery:mcp-delete-record-confirmation, the two approvals files, and the system-object exposure file): Test Files 5 passed (5), Tests 35 passed (35).src/mcp-system-object-action-exposure.test.ts: Test Files 1 passed (1), Tests 11 passed (11).@objectstack/example-todotest,@objectstack/runtimetypecheck (withcheck:test-typecheck) and@objectstack/mcptypecheck all exit 0 at56a42d81e2, after the closure build exited 0.--no-inline-configon every changed.tsfile: exit 0.Ablation: put the caller's confirm back as the confirmation
Both legs used
node scripts/ablation-replace.mjs, which checks that the anchor hits, that the mutation lands on disk, and that the restore matches the blob at HEAD.packages/runtime/src/action-execution.ts:confirmationHandOff: { door: 'mcp', … }was replaced withconfirmation: input. Anchor x1 to x0; blobfa5e3071e0dato93e90f85b005.action-confirmation-handoff-33690.test.tswent red, Tests 6 failed, 10 passed. Among the failures: "the same request with confirm: true, sent 5 times, executes 0 times and is held 5 times with a pending id", "holds the call with the member and without it alike", and "no service registered: refused 428 … reason no_confirmation_service".fa5e3071e0da;git diff HEADempty.packages/runtime/src/domains/mcp.ts:if (handOff) {was replaced withif (handOff && (input as any)?.confirm !== true) {. Blob0be1c84eed37toa50361d0cffd.0be1c84eed37;git diff HEADempty.git diff HEADmeasured 0 bytes.Full dogfood battery (the title carries a bang)
56a42d81e2under the verify lock (VERDICT command-exit 0 for the batch; DOGFOOD=1): Test Files 2 failed, 466 passed, 3 skipped (471); Tests 1 failed, 3959 passed, 42 skipped (4002).ai.descriptionwas under the 40-character floor. That made a ZodError at collection.mcp-delete-record-confirmation.dogfood.test.tscompared the delete gate's detail keys withrun_action's, which now carryreason. The pin now leavesreasonaside and asserts that the delete gate carries none, per the bounds.292c638502(above). The battery was not re-run end to end after those two test-only commits, and CI runs it.Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 74 families derived at292c638502. 72 ran with exit 0.check:dual-build-cjs-loads: exit 3, PREREQUISITE NOT MET, because there is no full workspace build here.check:type-check-debt: a lock queue-timeout, and then the re-measure was killed by my own timeout wrapper.--ranreconciliation: "74 derived famil(ies) accounted for — 72 run, 2 NOT-MEASURED", exit 0.node scripts/check-platform-checklist.mjs --changed-from origin/main: OK, 29 anchors judged, 0 lost.check-changeset-no-major --event: exit 0, narrowing arm,Metadata-protocol: semantic.check-adr-0087-registration: exit 0, not-required (already-registered).check-partof-closing-keyword: exit 0.check-closing-keyword-parity --body: binds only the card named on line 4 of this body.git merge-tree --write-treeis clean against origin/main and against the head of the open spec PR that editsai-service.ts.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5